avoid duplicate hard linking
This commit is contained in:
parent
a7bff7c7fe
commit
d133806c84
2 changed files with 16 additions and 4 deletions
|
|
@ -5185,7 +5185,12 @@ enabled=1
|
|||
bnplet = bnp[0].lower()
|
||||
pkgwriter.write(bnplet + '/' + bnp + '\n')
|
||||
koji.ensuredir(os.path.join(self.repodir, bnplet))
|
||||
os.symlink(ml_pkg, os.path.join(self.repodir, bnplet, bnp))
|
||||
dst = os.path.join(self.repodir, bnplet, bnp)
|
||||
if os.path.exists(dst):
|
||||
self.logger.warning("Path exists: %r", dst)
|
||||
continue
|
||||
self.logger.debug("os.symlink(%r, %r)", ml_pkg, dst)
|
||||
os.symlink(ml_pkg, dst)
|
||||
self.keypaths[bnp] = ml_pkg
|
||||
|
||||
|
||||
|
|
@ -5240,7 +5245,9 @@ enabled=1
|
|||
pkglist.write(bnplet + '/' + bnp + '\n')
|
||||
koji.ensuredir(os.path.join(self.repodir, bnplet))
|
||||
self.keypaths[bnp] = pkgpath
|
||||
os.symlink(pkgpath, os.path.join(self.repodir, bnplet, bnp))
|
||||
dst = os.path.join(self.repodir, bnplet, bnp)
|
||||
self.logger.debug("os.symlink(%r, %r(", pkgpath, dst)
|
||||
os.symlink(pkgpath, dst)
|
||||
pkglist.close()
|
||||
if len(fs_missing) > 0:
|
||||
raise koji.GenericError('Packages missing from the filesystem:\n' +
|
||||
|
|
|
|||
|
|
@ -12351,14 +12351,19 @@ class HostExports(object):
|
|||
bnp = os.path.basename(rpmpath)
|
||||
bnplet = bnp[0].lower()
|
||||
koji.ensuredir(os.path.join(archdir, bnplet))
|
||||
l_dst = os.path.join(archdir, bnplet, bnp)
|
||||
if os.path.exists(l_dst):
|
||||
logger.warning("Path exists: %s", l_dst)
|
||||
continue
|
||||
logger.debug("os.link(%r, %r)", rpmpath, l_dst)
|
||||
try:
|
||||
os.link(rpmpath, os.path.join(archdir, bnplet, bnp))
|
||||
os.link(rpmpath, l_dst)
|
||||
except OSError, ose:
|
||||
if ose.errno == 18:
|
||||
shutil.copy2(
|
||||
rpmpath, os.path.join(archdir, bnplet, bnp))
|
||||
else:
|
||||
raise ose
|
||||
raise
|
||||
safer_move(src, dst)
|
||||
|
||||
def isEnabled(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue