Kaydet (Commit) 1d1a0b27 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Merge branch 'patch-41837' into 'master'

GZ type inary files

See merge request sulinos/devel/inary!12
......@@ -733,6 +733,10 @@ class ArchiveZip(ArchiveBase):
if is_dir: # this is a directory
if not os.path.isdir(ofile):
os.makedirs(ofile)
perm = info.external_attr >> 16
if perm == 0:
perm = 33261 # octets of -rwxr-xr-x
os.chmod(ofile, perm)
continue
# check that output dir is present
......@@ -751,8 +755,12 @@ class ArchiveZip(ArchiveBase):
target = self.zip_obj.read(info.filename)
os.symlink(target, ofile)
else:
perm = info.external_attr >> 16
if perm==0:
perm=33261 # -rwxr-xr-x
info.filename = outpath
self.zip_obj.extract(info, target_dir)
os.chmod(ofile, perm)
def unpack_files(self, paths, target_dir):
self.unpack_file_cond(lambda f: f in paths, target_dir)
......
......@@ -128,8 +128,6 @@ class Command(object):
pass
def process_opts(self):
self.check_auth_info()
# make destdir absolute
if self.options.destdir:
d = str(self.options.destdir)
......@@ -138,32 +136,8 @@ class Command(object):
os.makedirs(d)
self.options.destdir = os.path.realpath(d)
def check_auth_info(self):
username = self.options.username
password = self.options.password
# TODO: We'll get the username, password pair from a configuration
# file from users home directory. Currently we need user to
# give it from the user interface.
# if not username and not password:
# if someauthconfig.username and someauthconfig.password:
# self.authInfo = (someauthconfig.username,
# someauthconfig.password)
# return
if username and password:
self.options.authinfo = (username, password)
return
if username and not password:
from getpass import getpass
password = getpass(_("Password: "))
self.options.authinfo = (username, password)
else:
self.options.authinfo = None
def init(self, database=True, write=True, locked=False):
"""initialize INARY components"""
if self.options:
ui = inary.cli.CLI(self.options.debug, self.options.verbose)
else:
......
......@@ -69,6 +69,8 @@ class Constants(metaclass=Singleton):
self.__c.lzma_suffix = ".lzma"
# suffix for xz
self.__c.xz_suffix = ".xz"
# suffix for gz
self.__c.gz_suffix = ".gz"
self.__c.partial_suffix = ".part"
self.__c.temporary_suffix = ".tmp"
......
......@@ -1208,13 +1208,15 @@ package might be a good solution."))
orgname = util.join_path("debug", finfo.path)
pkg.add_to_install(orgname, finfo.path)
if self.target_package_format == "1.2":
if self.target_package_format == "1.3":
archive_format = ".tar.gz"
elif self.target_package_format == "1.2":
archive_format = ".tar.xz"
elif self.target_package_format == "1.1":
archive_format = ".tar.lzma"
else:
# "1.0" format does not have an archive
archive_format = ""
archive_format = ".tar"
self.metadata.package.installTarHash = util.sha1_file(
"{0}/install{1}".format(self.pkg_dir(), archive_format))
......
......@@ -40,21 +40,24 @@ class Package:
"""INARY Package Class provides access to a inary package (.inary
file)."""
formats = ("1.0", "1.1", "1.2")
formats = ("1.0", "1.1", "1.2", "1.3")
default_format = "1.2"
timestamp = None
@staticmethod
def archive_name_and_format(package_format):
if package_format == "1.2":
if package_format == "1.3":
archive_format = "targz"
archive_suffix = ctx.const.gz_suffix
elif package_format == "1.2":
archive_format = "tarxz"
archive_suffix = ctx.const.xz_suffix
elif package_format == "1.1":
archive_format = "tarlzma"
archive_suffix = ctx.const.lzma_suffix
else:
# "1.0" format does not have an archive
return None, None
archive_format = "tar"
archive_suffix = ""
archive_name = ctx.const.install_tar + archive_suffix
return archive_name, archive_format
......@@ -121,11 +124,6 @@ class Package:
if arcname is None:
arcname = name
if self.format == "1.0":
arcname = util.join_path("install", arcname)
self.add_to_package(name, arcname)
return
if self.install_archive is None:
archive_name, archive_format = \
self.archive_name_and_format(self.format)
......
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