# HG changeset patch # User Christophe Lincoln # Date 1337106761 -7200 # Node ID bb5a37f13ad68c362fbd36bddadb244547c96211 # Parent ea3c01346d05620372e3ec1571de693140f0c6a1 A bunch of fix to add an lib diff -r ea3c01346d05 -r bb5a37f13ad6 lib/libspk.sh --- a/lib/libspk.sh Tue May 15 19:40:29 2012 +0200 +++ b/lib/libspk.sh Tue May 15 20:32:41 2012 +0200 @@ -14,7 +14,7 @@ mirrorurl="${root}${PKGS_DB}/mirror" installed="${root}${PKGS_DB}/installed" pkgsdesc="${root}${PKGS_DB}/packages.desc" -pkgsmd5="${root}${PKGS_DB}/packages.md5" +pkgsmd5="${root}${PKGS_DB}/packages.$SUM" # ????do we need packages.equiv???? blocked="${root}${PKGS_DB}/blocked.list" activity="${root}${PKGS_DB}/activity" diff -r ea3c01346d05 -r bb5a37f13ad6 spk-add --- a/spk-add Tue May 15 19:40:29 2012 +0200 +++ b/spk-add Tue May 15 20:32:41 2012 +0200 @@ -6,7 +6,8 @@ # Copyright (C) SliTaz GNU/Linux - BSD License # Author: See AUTHORS files # -. /usr/lib/slitaz/libspk.sh +#. /usr/lib/slitaz/libspk.sh +. lib/libspk.sh # Set to / for now until we add installing to chroot support # Could we update tools so they do not need this? @@ -89,10 +90,9 @@ # Add package checksum to pkgsmd5 sed -i "/ $(basename $package_dir)$/d" $pkgsmd5 2> /dev/null - oldpwd=$(pwd) cd $(dirname $package_file) || exit 1 $CHECKSUM $(basename $package_file) >> $pkgsmd5 - cd $oldpwd + cd - >/dev/null # Resolve package deps. if missing_deps $package_name $DEPENDS; then @@ -115,9 +115,10 @@ # Get files to remove if upgrading local files_to_remove if [ -f $package_dir/files.list ]; then - for file in $($package_dir/files.list); do + for file in $(cat $package_dir/files.list) + do grep -q "^$(echo $file | grepesc)$" $TMP_DIR/files.list && continue - local modifiers=$(cat $package_dir/modifiers 2> /dev/null;\ + local modifiers=$(cat $package_dir/modifiers 2> /dev/null; \ fgrep -sl $package_dir */modifiers | cut -d/ -f1) for i in modifiers; do grep -qs "^$(echo $file | grepesc)$" $i/files.list && continue 2 @@ -138,13 +139,13 @@ # Check possibly modified files against other packages file.list if $check; then - for pkg in $INSTALLED/*; do + for pkg in $installed/*; do [ "$pkg" == "$package_name" ] && continue [ -s $pkg/files.list ] || continue for file in $file_list; do # $package_name wants to install $file which is already - # Installed from $pkg + # installed from $pkg if grep -q ^$file$ $pkg/files.list; then # Tell $pkg that $package_name is going to overwrite some of its files if [ -s "$pkg/volatile.cpio.gz" ]; then @@ -191,15 +192,18 @@ fi # Merge ROOT_FS with Package FS - eval_gettext "Installing \$package_name... " + gettext "Installing"; echo -n " $package_name..." cp -a fs/* $ROOT/ status # Remove old config files - if [ -n $files_to_remove ]; then - eval_gettext "Removing old \$package_name... " + if [ "$files_to_remove" ]; then + gettext "Removing old"; echo -n " $package_name..." for file in $files_to_remove; do - remove_with_path $ROOT$file + if [ "$verbose" ]; then + gettext "Removing:"; echo " ${root}${file}" + fi + remove_with_path ${root}${file} done status fi @@ -245,12 +249,6 @@ install_local() { package_file="$1" check_valid_tazpkg $package_file - - # Check if forced install. - if ! [ "$forced" ]; then - check_installed $(package_name $package_file) - fi - install_package $package_file update_databases } @@ -275,11 +273,6 @@ # package_full=Package-Version local package_full=$(full_package $package_name) - # Check if forced install. - if ! [ "$forced" ]; then - check_installed $package_name - fi - cd $CACHE_DIR > /dev/null if [ -f "$package_full.tazpkg" ]; then echo -n "$(colorize "$package_full" 34)"; echo ": $CACHE_DIR)" diff -r ea3c01346d05 -r bb5a37f13ad6 spk-archive --- a/spk-archive Tue May 15 19:40:29 2012 +0200 +++ b/spk-archive Tue May 15 20:32:41 2012 +0200 @@ -39,12 +39,7 @@ status gettext "Extracting the pseudo fs... " - if [ -f fs.cpio.lzma ]; then - echo -n "(lzma) " - unlzma -c fs.cpio.lzma | cpio -idm --quiet && rm fs.cpio.lzma - elif [ -f fs.cpio.gz ]; then - zcat fs.cpio.gz | cpio -idm --quiet && rm fs.cpio.gz - fi + unlzma -c fs.cpio.lzma | cpio -idm --quiet && rm fs.cpio.lzma status } diff -r ea3c01346d05 -r bb5a37f13ad6 spk-rm --- a/spk-rm Tue May 15 19:40:29 2012 +0200 +++ b/spk-rm Tue May 15 20:32:41 2012 +0200 @@ -62,14 +62,15 @@ . $installed/$pkg/receipt if [ -n "$altered" ]; then - eval_gettext "The following packages depend on \$PACKAGE:"; echo + gettext "The following packages depend on"; boldify " $PACKAGE:" for i in $altered; do echo " $i" done fi refresh=$(cd $installed ; grep -sl ^$PACKAGE$ */modifiers) if [ -n "$refresh" ]; then - eval_gettext "The following packages have been modified by \$PACKAGE:"; echo + gettext "The following packages have been modified by" + boldify " $PACKAGE:" for i in $refresh; do echo " ${i%/modifiers}" done @@ -87,7 +88,7 @@ for i in $altered; do if [ -d "$installed/$i" ]; then # TODO: use spk-rm - echo "tazpkg remove $i --root=$root" + echo "spk-rm $i --root=$root" fi done fi @@ -101,9 +102,9 @@ gettext "Removing all installed files..." [ "$verbose" ] && newline if [ -f $installed/$PACKAGE/modifiers ]; then - for file in `cat $installed/$PACKAGE/files.list` + for file in $(cat $installed/$PACKAGE/files.list) do - for mod in `cat $installed/$PACKAGE/modifiers` + for mod in $(cat $installed/$PACKAGE/modifiers) do [ -f $installed/$mod/files.list ] && \ [ $(grep "^$(echo $file | grepesc)$" $installed/$mod/files.list | wc -l) -gt 1 ] \ @@ -115,7 +116,9 @@ else for file in $(cat $installed/$PACKAGE/files.list) do - [ "$verbose" ] && (gettext "Removing:"; echo -n " ${root}${file}") + if [ "$verbose" ]; then + gettext "Removing:"; echo -n " ${root}${file}" + fi remove_file ${root}${file} [ "$verbose" ] && status done @@ -131,8 +134,7 @@ gettext "Removing package receipt..." rm -rf $installed/$PACKAGE status - sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION$/d" \ - ${root}${PKGS_DB}/installed.$SUM 2> /dev/null + sed -i "/ $PACKAGE-${VERSION}${EXTRAVERSION}$/d" $pkgsmd5 2> /dev/null # Mofified ? if [ "$refresh" ]; then @@ -150,7 +152,7 @@ fi # TODO: use spk-add rm -r $installed/$i - tazpkg -gi ${i%/modifiers} --forced --root=$root + spk-add ${i%/modifiers} --forced --root=$root done fi }