extras-buildsys/utils extras-push-new,1.30,1.31

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Sat Jun 10 19:36:58 UTC 2006


Author: mschwendt

Update of /cvs/fedora/extras-buildsys/utils
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6937

Modified Files:
	extras-push-new 
Log Message:
- bring back Ville's hardlink code from r1.24 to r1.25
- rename "rpmloc" to "destloc" and "prevloc" to "linkloc",
so now we have:
  srcloc: signed rpm source path, which to copy/move/link
  destloc: destination rpm path in repository
  linkloc: rpm path in repository which serves as link source



Index: extras-push-new
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-push-new,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- extras-push-new	9 Jun 2006 10:21:01 -0000	1.30
+++ extras-push-new	10 Jun 2006 19:36:56 -0000	1.31
@@ -61,6 +61,7 @@
     mail = True
     doublesync = False
     force = False
+    hardlink = False
 
 alldists = [ '5', '4', '3', 'development' ] # also the order in build reports
 
@@ -279,6 +280,16 @@
         shutil.move(src,dest)
 
 
+def debuglink(src,dest):
+    """os.link a file, but don't overwrite destination"""
+    if os.path.exists(dest):
+        debugprint('WARNING: %s already exists, ignoring new one' % dest)
+        return
+    debugprint('Linking %s to %s' % (src,dest))
+    if not DEBUG:
+        os.link(src,dest)
+
+
 # get the path to where to look for the packages to be signed
 # get the list of stuff there (logs, md5sums, specs, rpms)
 # list the rpms
@@ -469,8 +480,8 @@
         (n,a,e,v,r) = naevr(package)
         infolist.append('%s-%s-%s' % (n,v,r))
         pkg_fn = os.path.basename(package)
-        srpmloc = os.path.join(destdir, 'SRPMS', pkg_fn)
-        debugmove(signtmpdir+package,srpmloc)
+        destloc = os.path.join(destdir, 'SRPMS', pkg_fn)
+        debugmove(signtmpdir+package,destloc)
 
     # go through each package and move it to the right arch location
     # if it is a noarch package, copy2 it to all arch locations
@@ -478,25 +489,28 @@
     # if it is a debuginfo package, move it into the 'debug' dir for that arch
 
     for package in files['rpm'] + files['debuginfo']:
+        # relocated path of signed rpm - always use this for copy2/move/link!
+        srcloc = signtmpdir+package
+        
         pkg_fn = os.path.basename(package)
         (n,a,e,v,r) = naevr(package)
 
-        copyarchs = copydict.get('%s.%s' % (n, a))
-        if copyarchs:
-            for arch in copyarchs:
-                if not arch in archdict[dist]:
-                    continue
-                if package in files['debuginfo']:
-                    arch = '%s/debug' % arch
-                rpmloc = os.path.join(destdir, arch, pkg_fn)
-                debugcopy2(signtmpdir+package,rpmloc)
-
         if a == 'noarch':
+            linkloc = None
             for arch in archdict[dist]:
                 if package in files['debuginfo']:
                     arch = '%s/debug' % arch
-                rpmloc = os.path.join(destdir, arch, pkg_fn)
-                debugcopy2(signtmpdir+package,rpmloc)
+                destloc = os.path.join(destdir, arch, pkg_fn)
+                linked = False
+                if opts.hardlink and linkloc:
+                    try:
+                        debuglink(linkloc,destloc)
+                        linked = True
+                    except OSError, e:
+                        print 'WARNING: Linking failed (%s), trying to copy...' % e
+                if not linked:
+                    debugcopy2(srcloc,destloc)
+                    linkloc = destloc
             continue
             
         elif a in ['i386', 'i486', 'i586', 'i686', 'athlon']:
@@ -521,8 +535,28 @@
             print 'Unknown arch %s' % a
             continue
 
-        rpmloc = os.path.join(destdir, arch, pkg_fn)
-        debugmove(signtmpdir+package,rpmloc)
+        destloc = os.path.join(destdir, arch, pkg_fn)
+        debugmove(srcloc,destloc)
+
+        # See whether we need to copy/link this rpm to other targets.
+        srcloc = destloc  # we copy/link inside destination tree
+        copyarchs = copydict.get('%s.%s' % (n, a))
+        if copyarchs:
+            for arch in copyarchs:
+                if not arch in archdict[dist]:
+                    continue
+                if package in files['debuginfo']:
+                    arch = '%s/debug' % arch
+                destloc = os.path.join(destdir, arch, pkg_fn)
+                linked = False
+                if opts.hardlink:
+                    try:
+                        debuglink(srcloc,destloc)
+                        linked = True
+                    except OSError, e:
+                        print 'WARNING: Linking failed (%s), trying to copy...' % e
+                if not linked:
+                    debugcopy2(srcloc,destloc)
 
     # Store list of new packages on disk, so it can be mailed later.
     for add in infolist:




More information about the fedora-extras-commits mailing list