[projects/pld-ftp-admin] Always overwrite files in dest tree with newly built ones

baggins baggins at pld-linux.org
Sat Oct 11 19:44:53 CEST 2014


commit 99b125ec911a59ff78d5e03acf5a48829ea16fc5
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat Oct 11 19:38:37 2014 +0200

    Always overwrite files in dest tree with newly built ones
    
    Always copy new files from incoming to dest tree,
    skipping them causes inconsistent builds and lost
    binary rpms when rebuilding files from last tags.
    
    Prime example are packages with kernel modules,
    if one is already present in test/ and something
    then a new build often results in missing files.

 bin/pfa-from-incoming | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/bin/pfa-from-incoming b/bin/pfa-from-incoming
index 7229d47..4b86b2b 100755
--- a/bin/pfa-from-incoming
+++ b/bin/pfa-from-incoming
@@ -187,8 +187,8 @@ for uploadinfo in findfiles(incoming_dir + 'SRPMS'):
         continue
 
     if ftptree.has_key(`pkg`):
-        ftpio.log("%s already present in %s; removing newer files" % (srpm, ftptree))
-        rm(incoming_dir + 'SRPMS/' + srpm)
+        ftpio.log("%s already present in %s; removing older files" % (srpm, ftptree))
+        rm(default_to + 'SRPMS/RPMS/' + srpm)
         f = open(default_to + 'SRPMS/.metadata/' + srpm+'.info', 'a')
         bid = pkg.build.keys()[0]
         build = pkg.build[bid]
@@ -196,12 +196,11 @@ for uploadinfo in findfiles(incoming_dir + 'SRPMS'):
                  % (bid, build.requester, bid, build.requester_email))
         f.close()
     else:
-        mv(incoming_dir + 'SRPMS/' + srpm, default_to + 'SRPMS/RPMS')
-
         f = open(default_to + 'SRPMS/.metadata/' + srpm + '.info', 'w')
         f.write(content)
         f.close()
 
+    mv(incoming_dir + 'SRPMS/' + srpm, default_to + 'SRPMS/RPMS')
     rm(incoming_dir + 'SRPMS/' + uploadinfo)
 
 for arch in ftp_archs:
@@ -229,16 +228,18 @@ for arch in ftp_archs:
         dstpkg = BasePkg(`srcpkg`, ftptree)
 
         if dstpkg.files.has_key(arch):
-            ftpio.log("files from %s for arch %s already present in %s; removing newer files" % (`srcpkg`, arch, ftptree))
-            for rpmfile in srcpkg.files['ARCH']:
+            ftpio.log("files from %s for arch %s already present in %s; removing older files" % (`srcpkg`, arch, ftptree))
+            for rpmfile in dstpkg.files[arch]:
+                if is_debuginfo(rpmfile):
+                    dstfile = default_to + arch + '/debuginfo'
+                else:
+                    dstfile = default_to + arch + '/RPMS'
                 try:
-                    rm(incoming_dir + arch + '/'+rpmfile)
+                    rm(dstfile + '/' + rpmfile)
                 except OSError, e:
-                    l = "Removing %s problem: %s" % (incoming_dir + arch + '/' + rpmfile, e)
+                    l = "Removing %s problem: %s" % (dstfile + '/' + rpmfile, e)
                     ftpio.log(l)
                     print l
-            rm(incoming_dir + arch + '/' + uploadinfo)
-            continue
 
         f = open(default_to + 'SRPMS/.metadata/' + srpm + '.info', 'a')
         for rpmfile in srcpkg.files['ARCH']:
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/99b125ec911a59ff78d5e03acf5a48829ea16fc5



More information about the pld-cvs-commit mailing list