check for broken symlinks when using --force
This commit is contained in:
parent
c6f01468c3
commit
6703e700ba
@ -925,7 +925,11 @@ class Pungi(pypungi.PungiBase):
|
|||||||
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("Linking release note file %s" % filename)
|
self.logger.info("Linking release note file %s" % filename)
|
||||||
pypungi.util._link(os.path.join(dirpath, filename), os.path.join(self.topdir, filename), self.logger)
|
pypungi.util._link(os.path.join(dirpath, filename),
|
||||||
|
os.path.join(self.topdir, filename),
|
||||||
|
self.logger,
|
||||||
|
force=self.config.getboolean('pungi',
|
||||||
|
'force'))
|
||||||
self.common_files.append(filename)
|
self.common_files.append(filename)
|
||||||
|
|
||||||
# Walk the tree for our dirs
|
# Walk the tree for our dirs
|
||||||
|
@ -41,6 +41,11 @@ def _link(local, target, logger, force=False):
|
|||||||
if os.path.exists(target) and force:
|
if os.path.exists(target) and force:
|
||||||
os.remove(target)
|
os.remove(target)
|
||||||
|
|
||||||
|
#check for broken links
|
||||||
|
if force and os.path.islink(target):
|
||||||
|
if not os.path.exists(os.readlink(target)):
|
||||||
|
os.remove(target)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.link(local, target)
|
os.link(local, target)
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
|
Loading…
Reference in New Issue
Block a user