fix revdep-rebuild error #11
This commit is contained in:
@@ -137,8 +137,9 @@ class Install(AtomicOperation):
|
|||||||
self.filesdb = pisi.db.filesdb.FilesDB()
|
self.filesdb = pisi.db.filesdb.FilesDB()
|
||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
self.operation = INSTALL
|
self.operation = INSTALL
|
||||||
|
self.store_old_paths = None
|
||||||
|
|
||||||
def install(self, ask_reinstall = True):
|
def install(self, ask_reinstall=True):
|
||||||
|
|
||||||
# Any package should remove the package it replaces before
|
# Any package should remove the package it replaces before
|
||||||
self.check_replaces()
|
self.check_replaces()
|
||||||
@@ -244,6 +245,10 @@ class Install(AtomicOperation):
|
|||||||
else:
|
else:
|
||||||
pkg_version = pisi.version.make_version(pkg.version)
|
pkg_version = pisi.version.make_version(pkg.version)
|
||||||
iversion = pisi.version.make_version(iversion_s)
|
iversion = pisi.version.make_version(iversion_s)
|
||||||
|
if ctx.get_option('store_lib_info') and pkg_version > iversion:
|
||||||
|
self.store_old_paths = os.path.join(ctx.config.old_paths_cache_dir(), pkg.name)
|
||||||
|
ctx.ui.info(_('Storing old paths info'))
|
||||||
|
open(self.store_old_paths, "w").write("Version: %s\n" % iversion_s)
|
||||||
|
|
||||||
pkg_release = int(pkg.release)
|
pkg_release = int(pkg.release)
|
||||||
irelease = int(irelease_s)
|
irelease = int(irelease_s)
|
||||||
@@ -274,7 +279,7 @@ class Install(AtomicOperation):
|
|||||||
self.old_files = self.installdb.get_files(pkg.name)
|
self.old_files = self.installdb.get_files(pkg.name)
|
||||||
self.old_pkginfo = self.installdb.get_info(pkg.name)
|
self.old_pkginfo = self.installdb.get_info(pkg.name)
|
||||||
self.old_path = self.installdb.pkg_dir(pkg.name, iversion_s, irelease_s)
|
self.old_path = self.installdb.pkg_dir(pkg.name, iversion_s, irelease_s)
|
||||||
self.remove_old = Remove(pkg.name)
|
self.remove_old = Remove(pkg.name, store_old_paths = self.store_old_paths)
|
||||||
self.remove_old.run_preremove()
|
self.remove_old.run_preremove()
|
||||||
self.remove_old.run_postremove()
|
self.remove_old.run_postremove()
|
||||||
|
|
||||||
@@ -446,7 +451,7 @@ class Install(AtomicOperation):
|
|||||||
if os.path.samestat(new_file_stat, old_file_stat):
|
if os.path.samestat(new_file_stat, old_file_stat):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
Remove.remove_file(old_file, self.pkginfo.name)
|
Remove.remove_file(old_file, self.pkginfo.name, store_old_paths=self.store_old_paths)
|
||||||
|
|
||||||
if self.reinstall():
|
if self.reinstall():
|
||||||
# get 'config' typed file objects
|
# get 'config' typed file objects
|
||||||
@@ -554,12 +559,13 @@ def install_single_name(name, upgrade = False):
|
|||||||
|
|
||||||
class Remove(AtomicOperation):
|
class Remove(AtomicOperation):
|
||||||
|
|
||||||
def __init__(self, package_name, ignore_dep = None):
|
def __init__(self, package_name, ignore_dep=None, store_old_paths=None):
|
||||||
super(Remove, self).__init__(ignore_dep)
|
super(Remove, self).__init__(ignore_dep)
|
||||||
self.installdb = pisi.db.installdb.InstallDB()
|
self.installdb = pisi.db.installdb.InstallDB()
|
||||||
self.filesdb = pisi.db.filesdb.FilesDB()
|
self.filesdb = pisi.db.filesdb.FilesDB()
|
||||||
self.package_name = package_name
|
self.package_name = package_name
|
||||||
self.package = self.installdb.get_package(self.package_name)
|
self.package = self.installdb.get_package(self.package_name)
|
||||||
|
self.store_old_paths = store_old_paths
|
||||||
try:
|
try:
|
||||||
self.files = self.installdb.get_files(self.package_name)
|
self.files = self.installdb.get_files(self.package_name)
|
||||||
except pisi.Error as e:
|
except pisi.Error as e:
|
||||||
@@ -599,7 +605,7 @@ class Remove(AtomicOperation):
|
|||||||
# is there any package who depends on this package?
|
# is there any package who depends on this package?
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def remove_file(fileinfo, package_name, remove_permanent=False):
|
def remove_file(fileinfo, package_name, remove_permanent=False, store_old_paths=None):
|
||||||
|
|
||||||
if fileinfo.permanent and not remove_permanent:
|
if fileinfo.permanent and not remove_permanent:
|
||||||
return
|
return
|
||||||
@@ -640,6 +646,8 @@ class Remove(AtomicOperation):
|
|||||||
else:
|
else:
|
||||||
if os.path.isfile(fpath) or os.path.islink(fpath):
|
if os.path.isfile(fpath) or os.path.islink(fpath):
|
||||||
os.unlink(fpath)
|
os.unlink(fpath)
|
||||||
|
if store_old_paths:
|
||||||
|
open(store_old_paths, "a").write("%s\n" % fpath)
|
||||||
elif os.path.isdir(fpath) and not os.listdir(fpath):
|
elif os.path.isdir(fpath) and not os.listdir(fpath):
|
||||||
os.rmdir(fpath)
|
os.rmdir(fpath)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ expanded to package names.
|
|||||||
help=_("When installing packages, ignore packages "
|
help=_("When installing packages, ignore packages "
|
||||||
"and components whose basenames match "
|
"and components whose basenames match "
|
||||||
"any pattern contained in file."))
|
"any pattern contained in file."))
|
||||||
|
group.add_option("-s", "--store-lib-info", action="store_true",
|
||||||
|
default=False,
|
||||||
|
help=_("Store previous libraries info when package is updating to newer version."))
|
||||||
self.parser.add_option_group(group)
|
self.parser.add_option_group(group)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|||||||
@@ -130,6 +130,9 @@ class Config(object, metaclass=pisi.util.Singleton):
|
|||||||
def debug_packages_dir(self):
|
def debug_packages_dir(self):
|
||||||
return self.subdir(self.values.dirs.debug_packages_dir)
|
return self.subdir(self.values.dirs.debug_packages_dir)
|
||||||
|
|
||||||
|
def old_paths_cache_dir(self):
|
||||||
|
return self.subdir(self.values.dirs.old_paths_cache_dir)
|
||||||
|
|
||||||
def index_dir(self):
|
def index_dir(self):
|
||||||
return self.subdir(self.values.dirs.index_dir)
|
return self.subdir(self.values.dirs.index_dir)
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ class DirectoriesDefaults:
|
|||||||
cached_packages_dir = "/var/cache/pisi/packages"
|
cached_packages_dir = "/var/cache/pisi/packages"
|
||||||
compiled_packages_dir = "/var/cache/pisi/packages"
|
compiled_packages_dir = "/var/cache/pisi/packages"
|
||||||
debug_packages_dir = "/var/cache/pisi/packages-debug"
|
debug_packages_dir = "/var/cache/pisi/packages-debug"
|
||||||
|
old_paths_cache_dir = "/var/cache/pisi/old-paths"
|
||||||
packages_dir = "/var/lib/pisi/package"
|
packages_dir = "/var/lib/pisi/package"
|
||||||
lock_dir = "/var/lock/subsys"
|
lock_dir = "/var/lock/subsys"
|
||||||
index_dir = "/var/lib/pisi/index"
|
index_dir = "/var/lib/pisi/index"
|
||||||
|
|||||||
+1
-1
@@ -149,7 +149,7 @@ class RepoDB(lazydb.LazyDB):
|
|||||||
def has_repo(self, name):
|
def has_repo(self, name):
|
||||||
return name in self.list_repos(only_active=False)
|
return name in self.list_repos(only_active=False)
|
||||||
|
|
||||||
def has_repo_url(self, url, only_active = True):
|
def has_repo_url(self, url, only_active=True):
|
||||||
return url in self.list_repo_urls(only_active)
|
return url in self.list_repo_urls(only_active)
|
||||||
|
|
||||||
def get_repo_doc(self, repo_name):
|
def get_repo_doc(self, repo_name):
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# Author: Marcin Bojara <marcin@pisilinux.org>
|
# Author: Marcin Bojara <marcin@pisilinux.org>
|
||||||
@@ -94,7 +94,7 @@ if __name__ == "__main__":
|
|||||||
ver = f.readline().split(":").pop().strip()
|
ver = f.readline().split(":").pop().strip()
|
||||||
paths = [l.strip() for l in f.readlines()]
|
paths = [l.strip() for l in f.readlines()]
|
||||||
oldpkgfs["%s-%s (previous)" % (ls, ver)] = paths
|
oldpkgfs["%s-%s (previous)" % (ls, ver)] = paths
|
||||||
except AttributeError:
|
except AttributeError as e:
|
||||||
print("%sYour pisi version is too old.%s" % (GR, NO))
|
print("%sYour pisi version is too old.%s" % (GR, NO))
|
||||||
|
|
||||||
print(" done.")
|
print(" done.")
|
||||||
@@ -116,7 +116,7 @@ if __name__ == "__main__":
|
|||||||
soname_search = args
|
soname_search = args
|
||||||
sonames = " ".join(soname_search)
|
sonames = " ".join(soname_search)
|
||||||
m = hashlib.md5()
|
m = hashlib.md5()
|
||||||
m.update(sonames)
|
m.update(sonames.encode())
|
||||||
llist = LIST + "_" + m.hexdigest()[:8]
|
llist = LIST + "_" + m.hexdigest()[:8]
|
||||||
head_text = "using given shared object(s) name"
|
head_text = "using given shared object(s) name"
|
||||||
ok_text = "There are no dynamic links to %s" % sonames
|
ok_text = "There are no dynamic links to %s" % sonames
|
||||||
@@ -180,7 +180,7 @@ if __name__ == "__main__":
|
|||||||
continue
|
continue
|
||||||
p = subprocess.Popen('LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd %s' % f, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen('LD_LIBRARY_PATH="$COMPLETE_LD_LIBRARY_PATH" ldd %s' % f, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
for line in out.split("\n"):
|
for line in out.decode().split("\n"):
|
||||||
if "=>" in line:
|
if "=>" in line:
|
||||||
src, dst = line.split("=>")
|
src, dst = line.split("=>")
|
||||||
src = src.strip()
|
src = src.strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user