self.create['release'],
self.create['name'])
self.create['name'] = self.create['release'] + '_' + self.create['name']
+ if self.create['pack_to'] is not None:
+ if '@NAME@' in self.create['pack_to']:
+ self.create['pack_to'] = self.create['pack_to'].replace('@NAME@', self.create['name'])
+ self.create['name'] = misc.strip_archive_suffix(self.create['pack_to'])
+ if self.create['name'] is None:
+ raise errors.CreatorError("Not supported archive file format: %s" % self.create['pack_to'])
if not self.create['logfile']:
self.create['logfile'] = os.path.join(self.create['destdir'],
self.create['releaselog'] = True
self.set_logfile()
+ elif self.create['pack_to'] is not None:
+ if '@NAME@' in self.create['pack_to']:
+ self.create['pack_to'] = self.create['pack_to'].replace('@NAME@', self.create['name'])
+ self.create['name'] = misc.strip_archive_suffix(self.create['pack_to'])
+ if self.create['name'] is None:
+ raise errors.CreatorError("Not supported archive file format: %s" % self.create['pack_to'])
+
msger.info("Retrieving repo metadata:")
ksrepos = kickstart.get_repos(ks,
self.create['extrarepos'],
self.destdir = os.path.abspath(os.path.expanduser(self.destdir))
if self.pack_to:
- if '@NAME@' in self.pack_to:
- self.pack_to = self.pack_to.replace('@NAME@', self.name)
(tar, ext) = os.path.splitext(self.pack_to)
if ext in (".gz", ".bz2", ".lzo", ".bz") and tar.endswith(".tar"):
ext = ".tar" + ext
xmlparse = cElementTree.parse
from mic import msger
+from mic.archive import get_archive_suffixes
from mic.utils.errors import CreatorError, SquashfsError
from mic.utils.fs_related import find_binary_path, makedirs
from mic.utils.grabber import myurlgrab
if not text.endswith(suffix):
return text
return text[:-len(suffix)]
+
+def strip_archive_suffix(filename):
+ for suffix in get_archive_suffixes():
+ if filename.endswith(suffix):
+ return filename[:-len(suffix)]
+ else:
+ msger.warning("Not supported archive file format: %s" % filename)
+ return None