]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
- cosmetics
authorMariusz Mazur <mmazur@pld-linux.org>
Tue, 21 Sep 2004 22:50:32 +0000 (22:50 +0000)
committerMariusz Mazur <mmazur@pld-linux.org>
Tue, 21 Sep 2004 22:50:32 +0000 (22:50 +0000)
Changed files:
    bin/functions -> 1.4
    bin/remove.sh -> 1.4

bin/functions
bin/remove.sh

index 53badf70f7d981c79e7ee84491e6896922c5690c..72f1d5523a11d7ae33fd6b219b1a1594aa4d7fa5 100644 (file)
@@ -1,5 +1,5 @@
 
-# Note: all functions expect to get N-V-R strings as file arguments (unless
+# Note: all functions expect to get N-V-R strings as pkg arguments (unless
 # it's obvious they shouldn't get them of course)
 
 # Read config
@@ -18,6 +18,7 @@ log() {
        echo `date "+%F %T"` "[$scriptname]" "--" "$@" >>~/pld-ftp-admin/log
 }
 
+# Wrapper so that we can test stuff without actually doing (allmost) anything
 if [ "$DEBUG" == "yes" ]; then
        rm()
        {
@@ -44,16 +45,16 @@ glob_packages()
        # Get just the name without the version tag
        basename=`echo $1|sed -e 's,-[^-]*-[^-]*$,,'`
        # Find packages beginning with that name
-       allfiles=`echo $basename*`
-       if [ "$allfiles" == "$basename*" ]; then
+       allpkgs=`echo $basename*`
+       if [ "$allpkgs" == "$basename*" ]; then
                # No files found
                return
        fi
-       allfiles=`echo "$allfiles"|sed -e 's, ,\n,g' -e 's,.src.rpm.info,,g'`
-       # Filter out files that just begin with basename, but ain't other
+       allpkgs=`echo "$allpkgs"|sed -e 's, ,\n,g' -e 's,.src.rpm.info,,g'`
+       # Filter out pkgs that just begin with basename, but ain't other
        # versions of that package
-       allfiles=`echo "$allfiles"|grep "$basename-[^-]*-[^-]*$"`
-       echo "$allfiles"
+       allpkgs=`echo "$allpkgs"|grep "$basename-[^-]*-[^-]*$"`
+       echo "$allpkgs"
 }
 
 # Generate a list of older packages
@@ -63,22 +64,22 @@ find_older_pkgs()
 {
        cd "$FTP_DIR/$1/SRPMS/.metadata/"
        list=""
-       for file in $2; do
-               # "Glob" for other files
-               allfiles=`glob_packages $file`
+       for pkg in $2; do
+               # "Glob" for other pkgs
+               allpkgs=`glob_packages $pkg`
                # Get just the name without the version tag (we need it)
-               basename=`echo $file|sed -e 's,-[^-]*-[^-]*$,,'`
+               basename=`echo $pkg|sed -e 's,-[^-]*-[^-]*$,,'`
                # Get only versions
-               allfiles=`echo "$allfiles"|sed -e "s,^$basename-,,"`
+               allpkgs=`echo "$allpkgs"|sed -e "s,^$basename-,,"`
                # Sort (note - this ain't perfect sorting)
-               allfiles=`echo "$allfiles"|sort -n`
+               allpkgs=`echo "$allpkgs"|sort -n`
                # Readd names
-               allfiles=`echo "$allfiles"|sed -e "s,^,$basename-,"`
+               allpkgs=`echo "$allpkgs"|sed -e "s,^,$basename-,"`
                # Grep packages < current package
-               allfiles=`echo "$allfiles"|grep -B 999 "$file"|grep -v "^$file$"`
+               allpkgs=`echo "$allpkgs"|grep -B 999 "$pkg"|grep -v "^$pkg$"`
                # Add to the list
-               allfiles=`echo $allfiles`
-               list="$list $allfiles"
+               allpkgs=`echo $allpkgs`
+               list="$list $allpkgs"
        done
        echo $list
 }
@@ -90,21 +91,21 @@ find_other_pkgs()
 {
        cd "$FTP_DIR/$1/SRPMS/.metadata/"
        list=""
-       for file in $2; do
-               # "Glob" for other files
-               allfiles=`glob_packages $file`
+       for pkg in $2; do
+               # "Glob" for other pkgs
+               allpkgs=`glob_packages $pkg`
                # Cut out our own package
-               allfiles=`echo "$allfiles"|grep -v "^$file$"`
+               allpkgs=`echo "$allpkgs"|grep -v "^$pkg$"`
                # Add to the list
-               allfiles=`echo $allfiles`
-               list="$list $allfiles"
+               allpkgs=`echo $allpkgs`
+               list="$list $allpkgs"
        done
        echo $list
 }
 
 # Remove packages in given tree
 # Args: $1 - ftp tree
-#       $2 - list of packages (info files) to remove
+#       $2 - list of packages to remove
 #       $3 - force option
 remove_pkgs() {
        cd "$FTP_DIR/$1/SRPMS/.metadata/"
@@ -112,16 +113,16 @@ remove_pkgs() {
        if [ "$3" == "force" ]; then
                rmopt="-f"
        fi
-       for srcfile in $2; do
+       for pkg in $2; do
                # Remove all files connected to the old src.rpm
                # (+ the src.rpm itself)
-               for i in `grep '^file:' $srcfile.src.rpm.info`; do
+               for i in `grep '^file:' $pkg.src.rpm.info`; do
                        arch=`echo $i|cut -d: -f 2`
                        file=`echo $i|cut -d: -f 3`
                        rm $rmopt "$FTP_DIR/$1/$arch/RPMS/$file"
                done
                # And finally remove the .info file
-               rm $rmopt $srcfile.src.rpm.info
+               rm $rmopt $pkg.src.rpm.info
        done
 }
 
index e14c920bdfab905899e3a1fab38995c242008a5e..5894a6fe9f4abaf123c35af152db52d33526ff8c 100755 (executable)
@@ -23,20 +23,20 @@ if [ ! -d "$FTP_DIR/$1" ]; then
        exit
 fi
 
-# we set $tree and $files
+# we set $tree and $pkglist
 tree=$1
-files=""
+pkglist=""
 
 waserror=0
 shift 1
 while test "$#" -gt "0"
 do
-       file=`echo $1|sed -e 's,.src.rpm$,,'`
-       if [ ! -f "$FTP_DIR/$tree/SRPMS/.metadata/$file.src.rpm.info" ]; then
+       pkg=`echo $1|sed -e 's,.src.rpm$,,'`
+       if [ ! -f "$FTP_DIR/$tree/SRPMS/.metadata/$pkg.src.rpm.info" ]; then
                waserror=$(($waserror+1))
-               echo "$file was not found in source tree"
+               echo "$pkg was not found in source tree"
        fi
-       files="$files $file"
+       pkglist="$pkglist $pkg"
        shift
 done
 
@@ -47,10 +47,10 @@ fi
 
 if [ "$REMOVEOLDER" == "yes" ]; then
        # Remove packages older than the ones we're removing
-       olderpkgs=`find_older_pkgs "$tree" "$files"`
+       olderpkgs=`find_older_pkgs "$tree" "$pkglist"`
        remove_pkgs "$tree" "$olderpkgs"
 fi
 
 # Remove given packages
-remove_pkgs "$tree" "$files"
+remove_pkgs "$tree" "$pkglist"
 
This page took 0.672503 seconds and 4 git commands to generate.