diff options
-rwxr-xr-x | py/mock.py | 7 | ||||
-rw-r--r-- | py/mock/backend.py | 14 |
2 files changed, 16 insertions, 5 deletions
@@ -171,10 +171,11 @@ def command_parse(config_opts): " before running command when using --chroot") parser.add_option("--spec", action="store", - help="Specifies spec file to use to build an SRPM (used only with --buildsrpm)") + help="Specifies spec file to use to build an SRPM (used only with --buildsrpm)") parser.add_option("--sources", action="store", - help="Specifies sources to use to build an SRPM (used only with --buildsrpm)") - + help="Specifies sources (either a single file or a directory of files)" + "to use to build an SRPM (used only with --buildsrpm)") + # verbosity parser.add_option("-v", "--verbose", action="store_const", const=2, dest="verbose", default=1, help="verbose build") diff --git a/py/mock/backend.py b/py/mock/backend.py index f22ac12..e35c6c7 100644 --- a/py/mock/backend.py +++ b/py/mock/backend.py @@ -542,8 +542,18 @@ class Root(object): # copy spec/sources shutil.copy(spec, self.makeChrootPath(self.builddir, "SPECS")) - os.rmdir(self.makeChrootPath(self.builddir, "SOURCES")) - shutil.copytree(sources, self.makeChrootPath(self.builddir, "SOURCES")) + + # Resolve any symlinks + sources = os.path.realpath(sources) + + if os.path.isdir(sources): + os.rmdir(self.makeChrootPath(self.builddir, "SOURCES")) + shutil.copytree(sources, self.makeChrootPath(self.builddir, "SOURCES")) + else: + shutil.copy(sources, self.makeChrootPath(self.builddir, "SOURCES")) + + spec = self.makeChrootPath(self.builddir, "SPECS", os.path.basename(spec)) + chrootspec = spec.replace(self.makeChrootPath(), '') # get rid of rootdir prefix spec = self.makeChrootPath(self.builddir, "SPECS", os.path.basename(spec)) chrootspec = spec.replace(self.makeChrootPath(), '') # get rid of rootdir prefix |