extras-buildsys/utils extras-push-new,1.24,1.25
Ville Skytta (scop)
fedora-extras-commits at redhat.com
Sun Jun 4 11:35:31 UTC 2006
Author: scop
Update of /cvs/fedora/extras-buildsys/utils
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26184
Modified Files:
extras-push-new
Log Message:
Add option to hardlink noarch/copydict packages instead of copying, default to off for now.
Index: extras-push-new
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-push-new,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- extras-push-new 2 Jun 2006 22:54:38 -0000 1.24
+++ extras-push-new 4 Jun 2006 11:35:28 -0000 1.25
@@ -59,6 +59,7 @@
mail = True
doublesync = False
force = False
+ hardlink = False
alldists = [ '5', '4', '3', 'development' ] # also the order in build reports
@@ -387,21 +388,8 @@
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)
- debugprint("Copying %s to %s" % (package, rpmloc))
- if os.path.exists(rpmloc):
- debugprint('%s already exists, ignoring new one' % rpmloc)
- elif not DEBUG:
- shutil.copy2(package, rpmloc)
-
if a == 'noarch':
+ prevloc = None
for arch in archdict[dist]:
if package in files['debuginfo']:
arch = '%s/debug' % arch
@@ -409,8 +397,20 @@
debugprint("Copying %s to %s" % (package, rpmloc))
if os.path.exists(rpmloc):
debugprint('%s already exists, ignoring new one' % rpmloc)
- elif not DEBUG:
- shutil.copy2(package, rpmloc)
+ else:
+ linked = False
+ if opts.hardlink and prevloc:
+ debugprint("Linking %s to %s" % (prevloc, rpmloc))
+ try:
+ if not DEBUG:
+ os.link(prevloc, rpmloc)
+ linked = True
+ except OSError, e:
+ print "WARNING: Linking %s to %s failed (%s), trying to copy %s instead" % (prevloc, rpmloc, e, package)
+ if not linked:
+ if not DEBUG:
+ shutil.copy2(package, rpmloc)
+ prevloc = rpmloc
if not DEBUG:
os.unlink(package)
@@ -447,6 +447,30 @@
elif not DEBUG:
shutil.move(package, rpmloc)
+ 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
+ copyloc = os.path.join(destdir, arch, pkg_fn)
+ debugprint("Copying %s to %s" % (rpmloc, copyloc))
+ if os.path.exists(copyloc):
+ debugprint('%s already exists, ignoring new one' % copyloc)
+ else:
+ linked = False
+ if opts.hardlink:
+ debugprint("Linking %s to %s" % (rpmloc, copyloc))
+ try:
+ if not DEBUG:
+ os.link(rpmloc, copyloc)
+ linked = True
+ except OSError, e:
+ print "WARNING: Linking %s to %s failed (%s), copying instead" % (rpmloc, copyloc, e)
+ if not linked and not DEBUG:
+ shutil.copy2(rpmloc, copyloc)
+
# Store list of move packages, so it can be mailed later.
for add in infolist:
add += '\n'
More information about the fedora-extras-commits
mailing list