diff options
author | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-06-30 19:28:03 -0300 |
---|---|---|
committer | Nicolas Reynolds <fauno@kiwwwi.com.ar> | 2011-06-30 19:28:03 -0300 |
commit | 8a97ce469507f3c4c0ea06ad0025b57405e42283 (patch) | |
tree | fbf2d44f18d3f8e284e8fd4a566fa31e1d81415e | |
parent | 73f49edd89a1bb4ed023b81bfcf113d4a6956887 (diff) |
minor fixes
-rwxr-xr-x | toru | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -52,21 +52,21 @@ print_package_array() { } -# Gets repo.db contents +# Gets repo.db contents (unordered) # $1 repo get_db_contents() { [ ! -r /var/lib/pacman/sync/$1.db ] && return 0 - bsdtar -tf /var/lib/pacman/sync/$1.db | \ - cut -d'/' -f1 | \ - sort -V -u + bsdtar -tf /var/lib/pacman/sync/$1.db | cut -d'/' -f1 } +# Get the pkgname extract_pkgname() { echo "$@" | tr " " "\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+$/\1/" } +# Get the fullpkgver extract_fullpkgver() { echo "$@" | tr " " "\n" | sed "s/^.\+-\([^-]\+-[^-]\+\)$/\1/" } @@ -103,10 +103,11 @@ update() { exit 0 } +# Traverse all PKGBUILDs found for _pkgbuild in ${pkgbuilds[@]}; do # The repo name is guessed -# You *must* use repo/pkgbase structure +# You *must* use a repo/pkgbase structure _pkgpath=$(dirname "${_pkgbuild}") _pkgbase=$(basename "${_pkgpath}") _pkgrepo=$(basename $(dirname "${_pkgpath}")) @@ -129,11 +130,13 @@ update() { # We've orderer the files! needed_updates=($(comm --nocheck-order -32 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) old_versions=($(comm --nocheck-order -31 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) + missing_packages=($(comm --nocheck-order -12 ${TMPDIR}/packages_to_sync ${TMPDIR}/packages_in_sync)) $quiet || msg "This packages are available to update" for _update in ${needed_updates[@]}; do pkg=$(extract_pkgname $_update) +# Only print pkgnames when in quiet mode (useful for scripts) $quiet && echo $pkg $quiet || { ver=$(extract_fullpkgver $_update) @@ -148,6 +151,11 @@ update() { } +# Find all the packages that are missing from the repo dbs (aka not built) +missing() { + true +} + ## MAIN @@ -155,12 +163,13 @@ commands=() repos=() quiet=false force=false -while getopts 'hqfu' arg; do +while getopts 'hqfum' arg; do case $arg in h) usage; exit 0 ;; q) quiet=true ;; f) force=true ;; u) commands+=(update);; + m) commands+=(missing);; esac shift $((OPTIND-1)) |