summaryrefslogtreecommitdiff
path: root/src/abslibre-tools/libreaddiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/abslibre-tools/libreaddiff')
-rwxr-xr-xsrc/abslibre-tools/libreaddiff114
1 files changed, 62 insertions, 52 deletions
diff --git a/src/abslibre-tools/libreaddiff b/src/abslibre-tools/libreaddiff
index 17e808b..010c7b9 100755
--- a/src/abslibre-tools/libreaddiff
+++ b/src/abslibre-tools/libreaddiff
@@ -24,35 +24,42 @@ set -e
. "$(librelib messages)"
. "$(librelib conf)"
-load_files libretools
-check_vars libretools WORKDIR
-for arg in "$@" ; do
- case "$arg" in
- -h|--h|--he|--hel|--help|-\?)
- {
- print 'Usage: %s repo [arch]' "${0##*/}"
- echo
- prose "This script outputs a diff of package names and versions
- in repo between pacman's sync db and abslibre checkout."
- } >&2
- exit 0
- ;;
- esac
-done
+main() {
+ load_files libretools
+ check_vars libretools WORKDIR
-# The repo to find missing packages in.
-repo=$1
-# The arch to check in Arch repos, other will have all arches checked.
-arch=${2:-mips64el}
-# A Python tuple of repos which don't have arch=any packages.
-archrepos='("core", "extra", "community")'
+ for arg in "$@" ; do
+ case "$arg" in
+ -h|--h|--he|--hel|--help|-\?)
+ {
+ print 'Usage: %s repo [arch]' "${0##*/}"
+ echo
+ prose "This script outputs a diff of package names and versions
+ in repo between pacman's sync db and abslibre checkout."
+ } >&2
+ exit 0
+ ;;
+ esac
+ done
-diff -U0 \
- <( (
- cd /var/lib/pacman/sync
- for f in $repo.db ; do
- tar xOf $f | python -c 'import sys
+ # The repo to find missing packages in.
+ repo=$1
+ # The arch to check in Arch repos, other will have all arches checked.
+ arch=${2:-mips64el}
+ # A Python tuple of repos which don't have arch=any packages.
+ archrepos='("core", "extra", "community")'
+
+ diff -U0 \
+ <(pacman_list_packages | sort ) \
+ <(abslibre_list_packages | sort ) \
+ | sed -rn 's/^[+-][^+-].+$/&/p'
+}
+
+pacman_list_packages() {
+ cd /var/lib/pacman/sync
+ for f in $repo.db ; do
+ tar xOf $f | python -c 'import sys
arch = None
name = None
version = None
@@ -71,29 +78,32 @@ try:
except StopIteration:
pass
'
- done
- ) | sort ) \
- <( (
- cd "${WORKDIR}/abslibre"
- # Needed to not include pkgnames specific to other arches.
- CARCH=$arch
- for f in $repo/* ; do
- load_PKGBUILD "$f/PKGBUILD" || continue
- is_here=false
- for arc in ${arch[@]} ; do
- if [[ "$arc" == "any" ]] || [[ "$arc" == "$CARCH" ]] ; then
- is_here=true
- break
- fi
- done
- if [[ "$is_here" == "true" ]] ; then
- for name in "${pkgname[@]}" ; do
- if [[ -z "$epoch" ]] ; then
- echo $name-$pkgver-$pkgrel
- else
- echo $name-$epoch:$pkgver-$pkgrel
- fi
- done
- fi
- done
- ) | sort ) | sed -rn 's/^[+-][^+-].+$/&/p'
+ done
+}
+
+abslibre_list_packages() {
+ cd "${WORKDIR}/abslibre"
+ # Needed to not include pkgnames specific to other arches.
+ CARCH=$arch
+ for f in $repo/* ; do
+ load_PKGBUILD "$f/PKGBUILD" || continue
+ is_here=false
+ for arc in ${arch[@]} ; do
+ if [[ "$arc" == "any" ]] || [[ "$arc" == "$CARCH" ]] ; then
+ is_here=true
+ break
+ fi
+ done
+ if [[ "$is_here" == "true" ]] ; then
+ for name in "${pkgname[@]}" ; do
+ if [[ -z "$epoch" ]] ; then
+ echo $name-$pkgver-$pkgrel
+ else
+ echo $name-$epoch:$pkgver-$pkgrel
+ fi
+ done
+ fi
+ done
+}
+
+main "$@"