xdelta güle güle, silinen hedelerden ortaya çıkan bir sorun bulamadım (tüm testleri geçiyor, paket kaynak kodu çekiyor, index güncelliyor, ikili depodan paket alıyor.)
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#[general]
|
||||
#destinationdirectory = /
|
||||
#autoclean = False
|
||||
#xdelta = False
|
||||
#
|
||||
#[build]
|
||||
#host = i686-pc-linux-gnu
|
||||
@@ -59,7 +58,6 @@ class GeneralDefaults:
|
||||
"""Default values for [general] section"""
|
||||
destinationdirectory = "/"
|
||||
autoclean = False
|
||||
xdelta = False
|
||||
distribution = "Pardus"
|
||||
distribution_release = "1.1"
|
||||
http_proxy = os.getenv("HTTP_PROXY") or None
|
||||
|
||||
@@ -47,7 +47,6 @@ class Constants:
|
||||
def __init__(self):
|
||||
# suffix for package names
|
||||
self.__c.package_suffix = ".pisi"
|
||||
self.__c.xdelta_suffix = ".xdelta"
|
||||
|
||||
# suffix for lzma
|
||||
self.__c.lzma_suffix = ".lzma"
|
||||
|
||||
+1
-39
@@ -41,48 +41,10 @@ class Package:
|
||||
url = URI(packagefn)
|
||||
|
||||
if url.is_remote_file():
|
||||
from fetcher import fetch_url, FetchError
|
||||
from fetcher import fetch_url
|
||||
dest = ctx.config.packages_dir()
|
||||
self.filepath = join(dest, url.filename())
|
||||
|
||||
# get current package name without version info (like tasma)
|
||||
current_pkg = util.pure_package_name(url.filename())
|
||||
|
||||
# if package is installed (which means we are upgrading it),
|
||||
# calculate needed info
|
||||
if ctx.installdb.is_installed(current_pkg) and ctx.config.values.general.xdelta:
|
||||
installed = True
|
||||
|
||||
# calculate currently installed package's name and pisi file's location
|
||||
(version, release, build) = ctx.installdb.get_version(current_pkg)
|
||||
current = util.package_name(current_pkg, version, release, build, prependSuffix=False)
|
||||
current_fn = join(dest, current) + ctx.const.package_suffix
|
||||
|
||||
# calculate xdelta file location (format: oldpackage_newpackage.xdelta)
|
||||
# ex: tasma-1.0.2-4-1_tasma-1.0.3-5-2.xdelta
|
||||
delta = basename(url.filename()).rstrip(ctx.const.package_suffix)
|
||||
delta = "%s_%s" % (current, delta) + ctx.const.xdelta_suffix
|
||||
|
||||
# create xdelta_url for fetching
|
||||
xdelta_url = URI(join(dirname(str(url)), delta))
|
||||
xdelta_fn = join(dest, xdelta_url.filename())
|
||||
else:
|
||||
installed = False
|
||||
|
||||
if installed and exists(current_fn) and ctx.config.values.general.xdelta:
|
||||
# if package is installed and old pisi file exists, fetch xdelta
|
||||
if not exists(xdelta_fn):
|
||||
ctx.ui.info(_("Trying to fetch xdelta: %s") % xdelta_url)
|
||||
try:
|
||||
fetch_url(xdelta_url, dest, ctx.ui.Progress)
|
||||
except FetchError,e:
|
||||
ctx.ui.warning(_('XDelta %s: not exists') % xdelta_url)
|
||||
else:
|
||||
# generate new one using old pisi file and xdelta
|
||||
util.generate_pisi_file(xdelta_fn, current_fn, self.filepath)
|
||||
else:
|
||||
util.generate_pisi_file(xdelta_fn, current_fn, self.filepath)
|
||||
|
||||
# FIXME: exists is not enough, also sha1sum check needed
|
||||
# when implemented in pisi-index.xml
|
||||
if not exists(self.filepath):
|
||||
|
||||
@@ -642,15 +642,6 @@ def env_update():
|
||||
|
||||
pisi.environment.update_environment(ctx.config.dest_dir())
|
||||
|
||||
def pure_package_name(package_name):
|
||||
"return pure package name from given string"
|
||||
"ex: package_name=tasma-1.0.3-5-2.pisi, returns tasma"
|
||||
|
||||
if package_name.endswith(ctx.const.package_suffix):
|
||||
package_name = package_name.rstrip(ctx.const.package_suffix)
|
||||
|
||||
return parse_package_name(package_name)[0]
|
||||
|
||||
def parse_package_name(package_name):
|
||||
"return package name and version string"
|
||||
"ex: package_name=tasma-1.0.3-5-2, returns (tasma, 1.0.3-5-2)"
|
||||
@@ -666,8 +657,3 @@ def parse_package_name(package_name):
|
||||
version = package_name[len(name) + 1:]
|
||||
|
||||
return (name, version)
|
||||
|
||||
def generate_pisi_file(patchFile, fromFile, toFile):
|
||||
if run_batch("xdelta patch %s %s %s" % (patchFile, fromFile, toFile))[0]:
|
||||
raise Error(_("ERROR: xdelta patch %s %s %s failed") % (patchFile, fromFile, toFile))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user