Skip to content

Commit

Permalink
Add --quiet parameter to update action
Browse files Browse the repository at this point in the history
Reduces feedback output from fetching repo updates.
  • Loading branch information
philclifford committed Feb 14, 2023
1 parent dd0dff9 commit 5c4f48b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ cog.out(f"```\n{help}\n```")
]]] -->
```
deb-get {update [--repos-only] | upgrade | show <pkg list> | install <pkg list>
deb-get {update [--repos-only] [--quiet] | upgrade | show <pkg list> | install <pkg list>
| reinstall <pkg list> | remove [--remove-repo] <pkg list>
| purge [--remove-repo] <pkg list>
| search [--include-unsupported] <regex> | cache | clean
Expand All @@ -76,6 +76,7 @@ update
When --repos-only is provided, only initialize and update deb-get's
external repositories, without updating apt or looking for updates of
installed packages.
When --quiet is provided the fetching of deb-get repository updates is done without progress feedback.
upgrade
upgrade is used to install the newest versions of all packages currently
Expand Down
20 changes: 15 additions & 5 deletions deb-get
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,22 @@ function refresh_supported_cache_lists() {

function update_repos() {
local REPO_URL=""
# preserve current behaviour for now but allow modification via env
local CURL_VERBOSITY="-q --show-progress --progress=bar:force:noscroll "
local WGET_VERBOSITY="-q"

if [[ "$*" == *"--quiet"* ]] ; then
CURL_VERBOSITY="-Ss"
WGET_VERBOSITY="-q"
export WGET_VERBOSITY CURL_VERBOSITY
fi


for REPO in $(find "${ETC_DIR}" -maxdepth 1 -name "*.repo" ! -name 00-builtin.repo ! -name 99-local.repo -type f -printf "%f\n" | sed "s/.repo$//"); do
export REPO
fancy_message info "Updating ${ETC_DIR}/${REPO}"
REPO_URL="$(head -n 1 "${ETC_DIR}/${REPO}.repo")"
${ELEVATE} wget -q --show-progress --progress=bar:force:noscroll "${REPO_URL}/manifest" -O "${ETC_DIR}/${REPO}.repo"
${ELEVATE} wget ${WGET_VERBOSITY} "${REPO_URL}/manifest" -O "${ETC_DIR}/${REPO}.repo"

# ${ELEVATE} rm "${ETC_DIR}/${REPO}.d/* # we currently leave old litter : either <- this or maybe rm older ones
# although so long as manifest is good we are OK
Expand All @@ -668,10 +678,10 @@ function update_repos() {
awk -F/ '/github/ {print "# fetching github repo";
print "GITREPO="$4"/"$5;\
print "BRANCH="$6;\
print "curl -L https://api.github.com/repos/${GITREPO}/tarball/${BRANCH} | ${ELEVATE} tar zx --wildcards \"*/${REPO}*/packages/*\" --strip-components=3"}
print "curl ${CURL_VERBOSITY} -L https://api.github.com/repos/${GITREPO}/tarball/${BRANCH} | ${ELEVATE} tar zx --wildcards \"*/${REPO}*/packages/*\" --strip-components=3"}
! /github/ {print "# fetching non-github repo";
print "tail -n +2 \"${ETC_DIR}/${REPO}.repo\" | sed \"s/^#//\" | ${ELEVATE} sort -u -o \"${ETC_DIR}/${REPO}.repo.tmp\"";\
print "${ELEVATE} wget -q --show-progress --progress=bar:force:noscroll -N -B \"${REPO_URL}/packages/\" -i \"${ETC_DIR}/${REPO}.repo.tmp\" -P \"${ETC_DIR}/${REPO}.d\"";
print "${ELEVATE} wget ${WGET_VERBOSITY} -N -B \"${REPO_URL}/packages/\" -i \"${ETC_DIR}/${REPO}.repo.tmp\" -P \"${ETC_DIR}/${REPO}.d\"";
print "${ELEVATE} rm \"${ETC_DIR}/${REPO}.repo.tmp\""
} '\
<<<${REPO_URL} | bash -
Expand Down Expand Up @@ -1480,14 +1490,14 @@ case "${ACTION}" in
list_debs "" --raw | grep "${1}"
fi;;
update)
if [ -n "${1}" ] && [ "${1}" != --repos-only ]; then
if [ -n "${1}" ] && [ "${1}" != --repos-only ] && [ "${1}" != --quiet ]; then
fancy_message fatal "Unknown option supplied: ${1}"
fi
elevate_privs
create_cache_dir
create_etc_dir
init_repos
update_repos
update_repos "$@"
if [ "${1}" != --repos-only ]; then
APPS="$(list_local_apps)"
APPS="${APPS}
Expand Down
4 changes: 2 additions & 2 deletions docs/deb-get.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "deb-get" "1" "October 6, 2022" "deb-get" "deb-get User Manual"
.TH "deb-get" "1" "February 14, 2022" "deb-get" "deb-get User Manual"
.hy
.SH NAME
.PP
Expand All @@ -25,7 +25,7 @@ deb-get - An installation manager for 3rd-Party deb packages
.IP
.nf
\f[C]
deb-get {update [--repos-only] | upgrade | show <pkg list> | install <pkg list>
deb-get {update [--repos-only] [--quiet] | upgrade | show <pkg list> | install <pkg list>
| reinstall <pkg list> | remove [--remove-repo] <pkg list>
| purge [--remove-repo] <pkg list>
| search [--include-unsupported] <regex> | cache | clean
Expand Down
4 changes: 2 additions & 2 deletions docs/deb-get.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
author: Martin Wimpress
date: October 6, 2022
date: February 14, 2022
footer: deb-get
header: deb-get User Manual
section: 1
Expand All @@ -16,7 +16,7 @@ deb-get - An installation manager for 3rd-Party deb packages
**deb-get** \[*COMMAND*\]...

```
deb-get {update [--repos-only] | upgrade | show <pkg list> | install <pkg list>
deb-get {update [--repos-only] [--quiet] | upgrade | show <pkg list> | install <pkg list>
| reinstall <pkg list> | remove [--remove-repo] <pkg list>
| purge [--remove-repo] <pkg list>
| search [--include-unsupported] <regex> | cache | clean
Expand Down

0 comments on commit 5c4f48b

Please sign in to comment.