]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blobdiff - bin/from-incoming.sh
- full noarch support (with error checking and reporting)
[projects/pld-ftp-admin.git] / bin / from-incoming.sh
index 72992937c4e77ea5cd5ab498ad3ca2890d427a3b..ec004d0f9d082b691d8ea32f1f56a5bc3f238c45 100755 (executable)
@@ -2,6 +2,48 @@
 
 . ~/pld-ftp-admin/scripts/functions
 
+move_noarch()
+{
+       rpmname="$1"
+       srcname="$2"
+       f_arch="$3"
+
+       # TODO: check if noarch differ and if so - mail the request sender or sth
+       alreadypresent=`grep "^file:noarch:$rpmname$" $FTP_DIR/$DEFAULT_TO/SRPMS/.metadata/$srcname.info`
+       if [ -n "$alreadypresent" ]; then
+               rpm -qlp $rpmname > ~/tmp/files.new
+               rpm -qRp $rpmname|sort|uniq > ~/tmp/reqs.new
+
+               noarchs_differ="no"
+               diff_file=~/tmp/noarchs_difference
+               echo -ne "" > $diff_file
+               if ! diff ~/tmp/{noarch-cache/$rpmname.filelist,files.new} >/dev/null; then
+                       noarchs_differ="yes"
+                       echo "_FILES_" >> $diff_file
+                       diff -u ~/tmp/{noarch-cache/$rpmname.filelist,files.new}>>$diff_file
+               fi
+
+               if ! diff ~/tmp/{noarch-cache/$rpmname.reqlist,reqs.new} >/dev/null; then
+                       noarchs_differ="yes"
+                       echo "_REQS_" >> $diff_file
+                       diff -u ~/tmp/{noarch-cache/$rpmname.reqlist,reqs.new} >> $diff_file
+               fi
+
+               if [ "$noarchs_differ" == "yes" ]; then
+                       send_noarch_msg $srcname $rpmname $diff_file
+               fi
+
+               rm $rpmname
+       else
+               rpm -qlp $rpmname > ~/tmp/noarch-cache/$rpmname.filelist
+               rpm -qRp $rpmname|sort|uniq > ~/tmp/noarch-cache/$rpmname.reqlist
+               chmod a+r $rpmname
+               mv $rpmname $FTP_DIR/$DEFAULT_TO/noarch/RPMS/
+               echo -e "file:noarch:$rpmname\ninfo:noarch_arch:$rpmname:$f_arch" >> \
+                               $FTP_DIR/$DEFAULT_TO/SRPMS/.metadata/$srcname.info
+       fi
+}
+
 move_arch()
 {
        f_arch="$1"     # arch
@@ -31,10 +73,16 @@ move_arch()
                if [ "$remove" == "yes" ]; then
                        rm $x
                else
-                       # Move the files
-                       chmod a+r $x
-                       mv $x $FTP_DIR/$DEFAULT_TO/$f_arch/RPMS/
-                       echo "file:$f_arch:$x" >> $FTP_DIR/$DEFAULT_TO/SRPMS/.metadata/$srcname.info
+                       if [ -n `echo $x|grep 'noarch.rpm$'` ]; then
+                               # Huston, we've got a noarch
+                               move_noarch $x $srcname $f_arch
+                       else
+                               # Move the files
+                               chmod a+r $x
+                               mv $x $FTP_DIR/$DEFAULT_TO/$f_arch/RPMS/
+                               echo "file:$f_arch:$x" >> \
+                                               $FTP_DIR/$DEFAULT_TO/SRPMS/.metadata/$srcname.info
+                       fi
                fi
        done
        
This page took 0.026069 seconds and 4 git commands to generate.