Kaydet (Commit) 76e1f27b authored tarafından Faik Uygur's avatar Faik Uygur

.lzma, install.tar, install.tar.lzma strings to constants.

üst 1442e9ec
...@@ -91,8 +91,9 @@ class ArchiveTar(ArchiveBase): ...@@ -91,8 +91,9 @@ class ArchiveTar(ArchiveBase):
rmode = 'r:bz2' rmode = 'r:bz2'
elif self.type == 'tarlzma': elif self.type == 'tarlzma':
rmode = 'r:' rmode = 'r:'
self.file_path = self.file_path.rstrip('.lzma') self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
ret, out, err = util.run_batch("lzma d %s %s" % (self.file_path + '.lzma', self.file_path)) ret, out, err = util.run_batch("lzma d %s %s" % (self.file_path + ctx.const.lzma_suffix,
self.file_path))
if ret != 0: if ret != 0:
#FIXME: see bug #2836 #FIXME: see bug #2836
raise LZMAError(out) raise LZMAError(out)
...@@ -103,7 +104,7 @@ class ArchiveTar(ArchiveBase): ...@@ -103,7 +104,7 @@ class ArchiveTar(ArchiveBase):
oldwd = os.getcwd() oldwd = os.getcwd()
os.chdir(target_dir) os.chdir(target_dir)
install_tar_path = util.join_path(ctx.config.tmp_dir(), "install.tar") install_tar_path = util.join_path(ctx.config.tmp_dir(), ctx.const.install_tar)
for tarinfo in self.tar: for tarinfo in self.tar:
# Installing packages (especially shared libraries) is a # Installing packages (especially shared libraries) is a
# bit tricky. You should also change the inode if you # bit tricky. You should also change the inode if you
...@@ -137,7 +138,7 @@ class ArchiveTar(ArchiveBase): ...@@ -137,7 +138,7 @@ class ArchiveTar(ArchiveBase):
wmode = 'w:bz2' wmode = 'w:bz2'
elif self.type == 'tarlzma': elif self.type == 'tarlzma':
wmode = 'w:' wmode = 'w:'
self.file_path = self.file_path.rstrip('.lzma') self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
else: else:
raise ArchiveError(_("Archive type not recognized")) raise ArchiveError(_("Archive type not recognized"))
self.tar = tarfile.open(self.file_path, wmode) self.tar = tarfile.open(self.file_path, wmode)
......
...@@ -814,17 +814,17 @@ class Builder: ...@@ -814,17 +814,17 @@ class Builder:
pkg.add_to_package(orgname, arcname) pkg.add_to_package(orgname, arcname)
pkg.close() pkg.close()
else: # default package format is 1.1, so make it fallback. else: # default package format is 1.1, so make it fallback.
ctx.build_leftover = join(self.pkg_dir(), "install.tar.lzma") ctx.build_leftover = join(self.pkg_dir(), ctx.const.install_tar_lzma)
tar = archive.ArchiveTar("install.tar.lzma", "tarlzma") tar = archive.ArchiveTar(ctx.const.install_tar_lzma, "tarlzma")
for finfo in files.list: for finfo in files.list:
orgname = arcname = join("install", finfo.path) orgname = arcname = join("install", finfo.path)
if package.debug_package: if package.debug_package:
orgname = join("debug", finfo.path) orgname = join("debug", finfo.path)
tar.add_to_archive(orgname, arcname.lstrip("install")) tar.add_to_archive(orgname, arcname.lstrip("install"))
tar.close() tar.close()
pkg.add_to_package("install.tar.lzma") pkg.add_to_package(ctx.const.install_tar_lzma)
pkg.close() pkg.close()
os.unlink("install.tar.lzma") os.unlink(ctx.const.install_tar_lzma)
ctx.build_leftover = None ctx.build_leftover = None
os.chdir(c) os.chdir(c)
......
...@@ -49,6 +49,9 @@ class Constants: ...@@ -49,6 +49,9 @@ class Constants:
self.__c.package_suffix = ".pisi" self.__c.package_suffix = ".pisi"
self.__c.xdelta_suffix = ".xdelta" self.__c.xdelta_suffix = ".xdelta"
# suffix for lzma
self.__c.lzma_suffix = ".lzma"
# suffix for auto generated debug packages # suffix for auto generated debug packages
self.__c.debug_name_suffix = "-debug" self.__c.debug_name_suffix = "-debug"
self.__c.debug_file_suffix = ".debug" self.__c.debug_file_suffix = ".debug"
...@@ -74,6 +77,8 @@ class Constants: ...@@ -74,6 +77,8 @@ class Constants:
self.__c.comar_dir = "comar" self.__c.comar_dir = "comar"
self.__c.files_xml = "files.xml" self.__c.files_xml = "files.xml"
self.__c.metadata_xml = "metadata.xml" self.__c.metadata_xml = "metadata.xml"
self.__c.install_tar = "install.tar"
self.__c.install_tar_lzma = "install.tar.lzma"
# functions in actions_file # functions in actions_file
self.__c.setup_func = "setup" self.__c.setup_func = "setup"
......
...@@ -118,9 +118,9 @@ class Package: ...@@ -118,9 +118,9 @@ class Package:
self.impl.unpack_dir(dir, outdir) self.impl.unpack_dir(dir, outdir)
def extract_install(self, outdir): def extract_install(self, outdir):
if self.impl.has_file('install.tar.lzma'): if self.impl.has_file(ctx.const.install_tar_lzma):
self.extract_file('install.tar.lzma', ctx.config.tmp_dir()) self.extract_file(ctx.const.install_tar_lzma, ctx.config.tmp_dir())
tar = archive.ArchiveTar(join(ctx.config.tmp_dir(), 'install.tar.lzma'), 'tarlzma') tar = archive.ArchiveTar(join(ctx.config.tmp_dir(), ctx.const.install_tar_lzma), 'tarlzma')
tar.unpack_dir(outdir) tar.unpack_dir(outdir)
else: else:
self.extract_dir_flat('install', outdir) self.extract_dir_flat('install', outdir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment