From ed12c7dcd69f1abf15a42ae1919b8c2166553318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Tue, 14 Feb 2012 21:20:28 +0100 Subject: Add libreaddiff, a script to diff lists of packages in abs or db. --- libreaddiff | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 libreaddiff diff --git a/libreaddiff b/libreaddiff new file mode 100755 index 0000000..c8b5214 --- /dev/null +++ b/libreaddiff @@ -0,0 +1,97 @@ +#!/bin/bash +# -*- coding: utf-8 -*- +# Copyright (C) 2011, 2012 Michał Masłowski +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +set -e + +. /etc/libretools.conf +custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf +[ -e $custom_config ] && . $custom_config + +for arg in "$@" ; do + case "$arg" in + -h|--h|--he|--hel|--help|-\?) + echo 'Usage: find-pkgs.sh repo [arch] + +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 + +# 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 \ + <( ( + cd /var/lib/pacman/sync + for f in $repo.db ; do + tar xOf $f | python -c 'import sys +arch = None +name = None +version = None +it = iter(sys.stdin) +try: + while True: + line = next(it) + if line == "%ARCH%\n": + arch = next(it) + if arch == "'"$arch"'\n" or "'$repo'" not in '"$archrepos"': + print("%s-%s" % (name.strip(), version.strip())) + if line == "%NAME%\n": + name = next(it) + if line == "%VERSION%\n": + version = next(it) +except StopIteration: + pass +' + done + ) | sort ) \ + <( ( + cd "${WORKDIR}/abslibre" + # Needed to not include pkgnames specific to other arches. + CARCH=$arch + for f in $repo/* ; do + unset pkgname + unset epoch + unset pkgver + unset pkgrel + unset arch + . $f/PKGBUILD || continue + is_here=false + for arc in ${arch[@]} ; do + if [ "$arc" = "any" -o "$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' -- cgit v1.2.3 From eeb2d8b4b6d56ae11c17b0bb25fb7bd20570c9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Wed, 15 Feb 2012 11:16:32 +0100 Subject: Don't remove sudo, makechrootpkg needs it. --- update-cleansystem | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update-cleansystem b/update-cleansystem index af215d7..dd3ff6c 100755 --- a/update-cleansystem +++ b/update-cleansystem @@ -19,6 +19,6 @@ pacman -r ${tmpdir} --config /etc/pacman.conf -Sy pacman -r ${tmpdir} \ --config /etc/pacman.conf \ -Sp --print-format "%n" \ - base base-devel ${@} | sort > /etc/libretools.d/cleansystem + base base-devel sudo ${@} | sort > /etc/libretools.d/cleansystem exit $? -- cgit v1.2.3 From c19d60441e3e5c1940c5d4b9c57e3022d969fac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Sat, 18 Feb 2012 13:32:29 +0100 Subject: Don't run update-cleansystem on each librechroot -c run. Typical mips64el packaging requires one run of it per package, while most package updates don't change the cleansystem set. So it would just use more time and bandwidth. --- librechroot | 1 - 1 file changed, 1 deletion(-) diff --git a/librechroot b/librechroot index 0398a0f..9e292f5 100755 --- a/librechroot +++ b/librechroot @@ -45,7 +45,6 @@ function usage { function clean_chroot { # Clean packages with pacman msg "Cleaning chroot: ${CHROOTDIR}/${CHROOTNAME}" - update-cleansystem cp "/etc/libretools.d/cleansystem" "${CHROOTDIR}/${CHROOTNAME}/cleansystem" (cat < Date: Sat, 18 Feb 2012 13:45:31 +0100 Subject: Support running toru and toru-path via PATH. --- toru | 2 +- toru-path | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toru b/toru index 9616119..41acb18 100755 --- a/toru +++ b/toru @@ -12,7 +12,7 @@ # * Possibility to hook up ABS dirs besides ABSROOT (low priority) # * Tell updates and non available binary packages (working on this) -source $(dirname $0)/toru-utils +source $(dirname $(command -v $0))/toru-utils # Saves contents on a named cache # $1 cache name (repo) diff --git a/toru-path b/toru-path index 7500aed..5081115 100755 --- a/toru-path +++ b/toru-path @@ -1,6 +1,6 @@ #!/bin/bash -source $(dirname $0)/toru-utils +source $(dirname $(command -v $0))/toru-utils LASTSYNCFILE=${TORUPATH}/lastsync.paths -- cgit v1.2.3 From 77647dc95bec7f72a5ecee7d303aa2802f39adb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Sat, 18 Feb 2012 13:53:07 +0100 Subject: Fix some toru "unknown errors". --- toru | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toru b/toru index 41acb18..de0e92f 100755 --- a/toru +++ b/toru @@ -137,7 +137,7 @@ update() { fi - package_paths=($(read_cache ${_repo}.paths)) + package_paths=($(read_cache ${_repo}.paths || true)) # Inform how many PKGBUILDS were found and quit immediately if none $quiet || msg "Found $((${#pkgbuilds[*]}-1)) PKGBUILDs to update" @@ -165,7 +165,7 @@ update() { for _pkg in ${pkgname[@]}; do # Keep removing unneeded stuff - unset package_${_pkg} >/dev/null 2>&1 + unset package_${_pkg} >/dev/null 2>&1 || true # Fill the list of packages to find packages_in_abs+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel)) package_paths+=($_pkg:$_pkgpath) -- cgit v1.2.3 From 8327b7175f71ca224a3acadef5c83eac22970a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Sat, 18 Feb 2012 14:13:29 +0100 Subject: Let toru ignore broken PKGBUILDs instead of failing. --- toru | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toru b/toru index de0e92f..a6c7b7d 100755 --- a/toru +++ b/toru @@ -148,7 +148,7 @@ update() { update_sync_file=true # Load PKGBUILD's metadata - source ${_pkgbuild} + source ${_pkgbuild} || continue # Guess pkgbase from PKGBUILD's basedir _pkgpath=$(dirname "${_pkgbuild}") -- cgit v1.2.3 From ef12ca293c2a85fde729c39900fa2d481c8b42da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Sat, 18 Feb 2012 14:23:16 +0100 Subject: Use a consistently plural message. --- toru | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toru b/toru index a6c7b7d..e878b3a 100755 --- a/toru +++ b/toru @@ -199,7 +199,7 @@ update() { split_pkgname_from_pkgver ${TMPDIR}/packages_in_abs | sort -k1b,1 > ${TMPDIR}/in_abs split_pkgname_from_pkgver ${TMPDIR}/packages_in_sync | sort -k1b,1 > ${TMPDIR}/in_sync - $quiet || msg "This packages are available to update" + $quiet || msg "These packages are available to update" # Join both files by pkgname, the end result is: # pkgname syncver absver join ${TMPDIR}/in_sync ${TMPDIR}/in_abs | \ -- cgit v1.2.3 From 54b6cb03b60d1834130fa289188e9f232fab5898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Sat, 18 Feb 2012 14:44:22 +0100 Subject: Show a useful error message if a dependency is not found. Should stop the build, somehow doesn't. --- fullpkg-find | 16 +++++----------- toru | 3 +-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/fullpkg-find b/fullpkg-find index 8c0c063..e38014e 100755 --- a/fullpkg-find +++ b/fullpkg-find @@ -80,17 +80,16 @@ find_deps() { local found=false # TODO change for where_is or toru-path - local pkgdir=$(toru -p ${_dep}) + local pkgdir=$(toru -p ${_dep} \ + || error "dependency %s of %s not found" "${_dep}" "${pkgbase}" \ + && exit 1) if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then found=true pushd "${pkgdir}" > /dev/null # runs itself on dep's PKGBUILD dir - $0 -l ${next_level} ${build_dir} - -# probable circular deps - [ $? -eq 20 ] && return 20 + $0 -l ${next_level} ${build_dir} || return $? popd > /dev/null fi @@ -188,13 +187,8 @@ fi find_deps || { # Probable circular deps - if [ "$?" -eq 20 ]; then - -# Show error only on level 0 - if [ "$LEVEL" -eq 0 ]; then + if [ "$?" -eq 20 -a "$LEVEL" -eq 0 ]; then error "Check for circular deps on $build_dir/BUILDORDER"; - fi - fi # Pass message 20 exit 20 diff --git a/toru b/toru index e878b3a..766331b 100755 --- a/toru +++ b/toru @@ -297,8 +297,7 @@ while getopts 'haqfpum' arg; do f) force=true ;; u) commands+=(update);; p) shift $(( OPTIND - 1 )) - where_is "$1" - exit $?;; + where_is "$1" || exit 1;; m) commands+=(missing);; esac -- cgit v1.2.3 From b4aae66a7c3ba3eec714ca6cc11cd9913b5cf2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Sat, 18 Feb 2012 16:07:11 +0100 Subject: Don't error on unfound package, explain why it occurs. --- fullpkg-find | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fullpkg-find b/fullpkg-find index e38014e..9ddfa08 100755 --- a/fullpkg-find +++ b/fullpkg-find @@ -80,9 +80,9 @@ find_deps() { local found=false # TODO change for where_is or toru-path - local pkgdir=$(toru -p ${_dep} \ - || error "dependency %s of %s not found" "${_dep}" "${pkgbase}" \ - && exit 1) + # May fail, e.g. since abslibre-mips64el doesn't include + # arch=any packages. + local pkgdir=$(toru -p ${_dep}) || true if [ -n "$pkgdir" -a -d "${pkgdir}" ]; then found=true -- cgit v1.2.3