def downloadPkgs(self, package_objects, count): localpkgs = self.localpkgs.keys() progress_obj = rpmmisc.TextProgress(count) for po in package_objects: if po.name() in localpkgs: continue filename = self.getLocalPkgPath(po) if os.path.exists(filename): if self.checkPkg(filename) == 0: continue dirn = os.path.dirname(filename) if not os.path.exists(dirn): os.makedirs(dirn) baseurl = str(po.repoInfo().baseUrls()[0]) index = baseurl.find("?") if index > -1: baseurl = baseurl[:index] proxy = self.get_proxy(po.repoInfo()) proxies = {} if proxy: proxies = {str(proxy.split(":")[0]): str(proxy)} location = zypp.asKindPackage(po).location() location = str(location.filename()) if location.startswith("./"): location = location[2:] url = baseurl + "/%s" % location try: filename = rpmmisc.myurlgrab(url, filename, proxies, progress_obj) except CreatorError: self.close() raise
def downloadPkgs(self, package_objects, count): localpkgs = list(self.localpkgs.keys()) progress_obj = rpmmisc.TextProgress(count) for po in package_objects: if po.name() in localpkgs: continue filename = self.getLocalPkgPath(po) if os.path.exists(filename): if self.checkPkg(filename, po.checksum()) == 0: continue dirn = os.path.dirname(filename) if not os.path.exists(dirn): os.makedirs(dirn) url = self.get_url(po) proxies = self.get_proxies(po) try: filename = rpmmisc.myurlgrab(url, filename, proxies, progress_obj) except CreatorError: self.close() raise
def downloadPkgs(self, package_objects, count): localpkgs = self.localpkgs.keys() progress_obj = rpmmisc.TextProgress(count) for po in package_objects: if po.name() in localpkgs: continue filename = self.getLocalPkgPath(po) if os.path.exists(filename): if self.checkPkg(filename) == 0: continue dirn = os.path.dirname(filename) if not os.path.exists(dirn): os.makedirs(dirn) baseurl = str(po.repoInfo().baseUrls()[0]) index = baseurl.find("?") if index > -1: baseurl = baseurl[:index] proxy = self.get_proxy(po.repoInfo()) proxies = {} if proxy: proxies = {str(proxy.split(":")[0]):str(proxy)} location = zypp.asKindPackage(po).location() location = str(location.filename()) if location.startswith("./"): location = location[2:] url = baseurl + "/%s" % location try: filename = rpmmisc.myurlgrab(url, filename, proxies, progress_obj) except CreatorError: self.close() raise
def downloadPkgs(self, package_objects, count): localpkgs = self.localpkgs.keys() progress_obj = rpmmisc.TextProgress(count) for po in package_objects: if po.name() in localpkgs: continue filename = self.getLocalPkgPath(po) if os.path.exists(filename): if self.checkPkg(filename) == 0: continue dirn = os.path.dirname(filename) if not os.path.exists(dirn): os.makedirs(dirn) url = self.get_url(po) proxies = self.get_proxies(po) try: filename = rpmmisc.myurlgrab(url, filename, proxies, progress_obj) except CreatorError: self.close() raise
def __attachment_packages(self, pkg_manager): if not self.ks: return self._attachment = [] for item in kickstart.get_attachment(self.ks): if item.startswith("/"): fpaths = os.path.join(self._instroot, item.lstrip("/")) for fpath in glob.glob(fpaths): self._attachment.append(fpath) continue filelist = pkg_manager.getFilelist(item) if filelist: # found rpm in rootfs for pfile in pkg_manager.getFilelist(item): fpath = os.path.join(self._instroot, pfile.lstrip("/")) self._attachment.append(fpath) continue # try to retrieve rpm file (url, proxies) = pkg_manager.package_url(item) if not url: msger.warning("Can't get url from repo for %s" % item) continue fpath = os.path.join(self.cachedir, os.path.basename(url)) if not os.path.exists(fpath): # download pkgs try: fpath = rpmmisc.myurlgrab(url, fpath, proxies, None) except CreatorError: raise tmpdir = self._mkdtemp() misc.extract_rpm(fpath, tmpdir) for (root, dirs, files) in os.walk(tmpdir): for fname in files: fpath = os.path.join(root, fname) self._attachment.append(fpath)
def __attachment_packages(self, pkg_manager): if not self.ks: return self._attachment = [] for item in kickstart.get_attachment(self.ks): if item.startswith('/'): fpaths = os.path.join(self._instroot, item.lstrip('/')) for fpath in glob.glob(fpaths): self._attachment.append(fpath) continue filelist = pkg_manager.getFilelist(item) if filelist: # found rpm in rootfs for pfile in pkg_manager.getFilelist(item): fpath = os.path.join(self._instroot, pfile.lstrip('/')) self._attachment.append(fpath) continue # try to retrieve rpm file (url, proxies) = pkg_manager.package_url(item) if not url: msger.warning("Can't get url from repo for %s" % item) continue fpath = os.path.join(self.cachedir, os.path.basename(url)) if not os.path.exists(fpath): # download pkgs try: fpath = rpmmisc.myurlgrab(url, fpath, proxies, None) except CreatorError: raise tmpdir = self._mkdtemp() misc.extract_rpm(fpath, tmpdir) for (root, dirs, files) in os.walk(tmpdir): for fname in files: fpath = os.path.join(root, fname) self._attachment.append(fpath)