self.__pkgs_content = {}
self.creator = creator
self.repos = []
+ self.to_deselect = []
self.localpkgs = {}
self.repo_manager = None
self.repo_manager_options = None
return None
else:
raise CreatorError("Unable to find package: %s" % (pkg,))
-
- def deselectPackage(self, pkg):
- """Deselect package. Can be specified as name.arch or name*"""
-
- if not self.Z:
- self.__initialize_zypp()
-
- startx = pkg.startswith("*")
- endx = pkg.endswith("*")
- ispattern = startx or endx
- sp = pkg.rsplit(".", 2)
- for item in self.Z.pool():
- kind = "%s" % item.kind()
- if kind == "package":
- name = "%s" % item.name()
- if not ispattern:
- if len(sp) == 2:
- arch = "%s" % item.arch()
- if name == sp[0] and arch == sp[1]:
- if item.status().isToBeInstalled():
- item.status().resetTransact(zypp.ResStatus.USER)
- break
- else:
- if name == sp[0]:
- if item.status().isToBeInstalled():
- item.status().resetTransact(zypp.ResStatus.USER)
- break
+ def inDeselectPackages(self, name):
+ """check if specified pacakges are in the list of inDeselectPackages"""
+ for pkg in self.to_deselect:
+ startx = pkg.startswith("*")
+ endx = pkg.endswith("*")
+ ispattern = startx or endx
+ sp = pkg.rsplit(".", 2)
+ if not ispattern:
+ if len(sp) == 2:
+ arch = "%s" % item.arch()
+ if name == sp[0] and arch == sp[1]:
+ return True;
else:
- if startx and name.endswith(sp[0][1:]):
- if item.status().isToBeInstalled():
- item.status().resetTransact(zypp.ResStatus.USER)
+ if name == sp[0]:
+ return True;
+ else:
+ if startx and name.endswith(sp[0][1:]):
+ return True;
+ if endx and name.startswith(sp[0][:-1]):
+ return True;
+ return False;
- if endx and name.startswith(sp[0][:-1]):
- if item.status().isToBeInstalled():
- item.status().resetTransact(zypp.ResStatus.USER)
+ def deselectPackage(self, pkg):
+ """collect packages should not be installed"""
+ self.to_deselect.append(pkg)
def __selectIncpkgs(self):
found = False
installed_pkgs = todo._toInstall
dlpkgs = []
for item in installed_pkgs:
- if not zypp.isKindPattern(item):
+ if not zypp.isKindPattern(item) and not self.inDeselectPackages(item.name()):
dlpkgs.append(item)
# record the total size of installed pkgs