From e8687a2a9841ccc3919c1871090992e1e2e2850b Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Tue, 15 Nov 2016 12:27:49 -0300 Subject: virt-install-1.4.0-2.parabola2: fix pops up error - Bug #1140 -> https://labs.parabola.nu/issues/1140 --- libre/virt-manager/PKGBUILD | 4 +- libre/virt-manager/libre.patch | 631 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 629 insertions(+), 6 deletions(-) diff --git a/libre/virt-manager/PKGBUILD b/libre/virt-manager/PKGBUILD index f0598dd04..1f0192181 100644 --- a/libre/virt-manager/PKGBUILD +++ b/libre/virt-manager/PKGBUILD @@ -7,7 +7,7 @@ pkgbase=virt-manager pkgname=virt-install pkgver=1.4.0 -pkgrel=2.parabola1 +pkgrel=2.parabola2 pkgdesc="Console user interface for managing virtual machines, without support for nonfree systems" arch=('any') url="http://virt-manager.org/" @@ -23,7 +23,7 @@ makedepends=('intltool>=0.35.0' source=("http://virt-manager.org/download/sources/virt-manager/virt-manager-$pkgver.tar.gz" 'libre.patch') md5sums=('3cb69f1d108ae6d16bab2fce7ec639ea' - '0b7eeb9879e33e11cee146a7cdc162b2') + '80eabf875d10704fb0e3881cc0b8d971') prepare() { cd "$srcdir/$pkgbase-$pkgver" diff --git a/libre/virt-manager/libre.patch b/libre/virt-manager/libre.patch index 524ad05f4..21f2ba5ef 100644 --- a/libre/virt-manager/libre.patch +++ b/libre/virt-manager/libre.patch @@ -40,7 +40,7 @@ index a1229c8..7177ab2 100644 Use the PXE boot protocol to load the initial ramdisk and kernel for starting diff --git a/virtinst/osdict.py b/virtinst/osdict.py -index e8c1487..74edbff 100644 +index e8c1487..5f220f6 100644 --- a/virtinst/osdict.py +++ b/virtinst/osdict.py @@ -61,12 +61,6 @@ def _remove_older_point_releases(distro_list): @@ -139,7 +139,15 @@ index e8c1487..74edbff 100644 ##################### # OsVariant classes # -@@ -363,34 +303,6 @@ class _OsVariant(object): +@@ -287,7 +227,6 @@ class _OsVariant(object): + self.codename = self._os and self._os.get_codename() or "" + + self.sortby = self._get_sortby() +- self.urldistro = self._get_urldistro() + self._supported = None + + +@@ -363,34 +302,6 @@ class _OsVariant(object): return (datetime.datetime.strptime(eol_date, "%Y-%m-%d") > datetime.datetime.now()) @@ -174,7 +182,7 @@ index e8c1487..74edbff 100644 ############### # Public APIs # -@@ -411,36 +323,13 @@ class _OsVariant(object): +@@ -411,36 +322,13 @@ class _OsVariant(object): if self._family in ['linux']: return "linux" @@ -212,7 +220,7 @@ index e8c1487..74edbff 100644 def default_netmodel(self): """ Default non-virtio net-model, since we check for that separately -@@ -499,37 +388,16 @@ class _OsVariant(object): +@@ -499,37 +387,16 @@ class _OsVariant(object): return False @@ -250,3 +258,618 @@ index e8c1487..74edbff 100644 return None def get_recommended_resources(self, guest): +diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py +index 692a297..58c1724 100644 +--- a/virtinst/urlfetcher.py ++++ b/virtinst/urlfetcher.py +@@ -382,96 +382,6 @@ def _grabTreeinfo(fetcher): + return treeinfo + + +-def _distroFromSUSEContent(fetcher, arch, vmtype=None): +- # Parse content file for the 'LABEL' field containing the distribution name +- # None if no content, GenericDistro if unknown label type. +- try: +- cbuf = fetcher.acquireFileContent("content") +- except ValueError: +- return None +- +- distribution = None +- distro_version = None +- distro_summary = None +- distro_distro = None +- distro_arch = None +- +- lines = cbuf.splitlines()[1:] +- for line in lines: +- if line.startswith("LABEL "): +- distribution = line.split(' ', 1) +- elif line.startswith("DISTRO "): +- distro_distro = line.rsplit(',', 1) +- elif line.startswith("VERSION "): +- distro_version = line.split(' ', 1) +- if len(distro_version) > 1: +- d_version = distro_version[1].split('-', 1) +- if len(d_version) > 1: +- distro_version[1] = d_version[0] +- elif line.startswith("SUMMARY "): +- distro_summary = line.split(' ', 1) +- elif line.startswith("BASEARCHS "): +- distro_arch = line.split(' ', 1) +- elif line.startswith("DEFAULTBASE "): +- distro_arch = line.split(' ', 1) +- elif line.startswith("REPOID "): +- distro_arch = line.rsplit('/', 1) +- if distribution and distro_version and distro_arch: +- break +- +- if not distribution: +- if distro_summary: +- distribution = distro_summary +- elif distro_distro: +- distribution = distro_distro +- if distro_arch: +- arch = distro_arch[1].strip() +- # Fix for 13.2 official oss repo +- if arch.find("i586-x86_64") != -1: +- arch = "x86_64" +- else: +- if cbuf.find("x86_64") != -1: +- arch = "x86_64" +- elif cbuf.find("i586") != -1: +- arch = "i586" +- elif cbuf.find("s390x") != -1: +- arch = "s390x" +- +- def _parse_sle_distribution(d): +- sle_version = d[1].strip().rsplit(' ')[4] +- if len(d[1].strip().rsplit(' ')) > 5: +- sle_version = sle_version + '.' + d[1].strip().rsplit(' ')[5][2] +- return ['VERSION', sle_version] +- +- dclass = GenericDistro +- if distribution: +- if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \ +- re.match(".*SUSE SLES*", distribution[1]): +- dclass = SLESDistro +- if distro_version is None: +- distro_version = _parse_sle_distribution(distribution) +- elif re.match(".*SUSE Linux Enterprise Desktop*", distribution[1]): +- dclass = SLEDDistro +- if distro_version is None: +- distro_version = _parse_sle_distribution(distribution) +- elif re.match(".*openSUSE.*", distribution[1]): +- dclass = OpensuseDistro +- if distro_version is None: +- distro_version = ['VERSION', distribution[0].strip().rsplit(':')[4]] +- +- if distro_version is None: +- return None +- +- ob = dclass(fetcher, arch, vmtype) +- if dclass != GenericDistro: +- ob.version_from_content = distro_version +- +- # Explictly call this, so we populate os_type/variant info +- ob.isValidStore() +- +- return ob +- +- + def getDistroStore(guest, fetcher): + stores = [] + logging.debug("Finding distro store for location=%s", fetcher.location) +@@ -755,513 +665,6 @@ class GenericDistro(Distro): + return self.fetcher.acquireFile(self._valid_iso_path) + + +-class RedHatDistro(Distro): +- """ +- Base image store for any Red Hat related distros which have +- a common layout +- """ +- uses_treeinfo = True +- _version_number = None +- +- _boot_iso_paths = ["images/boot.iso"] +- _hvm_kernel_paths = [("images/pxeboot/vmlinuz", +- "images/pxeboot/initrd.img")] +- _xen_kernel_paths = [("images/xen/vmlinuz", +- "images/xen/initrd.img")] +- +- def isValidStore(self): +- raise NotImplementedError() +- +- def _get_method_arg(self): +- if (self._version_number is not None and +- ((self.urldistro is "rhel" and self._version_number >= 7) or +- (self.urldistro is "fedora" and self._version_number >= 19))): +- return "inst.repo" +- return "method" +- +- +-# Fedora distro check +-class FedoraDistro(RedHatDistro): +- name = "Fedora" +- urldistro = "fedora" +- +- def isValidStore(self): +- if not self.treeinfo: +- return self.fetcher.hasFile("Fedora") +- +- if not re.match(".*Fedora.*", self.treeinfo.get("general", "family")): +- return False +- +- ver = self.treeinfo.get("general", "version") +- if not ver: +- logging.debug("No version found in .treeinfo") +- return False +- logging.debug("Found treeinfo version=%s", ver) +- +- latest_variant = OSDB.latest_fedora_version() +- if re.match("fedora[0-9]+", latest_variant): +- latest_vernum = int(latest_variant[6:]) +- else: +- logging.debug("Failed to parse version number from latest " +- "fedora variant=%s. Using safe default 22", latest_variant) +- latest_vernum = 22 +- +- # rawhide trees changed to use version=Rawhide in Apr 2016 +- if ver in ["development", "rawhide", "Rawhide"]: +- self._version_number = latest_vernum +- self.os_variant = latest_variant +- return True +- +- # Dev versions can be like '23_Alpha' +- if "_" in ver: +- ver = ver.split("_")[0] +- +- # Typical versions are like 'fedora-23' +- vernum = str(ver).split("-")[0] +- if vernum.isdigit(): +- vernum = int(vernum) +- else: +- logging.debug("Failed to parse version number from treeinfo " +- "version=%s, using vernum=latest=%s", ver, latest_vernum) +- vernum = latest_vernum +- +- if vernum > latest_vernum: +- self.os_variant = latest_variant +- else: +- self.os_variant = "fedora" + str(vernum) +- +- self._version_number = vernum +- return True +- +- +-# Red Hat Enterprise Linux distro check +-class RHELDistro(RedHatDistro): +- name = "Red Hat Enterprise Linux" +- urldistro = "rhel" +- +- def isValidStore(self): +- if self.treeinfo: +- # Matches: +- # Red Hat Enterprise Linux +- # RHEL Atomic Host +- m = re.match(".*(Red Hat Enterprise Linux|RHEL).*", +- self.treeinfo.get("general", "family")) +- ret = (m is not None) +- +- if ret: +- self._variantFromVersion() +- return ret +- +- if (self.fetcher.hasFile("Server") or +- self.fetcher.hasFile("Client")): +- self.os_variant = "rhel5" +- return True +- return self.fetcher.hasFile("RedHat") +- +- +- ################################ +- # osdict autodetection helpers # +- ################################ +- +- def _parseTreeinfoVersion(self, verstr): +- def _safeint(c): +- try: +- val = int(c) +- except: +- val = 0 +- return val +- +- version = _safeint(verstr[0]) +- update = 0 +- +- # RHEL has version=5.4, scientific linux=54 +- updinfo = verstr.split(".") +- if len(updinfo) > 1: +- update = _safeint(updinfo[1]) +- elif len(verstr) > 1: +- update = _safeint(verstr[1]) +- +- return version, update +- +- def _variantFromVersion(self): +- ver = self.treeinfo.get("general", "version") +- name = None +- if self.treeinfo.has_option("general", "name"): +- name = self.treeinfo.get("general", "name") +- if not ver: +- return +- +- if name and name.startswith("Red Hat Enterprise Linux Server for ARM"): +- # Kind of a hack, but good enough for the time being +- version = 7 +- update = 0 +- else: +- version, update = self._parseTreeinfoVersion(ver) +- +- self._version_number = version +- self._setRHELVariant(version, update) +- +- def _setRHELVariant(self, version, update): +- base = "rhel" + str(version) +- if update < 0: +- update = 0 +- +- ret = None +- while update >= 0: +- tryvar = base + ".%s" % update +- if not self._check_osvariant_valid(tryvar): +- update -= 1 +- continue +- +- ret = tryvar +- break +- +- if not ret: +- # Try plain rhel5, rhel6, whatev +- if self._check_osvariant_valid(base): +- ret = base +- +- if ret: +- self.os_variant = ret +- +- +-# CentOS distro check +-class CentOSDistro(RHELDistro): +- name = "CentOS" +- urldistro = "centos" +- +- def isValidStore(self): +- if not self.treeinfo: +- return self.fetcher.hasFile("CentOS") +- +- m = re.match(".*CentOS.*", self.treeinfo.get("general", "family")) +- ret = (m is not None) +- if ret: +- self._variantFromVersion() +- if self.os_variant: +- new_variant = self.os_variant.replace("rhel", "centos") +- if self._check_osvariant_valid(new_variant): +- self.os_variant = new_variant +- return ret +- +- +-# Scientific Linux distro check +-class SLDistro(RHELDistro): +- name = "Scientific Linux" +- urldistro = None +- +- _boot_iso_paths = RHELDistro._boot_iso_paths + ["images/SL/boot.iso"] +- _hvm_kernel_paths = RHELDistro._hvm_kernel_paths + [ +- ("images/SL/pxeboot/vmlinuz", "images/SL/pxeboot/initrd.img")] +- +- def isValidStore(self): +- if self.treeinfo: +- m = re.match(".*Scientific.*", +- self.treeinfo.get("general", "family")) +- ret = (m is not None) +- +- if ret: +- self._variantFromVersion() +- return ret +- +- return self.fetcher.hasFile("SL") +- +- +-class SuseDistro(Distro): +- name = "SUSE" +- +- _boot_iso_paths = ["boot/boot.iso"] +- +- def __init__(self, *args, **kwargs): +- Distro.__init__(self, *args, **kwargs) +- if re.match(r'i[4-9]86', self.arch): +- self.arch = 'i386' +- +- oldkern = "linux" +- oldinit = "initrd" +- if self.arch == "x86_64": +- oldkern += "64" +- oldinit += "64" +- +- if self.arch == "s390x": +- self._hvm_kernel_paths = [("boot/%s/linux" % self.arch, +- "boot/%s/initrd" % self.arch)] +- # No Xen on s390x +- self._xen_kernel_paths = [] +- else: +- # Tested with Opensuse >= 10.2, 11, and sles 10 +- self._hvm_kernel_paths = [("boot/%s/loader/linux" % self.arch, +- "boot/%s/loader/initrd" % self.arch)] +- # Tested with Opensuse 10.0 +- self._hvm_kernel_paths.append(("boot/loader/%s" % oldkern, +- "boot/loader/%s" % oldinit)) +- # Tested with SLES 12 for ppc64le +- self._hvm_kernel_paths.append(("boot/%s/linux" % self.arch, +- "boot/%s/initrd" % self.arch)) +- +- # Matches Opensuse > 10.2 and sles 10 +- self._xen_kernel_paths = [("boot/%s/vmlinuz-xen" % self.arch, +- "boot/%s/initrd-xen" % self.arch)] +- +- def _variantFromVersion(self): +- distro_version = self.version_from_content[1].strip() +- version = distro_version.split('.', 1)[0].strip() +- self.os_variant = self.urldistro +- if int(version) >= 10: +- if self.os_variant.startswith(("sles", "sled")): +- sp_version = None +- if len(distro_version.split('.', 1)) == 2: +- sp_version = 'sp' + distro_version.split('.', 1)[1].strip() +- self.os_variant += version +- if sp_version: +- self.os_variant += sp_version +- else: +- # Tumbleweed 8 digit date +- if len(version) == 8: +- self.os_variant += "tumbleweed" +- else: +- self.os_variant += distro_version +- else: +- self.os_variant += "9" +- +- def isValidStore(self): +- # self.version_from_content is the VERSION line from the contents file +- if (not self.version_from_content or +- self.version_from_content[1] is None): +- return False +- +- self._variantFromVersion() +- +- self.os_variant = self._detect_osdict_from_url() +- +- # Reset kernel name for sle11 source on s390x +- if self.arch == "s390x": +- if self.os_variant == "sles11" or self.os_variant == "sled11": +- self._hvm_kernel_paths = [("boot/%s/vmrdr.ikr" % self.arch, +- "boot/%s/initrd" % self.arch)] +- +- return True +- +- def _get_method_arg(self): +- return "install" +- +- ################################ +- # osdict autodetection helpers # +- ################################ +- +- def _detect_osdict_from_url(self): +- root = "opensuse" +- oses = [n for n in OSDB.list_os() if n.name.startswith(root)] +- +- for osobj in oses: +- codename = osobj.name[len(root):] +- if re.search("/%s/" % codename, self.uri): +- return osobj.name +- return self.os_variant +- +- +-class SLESDistro(SuseDistro): +- urldistro = "sles" +- +- +-class SLEDDistro(SuseDistro): +- urldistro = "sled" +- +- +-# Suse image store is harder - we fetch the kernel RPM and a helper +-# RPM and then munge bits together to generate a initrd +-class OpensuseDistro(SuseDistro): +- urldistro = "opensuse" +- +- +-class DebianDistro(Distro): +- # ex. http://ftp.egr.msu.edu/debian/dists/sarge/main/installer-i386/ +- # daily builds: http://d-i.debian.org/daily-images/amd64/ +- name = "Debian" +- urldistro = "debian" +- +- def __init__(self, *args, **kwargs): +- Distro.__init__(self, *args, **kwargs) +- +- # Pull the tree's arch out of the URL text +- self._treeArch = "i386" +- for pattern in ["^.*/installer-(\w+)/?$", +- "^.*/daily-images/(\w+)/?$"]: +- arch = re.findall(pattern, self.uri) +- if arch: +- self._treeArch = arch[0] +- break +- +- self._url_prefix = 'current/images' +- self._installer_dirname = self.name.lower() + "-installer" +- self._set_media_paths() +- +- def _set_media_paths(self): +- self._boot_iso_paths = ["%s/netboot/mini.iso" % self._url_prefix] +- +- hvmroot = "%s/netboot/%s/%s/" % (self._url_prefix, +- self._installer_dirname, +- self._treeArch) +- initrd_basename = "initrd.gz" +- kernel_basename = "linux" +- if self._treeArch in ["ppc64el"]: +- kernel_basename = "vmlinux" +- self._hvm_kernel_paths = [ +- (hvmroot + kernel_basename, hvmroot + initrd_basename)] +- +- xenroot = "%s/netboot/xen/" % self._url_prefix +- self._xen_kernel_paths = [(xenroot + "vmlinuz", xenroot + "initrd.gz")] +- +- def isValidStore(self): +- if self.fetcher.hasFile("%s/MANIFEST" % self._url_prefix): +- # For regular trees +- pass +- elif self.fetcher.hasFile("daily/MANIFEST"): +- # For daily trees +- self._url_prefix = "daily" +- self._set_media_paths() +- else: +- return False +- +- filename = "%s/MANIFEST" % self._url_prefix +- regex = ".*%s.*" % self._installer_dirname +- if not self._fetchAndMatchRegex(filename, regex): +- logging.debug("Regex didn't match, not a %s distro", self.name) +- return False +- +- self.os_variant = self._detect_debian_osdict_from_url() +- return True +- +- +- ################################ +- # osdict autodetection helpers # +- ################################ +- +- def _detect_debian_osdict_from_url(self): +- root = self.name.lower() +- oses = [n for n in OSDB.list_os() if n.name.startswith(root)] +- +- if self._url_prefix == "daily": +- logging.debug("Appears to be debian 'daily' URL, using latest " +- "debian OS") +- return oses[0].name +- +- for osobj in oses: +- if osobj.codename: +- # Ubuntu codenames look like 'Warty Warthog' +- codename = osobj.codename.split()[0].lower() +- else: +- if " " not in osobj.label: +- continue +- # Debian labels look like 'Debian Sarge' +- codename = osobj.label.split()[1].lower() +- +- if ("/%s/" % codename) in self.uri: +- logging.debug("Found codename=%s in the URL string", codename) +- return osobj.name +- +- logging.debug("Didn't find any known codename in the URL string") +- return self.os_variant +- +- +-class UbuntuDistro(DebianDistro): +- # http://archive.ubuntu.com/ubuntu/dists/natty/main/installer-amd64/ +- name = "Ubuntu" +- urldistro = "ubuntu" +- +- def isValidStore(self): +- if self.fetcher.hasFile("%s/MANIFEST" % self._url_prefix): +- # For regular trees +- filename = "%s/MANIFEST" % self._url_prefix +- regex = ".*%s.*" % self._installer_dirname +- elif self.fetcher.hasFile("install/netboot/version.info"): +- # For trees based on ISO's +- self._url_prefix = "install" +- self._set_media_paths() +- filename = "%s/netboot/version.info" % self._url_prefix +- regex = "%s*" % self.name +- elif self.fetcher.hasFile(".disk/info") and self.arch == "s390x": +- self._hvm_kernel_paths += [("boot/kernel.ubuntu", "boot/initrd.ubuntu")] +- self._xen_kernel_paths += [("boot/kernel.ubuntu", "boot/initrd.ubuntu")] +- filename = ".disk/info" +- regex = "%s*" % self.name +- else: +- return False +- +- if not self._fetchAndMatchRegex(filename, regex): +- logging.debug("Regex didn't match, not a %s distro", self.name) +- return False +- +- self.os_variant = self._detect_debian_osdict_from_url() +- return True +- +- +-class MandrivaDistro(Distro): +- # ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2007.1/x86_64/ +- name = "Mandriva/Mageia" +- urldistro = "mandriva" +- +- _boot_iso_paths = ["install/images/boot.iso"] +- _xen_kernel_paths = [] +- +- def __init__(self, *args, **kwargs): +- Distro.__init__(self, *args, **kwargs) +- self._hvm_kernel_paths = [] +- +- # At least Mageia 5 uses arch in the names +- self._hvm_kernel_paths += [ +- ("isolinux/%s/vmlinuz" % self.arch, +- "isolinux/%s/all.rdz" % self.arch)] +- +- # Kernels for HVM: valid for releases 2007.1, 2008.*, 2009.0 +- self._hvm_kernel_paths += [ +- ("isolinux/alt0/vmlinuz", "isolinux/alt0/all.rdz")] +- +- +- def isValidStore(self): +- # Don't support any paravirt installs +- if self.type is not None and self.type != "hvm": +- return False +- +- # Mandriva websites / media appear to have a VERSION +- # file in top level which we can use as our 'magic' +- # check for validity +- if not self.fetcher.hasFile("VERSION"): +- return False +- +- for name in ["Mandriva", "Mageia"]: +- if self._fetchAndMatchRegex("VERSION", ".*%s.*" % name): +- return True +- +- logging.debug("Regex didn't match, not a %s distro", self.name) +- return False +- +- +-class ALTLinuxDistro(Distro): +- # altlinux doesn't have installable URLs, so this is just for a +- # mounted ISO +- name = "ALT Linux" +- urldistro = "altlinux" +- +- _boot_iso_paths = [("altinst", "live")] +- _hvm_kernel_paths = [("syslinux/alt0/vmlinuz", "syslinux/alt0/full.cz")] +- _xen_kernel_paths = [] +- +- def isValidStore(self): +- # Don't support any paravirt installs +- if self.type is not None and self.type != "hvm": +- return False +- +- if not self.fetcher.hasFile(".disk/info"): +- return False +- +- if self._fetchAndMatchRegex(".disk/info", ".*%s.*" % self.name): +- return True +- +- logging.debug("Regex didn't match, not a %s distro", self.name) +- return False +- +- + # Build list of all *Distro classes + def _build_distro_list(): + allstores = [] -- cgit v1.2.3