Move the _link function to the __init__ of pypungi to be used by both gather and pungi.
Attempt to hardlink release note files instead of copy them. (helps preserve timestamps)
This commit is contained in:
parent
ab3bcf6194
commit
47b32e3c2d
@ -1,3 +1,6 @@
|
|||||||
|
* Wed Nov 07 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
|
- Preserve timestamps on release note files
|
||||||
|
|
||||||
* Mon Oct 29 2007 Jesse Keating <jkeating@redhat.com>
|
* Mon Oct 29 2007 Jesse Keating <jkeating@redhat.com>
|
||||||
- Check to see if the cached package is same size or larger and if so remove
|
- Check to see if the cached package is same size or larger and if so remove
|
||||||
it. Otherwise regets will freak out.
|
it. Otherwise regets will freak out.
|
||||||
|
@ -68,3 +68,14 @@ def _doRunCommand(command, logger, rundir='/tmp', output=subprocess.PIPE, error=
|
|||||||
logger.error(err)
|
logger.error(err)
|
||||||
raise OSError, "Got an error from %s: %s" % (command[0], err)
|
raise OSError, "Got an error from %s: %s" % (command[0], err)
|
||||||
|
|
||||||
|
def _link(local, target):
|
||||||
|
try:
|
||||||
|
os.link(local, target)
|
||||||
|
except OSError, e:
|
||||||
|
if e.errno != 18: # EXDEV
|
||||||
|
self.logger.error('Got an error linking from cache: %s' % e)
|
||||||
|
raise OSError, e
|
||||||
|
|
||||||
|
# Can't hardlink cross file systems
|
||||||
|
shutil.copy2(local, target)
|
||||||
|
|
||||||
|
@ -293,17 +293,6 @@ class Gather(pypungi.PungiBase):
|
|||||||
if not srpm in self.srpmlist:
|
if not srpm in self.srpmlist:
|
||||||
self.srpmlist.append(srpm)
|
self.srpmlist.append(srpm)
|
||||||
|
|
||||||
def _link(self, local, target):
|
|
||||||
try:
|
|
||||||
os.link(local, target)
|
|
||||||
except OSError, e:
|
|
||||||
if e.errno != 18: # EXDEV
|
|
||||||
self.logger.error('Got an error linking from cache: %s' % e)
|
|
||||||
raise OSError, e
|
|
||||||
|
|
||||||
# Can't hardlink cross file systems
|
|
||||||
shutil.copy2(local, target)
|
|
||||||
|
|
||||||
def _downloadPackageList(self, polist, relpkgdir):
|
def _downloadPackageList(self, polist, relpkgdir):
|
||||||
"""Cycle through the list of package objects and
|
"""Cycle through the list of package objects and
|
||||||
download them from their respective repos."""
|
download them from their respective repos."""
|
||||||
@ -337,7 +326,7 @@ class Gather(pypungi.PungiBase):
|
|||||||
self.logger.debug("%s already exists and appears to be complete" % local)
|
self.logger.debug("%s already exists and appears to be complete" % local)
|
||||||
if os.path.exists(target):
|
if os.path.exists(target):
|
||||||
os.remove(target) # avoid traceback after interrupted download
|
os.remove(target) # avoid traceback after interrupted download
|
||||||
self._link(local, target)
|
pypungi._link(local, target)
|
||||||
continue
|
continue
|
||||||
elif os.path.exists(local):
|
elif os.path.exists(local):
|
||||||
# Check to see if the file on disk is bigger, and if so, remove it
|
# Check to see if the file on disk is bigger, and if so, remove it
|
||||||
@ -355,7 +344,7 @@ class Gather(pypungi.PungiBase):
|
|||||||
if not os.path.exists(local) or not os.path.samefile(path, local):
|
if not os.path.exists(local) or not os.path.samefile(path, local):
|
||||||
shutil.copy2(path, local)
|
shutil.copy2(path, local)
|
||||||
|
|
||||||
self._link(local, target)
|
pypungi._link(local, target)
|
||||||
|
|
||||||
self.logger.info('Finished downloading packages.')
|
self.logger.info('Finished downloading packages.')
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ class Pungi(pypungi.PungiBase):
|
|||||||
for filename in filelist:
|
for filename in filelist:
|
||||||
for regex in fileres:
|
for regex in fileres:
|
||||||
if regex.match(filename) and not os.path.exists(os.path.join(self.topdir, filename)):
|
if regex.match(filename) and not os.path.exists(os.path.join(self.topdir, filename)):
|
||||||
self.logger.info("Copying release note file %s" % filename)
|
self.logger.info("Linking release note file %s" % filename)
|
||||||
shutil.copy(os.path.join(dirpath, filename), os.path.join(self.topdir, filename))
|
pypungi._link(os.path.join(dirpath, filename), os.path.join(self.topdir, filename))
|
||||||
self.common_files.append(filename)
|
self.common_files.append(filename)
|
||||||
|
|
||||||
# Walk the tree for our dirs
|
# Walk the tree for our dirs
|
||||||
|
Loading…
Reference in New Issue
Block a user