# HG changeset patch # User Aleksej Bobylev # Date 1450359875 -7200 # Node ID ae9ace90449c24463ee23b4468061e08a8556cdc # Parent ce0db4329d294cf3c6ec1079b0ffd73e1e070faf Module 'install': process option '--local' without using the databases diff -r ce0db4329d29 -r ae9ace90449c modules/install --- a/modules/install Wed Dec 16 12:01:42 2015 +0200 +++ b/modules/install Thu Dec 17 15:44:35 2015 +0200 @@ -145,8 +145,6 @@ # Also we can prefer local packages over mirrored/cached using '--local' option [ "$dir" == '/home/boot/packages' ] && local='yes' debug " local='$local'" - [ -n "$local" ] && tazpkg mkdb "$dir" --forced >/dev/null - # "--nodeps" option prevents to install dependencies if [ "$answer" -eq 0 -a -z "$nodeps" ]; then @@ -159,14 +157,22 @@ found='0' # Prefer local packages if [ -n "$local" ]; then - _ 'Checking if package "%s" exists in local list...' "$pkg" - pkgfile=$(awk -F$'\t' -vp="$pkg" ' - $1==p{printf "%s-%s.tazpkg", $1, $2; exit 1} - ' "$dir/packages.info") - if [ -n "$pkgfile" ]; then - found='1' - tazpkg install "$dir/$pkgfile" - fi + [ -z "$quiet" ] && _ 'Checking if package "%s" exists in local list...' "$pkg" + # Find local package + tempd="$(mktemp -d)"; cd "$tempd" + for pkgfile in $dir/$pkg-*.tazpkg; do + # Extract receipt from each matched package + cpio -F "$pkgfile" -i receipt >/dev/null 2>&1 + name=$(. receipt; echo $PACKAGE) + rm receipt + if [ "$name" == "$pkg" ]; then + found='1' + # Install the first matched package: normally there is only one package + # with the $PACKAGE matched in the receipt + tazpkg install "$pkgfile" + fi + done + rm -r "$tempd" fi debug " found='$found'"