mirror of
https://abf.rosa.ru/djam/urpm-tools.git
synced 2025-02-23 17:32:46 +00:00
Fixed bug #1030
This commit is contained in:
parent
100c5779ba
commit
e2d490a1f9
2 changed files with 76 additions and 31 deletions
|
@ -216,9 +216,51 @@ def resolve_dep_while_emulation(requirement, package):
|
|||
to_append_bysource[package].append(pkgs[0])
|
||||
|
||||
def emulate_install(pkg):
|
||||
''' Reurns True if something was done, False - if package was not installed '''
|
||||
global actions, not_provided_packages, conflicting_packages
|
||||
vprint('Emulating package installation: ' + pkg)
|
||||
|
||||
conflicts = False
|
||||
for confl in repository.packages[pkg]['conflicts']:
|
||||
res = installed.whatprovides(confl)
|
||||
for item in res[:]:
|
||||
if item in to_remove_pre:
|
||||
res.remove(item)
|
||||
if res:
|
||||
conflicts = True
|
||||
conflicting_packages.append( (pkg, res) )
|
||||
vprint("New conflict: %s, %s" % (str(pkg), str(res)))
|
||||
|
||||
|
||||
for prov in repository.packages[pkg]['provides']:
|
||||
res = installed.whatconflicts(prov)
|
||||
for item in res[:]:
|
||||
if item in to_remove_pre:
|
||||
res.remove(item)
|
||||
if res:
|
||||
conflicts = True
|
||||
conflicting_packages.append( (res, pkg) )
|
||||
vprint("New conflict: %s, %s" % (str(res), str(pkg)))
|
||||
|
||||
if conflicts:
|
||||
return False
|
||||
|
||||
# remove the previosly added conflicts for this package
|
||||
|
||||
for item in conflicting_packages[:]:
|
||||
pkg1, pkgs2 = item
|
||||
|
||||
if pkg1 == pkg:
|
||||
conflicting_packages.remove(item)
|
||||
vprint("Conflict %s have been resolved" % str(item))
|
||||
if pkg in pkgs2:
|
||||
pkgs2.remove(pkg)
|
||||
if not pkgs2:
|
||||
conflicting_packages.remove(item)
|
||||
vprint("Conflict %s have been resolved" % str((pkg1, pkg)))
|
||||
|
||||
|
||||
|
||||
emptied = []
|
||||
for p in not_provided_packages:
|
||||
for req in not_provided_packages[p][:]:
|
||||
|
@ -235,24 +277,6 @@ def emulate_install(pkg):
|
|||
|
||||
|
||||
|
||||
conflicts = False
|
||||
for confl in repository.packages[pkg]['conflicts']:
|
||||
res = installed.whatprovides(confl)
|
||||
if res:
|
||||
conflicts = True
|
||||
conflicting_packages.append( (pkg, res) )
|
||||
vprint("New conflict: %s, %s" % (str(pkg), str(res)))
|
||||
|
||||
|
||||
for prov in repository.packages[pkg]['provides']:
|
||||
res = installed.whatconflicts(prov)
|
||||
if res:
|
||||
conflicts = True
|
||||
conflicting_packages.append( (res, pkg) )
|
||||
vprint("New conflict: %s, %s" % (str(res), str(pkg)))
|
||||
|
||||
if conflicts:
|
||||
return
|
||||
|
||||
url = ms.media[repository.packages[pkg]['medium']]
|
||||
url += '/' + repository.packages[pkg]['filename'] + '.rpm'
|
||||
|
@ -286,12 +310,16 @@ def emulate_install(pkg):
|
|||
|
||||
resolve_dep_while_emulation(req, pkg)
|
||||
|
||||
return True
|
||||
|
||||
def emulate_remove(pkg, updating=False):
|
||||
''' Reurns True if something was done, False - if package was not removed '''
|
||||
global not_provided_packages
|
||||
vprint("Emulating package removing: " + pkg)
|
||||
if pkg not in installed.packages:
|
||||
|
||||
if pkg not in installed.packages or 'nevr' not in installed.packages[pkg]:
|
||||
vprint("Nothing to remove")
|
||||
return
|
||||
return False
|
||||
|
||||
if pkg in not_provided_packages:
|
||||
not_provided_packages.pop(pkg)
|
||||
|
@ -306,7 +334,7 @@ def emulate_remove(pkg, updating=False):
|
|||
installed.packages[pkg]['old_package'] = P
|
||||
|
||||
if not actions: #do nothing while initial packages removing
|
||||
return
|
||||
return True
|
||||
|
||||
for dep in installed.packages[pkg]['old_package']['provides']:
|
||||
if dep.N not in installed.what['requires']:
|
||||
|
@ -320,16 +348,32 @@ def emulate_remove(pkg, updating=False):
|
|||
not_provided_packages[package].append(requirement)
|
||||
|
||||
resolve_dep_while_emulation(requirement, package)
|
||||
return True
|
||||
|
||||
|
||||
def have_to_be_removed(pkg):
|
||||
to_remove_problems[pkg] = []
|
||||
for dep in installed.packages[pkg]['requires']:
|
||||
res = installed.whatprovides(dep)
|
||||
if not res:
|
||||
|
||||
act_resolved = False
|
||||
for act_pkg in actions:
|
||||
for atc_dep in repository.packages[act_pkg]['provides']:
|
||||
if atc_dep.satisfies(dep):
|
||||
act_resolved = True
|
||||
break
|
||||
if act_resolved:
|
||||
break
|
||||
|
||||
if not res and not act_resolved:
|
||||
to_remove_problems[pkg].append(_("\tRequires %s, which will not be installed.") % (str(dep) ))
|
||||
continue
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for dep in installed.packages[pkg]['provides']:
|
||||
res = installed.whatconflicts(dep)
|
||||
if res:
|
||||
|
@ -372,8 +416,9 @@ def process_packages():
|
|||
if problems[act]:
|
||||
vprint ("\nPROBLEM: %s: %s" % (act, problems[act]))
|
||||
if not problems[act]:
|
||||
emulate_remove(act, updating=True)
|
||||
emulate_install(act)
|
||||
removed = emulate_remove(act, updating=True)
|
||||
installed = emulate_install(act)
|
||||
if removed or installed:
|
||||
changed = True
|
||||
for pr in problems:
|
||||
if len(problems[pr])>0:
|
||||
|
@ -471,7 +516,7 @@ def install_packages():
|
|||
ts = rpm.TransactionSet()
|
||||
|
||||
# turn all the checks off. They can cause segfault in RPM for now.
|
||||
ts.setVSFlags(rpm.RPMVSF_NOHDRCHK|rpm.RPMVSF_NOSHA1HEADER|rpm.RPMVSF_NODSAHEADER|rpm.RPMVSF_NORSAHEADER|rpm.RPMVSF_NOMD5|rpm.RPMVSF_NODSA|rpm.RPMVSF_NORSA|rpm._RPMVSF_NODIGESTS|rpm._RPMVSF_NOSIGNATURES)
|
||||
ts.setVSFlags(rpm.RPMVSF_NOHDRCHK|rpm.RPMVSF_NOSHA1HEADER|rpm.RPMVSF_NODSAHEADER|rpm.RPMVSF_NORSAHEADER|rpm.RPMVSF_NOMD5|rpm.RPMVSF_NODSA|rpm.RPMVSF_NORSA)
|
||||
ts.setProbFilter(rpm.RPMPROB_FILTER_OLDPACKAGE)
|
||||
|
||||
#flags for ts.run execution. We need it to speed the process up
|
||||
|
@ -726,7 +771,7 @@ def Main():
|
|||
|
||||
repository = PackageSet()
|
||||
repository.load_from_repository(ms)
|
||||
exit()
|
||||
|
||||
installed_backup = copy.deepcopy(installed)
|
||||
not_provided_packages = {}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Name: urpm-tools
|
||||
Version: 2.2
|
||||
Release: 1
|
||||
Version: 2.2.1
|
||||
Release: 0
|
||||
Summary: Utilities that help to work with URPM-based repositories
|
||||
Group: System/Configuration/Packaging
|
||||
License: GPLv2
|
||||
|
|
Loading…
Add table
Reference in a new issue