diff options
Diffstat (limited to 'libre')
-rw-r--r-- | libre/virt-manager/PKGBUILD | 22 | ||||
-rw-r--r-- | libre/virt-manager/libre.patch | 1551 |
2 files changed, 471 insertions, 1102 deletions
diff --git a/libre/virt-manager/PKGBUILD b/libre/virt-manager/PKGBUILD index ff02cba2b..9eee401ad 100644 --- a/libre/virt-manager/PKGBUILD +++ b/libre/virt-manager/PKGBUILD @@ -1,4 +1,3 @@ -# $Id: PKGBUILD 222207 2017-04-11 12:38:23Z spupykin $ # Maintainer (Arch): Sergej Pupykin <pupykin.s+arch@gmail.com> # Contributor (Arch): Daniel Micay <danielmicay@gmail.com> # Contributor (Arch): Jonathan Wiersma <archaur at jonw dot org> @@ -7,19 +6,20 @@ pkgbase=virt-manager pkgname=virt-install -pkgver=1.5.1 -pkgrel=1.parabola1 +pkgver=2.0.0 +pkgrel=1 +pkgrel+=.par1 pkgdesc="Console user interface for managing virtual machines, without non-FSDG compliant distros and operating systems support" arch=('any') url="http://virt-manager.org/" license=('GPL') -depends=('python2-gobject' 'libvirt-glib' 'libvirt-python2' - 'python2-requests' 'python2-ipaddr' 'libosinfo') +depends=('python-gobject' 'libvirt-glib' 'libvirt-python' + 'python-requests' 'libosinfo') makedepends=('intltool' 'python2-cairo') source=("https://virt-manager.org/download/sources/virt-manager/virt-manager-$pkgver.tar.gz" 'libre.patch') -sha512sums=('e0da3b879ea33a8c394c33df85cadac4fbb9cfed65f9a904c5d9bf07232e29f8c96b5242e3f94cae390b7b5d7a20e1c25c3867962f0a39de40e71dc00013d32b' - 'd1ae2affc590921375f4b0ffd3e412032b2d98e63056df0546eff53b7706e3b5aeaaf2d1ba6fa6dcc86bc514404df30b06cc4495a73a37b824184f0ba3a2fc81') +sha512sums=('5d0eb65dceb5c913973edaa52414b1665d1ed9cd3f226e28a592decddec2acd8fdb589f60736edf9b7d95830893812f9aecca2cbdd715033ca7ea53a95472876' + 'de6b88810094bf55515e32bfb6ff5abeb06a8f79c74095e8d57bf48423033eb3835bc9c21433e8525f362c2b144f9819437e46e7aabf64c54e7b3bfb7285e706') prepare() { cd "$srcdir/$pkgbase-$pkgver" @@ -28,13 +28,13 @@ prepare() { build() { cd "$srcdir/$pkgbase-$pkgver" - python2 setup.py build + python setup.py build } package() { cd "$srcdir/$pkgbase-$pkgver" - python2 setup.py --no-update-icon-cache --no-compile-schemas install --root "$pkgdir" - python2 -m compileall "${pkgdir}/usr/share/virt-manager" - python2 -O -m compileall "${pkgdir}/usr/share/virt-manager" + python setup.py --no-update-icon-cache --no-compile-schemas install --root "$pkgdir" + python -m compileall "${pkgdir}/usr/share/virt-manager" + python -O -m compileall "${pkgdir}/usr/share/virt-manager" rm "${pkgdir}/usr/bin/virt-manager" } diff --git a/libre/virt-manager/libre.patch b/libre/virt-manager/libre.patch index fe8e052a6..d897336c7 100644 --- a/libre/virt-manager/libre.patch +++ b/libre/virt-manager/libre.patch @@ -1,6 +1,7 @@ ---- virt-manager-1.4.2.orig/man/virt-install.pod 2017-07-17 08:06:02.000000000 -0500 -+++ virt-manager-1.4.2/man/virt-manager.pod 2016-06-17 17:54:21.000000000 -0500 -@@ -401,36 +401,6 @@ +diff -Naur virt-manager-2.0.0.orig/man/virt-install.pod virt-manager-2.0.0/man/virt-install.pod +--- virt-manager-2.0.0.orig/man/virt-install.pod 2018-10-13 13:26:55.000000000 -0500 ++++ virt-manager-2.0.0/man/virt-install.pod 2018-10-19 17:18:38.584887172 -0500 +@@ -408,36 +408,6 @@ =back @@ -10,19 +11,19 @@ - -=item Fedora/Red Hat Based - --http://download.fedoraproject.org/pub/fedora/linux/releases/25/Server/x86_64/os +-https://download.fedoraproject.org/pub/fedora/linux/releases/25/Server/x86_64/os - -=item Debian - --http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ +-https://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ - -=item Ubuntu - --http://us.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/ +-https://us.archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/ - -=item Suse - --http://download.opensuse.org/distribution/11.0/repo/oss/ +-https://download.opensuse.org/pub/opensuse/distribution/leap/42.3/repo/oss/ - -=item Mandriva - @@ -37,7 +38,7 @@ =item B<--pxe> Use the PXE boot protocol to load the initial ramdisk and kernel for starting -@@ -465,21 +435,6 @@ +@@ -472,21 +442,6 @@ --initrd-inject=/path/to/my.ks --extra-args "ks=file:/my.ks" @@ -59,7 +60,7 @@ =item B<--boot> BOOTOPTS Optionally specify the post-install VM boot configuration. This option allows -@@ -637,7 +592,7 @@ +@@ -644,7 +599,7 @@ =item B<removable> @@ -68,7 +69,7 @@ used with QEMU and bus=usb. Value can be 'on' or 'off'. =item B<readonly> -@@ -717,7 +672,7 @@ +@@ -724,7 +679,7 @@ =item B<serial> @@ -77,7 +78,7 @@ to set /dev/disk/by-id symlinks. An example serial number might be: WD-WMAP9A966149 -@@ -746,7 +701,7 @@ +@@ -753,7 +708,7 @@ --filesystem /source/on/host,/target/point/in/guest @@ -86,7 +87,7 @@ QEMU, the target point is just a mounting hint in sysfs, so will not be automatically mounted. -@@ -1695,45 +1650,6 @@ +@@ -1721,45 +1676,6 @@ =head1 EXAMPLES @@ -132,7 +133,7 @@ Run /usr/bin/httpd in a linux container guest (LXC). Resource usage is capped at 512 MiB of ram and 2 host cpus: -@@ -1759,7 +1675,7 @@ +@@ -1785,7 +1701,7 @@ --init /bin/sh Install a paravirtualized Xen guest, 500 MiB of RAM, a 5 GiB of disk, and @@ -141,18 +142,19 @@ options: # virt-install \ -@@ -1768,7 +1684,7 @@ +@@ -1794,7 +1710,7 @@ --memory 500 \ --disk /var/lib/xen/images/demo.img,size=6 \ --graphics none \ -- --location http://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/ +- --location https://download.fedora.redhat.com/pub/fedora/linux/core/6/x86_64/os/ + --location https://repo.parabola.nu/iso/latest/ Create a guest from an existing disk image 'mydisk.img' using defaults for the rest of the options. ---- virt-manager-1.4.2.orig/man/virt-xml.pod 2017-07-17 08:06:02.000000000 -0500 -+++ virt-manager-1.4.2/man/virt-xml.pod 2017-08-14 22:36:32.652992525 -0500 -@@ -290,53 +290,10 @@ +diff -Naur virt-manager-2.0.0.orig/man/virt-xml.pod virt-manager-2.0.0/man/virt-xml.pod +--- virt-manager-2.0.0.orig/man/virt-xml.pod 2018-10-13 13:26:55.000000000 -0500 ++++ virt-manager-2.0.0/man/virt-xml.pod 2018-10-19 18:35:08.954722971 -0500 +@@ -292,53 +292,10 @@ # virt-xml winxp --edit --cpu host-model,clearxml=yes --confirm @@ -206,428 +208,10 @@ Generate XML for a virtio console device and print it to stdout: # virt-xml --build-xml --console pty,target_type=virtio ---- virt-manager-1.4.2.orig/setup.py 2017-08-02 12:57:43.000000000 -0500 -+++ virt-manager-1.4.2/setup.py 2017-08-14 22:38:05.058814528 -0500 -@@ -338,7 +338,6 @@ - self.libvirt_package_names = None - self.kvm_package_names = None - self.askpass_package_names = None -- self.preferred_distros = None - self.stable_defaults = None - self.default_graphics = None - self.default_hvs = None -@@ -356,8 +355,6 @@ - template += "hv_packages = %s\n" % self.kvm_package_names - if self.askpass_package_names is not None: - template += "askpass_packages = %s\n" % self.askpass_package_names -- if self.preferred_distros is not None: -- template += "preferred_distros = %s\n" % self.preferred_distros - if self.stable_defaults is not None: - template += ("stable_defaults = %s\n" % - self.stable_defaults) ---- virt-manager-1.4.2.orig/virt-manager.spec 2017-08-08 17:15:54.000000000 -0500 -+++ virt-manager-1.4.2/virt-manager.spec 2017-08-14 22:40:06.757018202 -0500 -@@ -7,14 +7,8 @@ - %global qemu_user "qemu" - %global libvirt_packages "libvirt-daemon-kvm,libvirt-daemon-config-network" - %global kvm_packages "" --%global preferred_distros "fedora,rhel" - %global default_hvs "qemu,xen,lxc" - --%if 0%{?rhel} --%global preferred_distros "rhel,fedora" --%global stable_defaults 1 --%endif -- - - # End local config - -@@ -48,10 +42,6 @@ - Requires: gtk-vnc2 - Requires: spice-gtk3 - --%if 0%{?rhel} == 7 --Requires: gnome-icon-theme --%endif -- - - BuildRequires: intltool - BuildRequires: /usr/bin/pod2man -@@ -118,10 +108,6 @@ - %global _kvm_packages --kvm-package-names=%{kvm_packages} - %endif - --%if %{preferred_distros} --%global _preferred_distros --preferred-distros=%{preferred_distros} --%endif -- - %if %{libvirt_packages} - %global _libvirt_packages --libvirt-package-names=%{libvirt_packages} - %endif -@@ -143,7 +129,6 @@ - %{?_kvm_packages} \ - %{?_libvirt_packages} \ - %{?_askpass_package} \ -- %{?_preferred_distros} \ - %{?_stable_defaults} \ - %{?_default_hvs} - ---- virt-manager-1.4.2.orig/virt-manager.spec.in 2017-07-17 08:06:02.000000000 -0500 -+++ virt-manager-1.4.2/virt-manager.spec.in 2017-08-14 22:41:34.683050407 -0500 -@@ -7,14 +7,8 @@ - %global qemu_user "qemu" - %global libvirt_packages "libvirt-daemon-kvm,libvirt-daemon-config-network" - %global kvm_packages "" --%global preferred_distros "fedora,rhel" - %global default_hvs "qemu,xen,lxc" - --%if 0%{?rhel} --%global preferred_distros "rhel,fedora" --%global stable_defaults 1 --%endif -- - - # End local config - -@@ -48,10 +42,6 @@ - Requires: gtk-vnc2 - Requires: spice-gtk3 - --%if 0%{?rhel} == 7 --Requires: gnome-icon-theme --%endif -- - - BuildRequires: intltool - BuildRequires: /usr/bin/pod2man -@@ -118,10 +108,6 @@ - %global _kvm_packages --kvm-package-names=%{kvm_packages} - %endif - --%if %{preferred_distros} --%global _preferred_distros --preferred-distros=%{preferred_distros} --%endif -- - %if %{libvirt_packages} - %global _libvirt_packages --libvirt-package-names=%{libvirt_packages} - %endif -@@ -143,7 +129,6 @@ - %{?_kvm_packages} \ - %{?_libvirt_packages} \ - %{?_askpass_package} \ -- %{?_preferred_distros} \ - %{?_stable_defaults} \ - %{?_default_hvs} - ---- virt-manager-1.4.2.orig/virtManager/config.py 2017-08-08 07:42:58.000000000 -0500 -+++ virt-manager-1.4.2/virtManager/config.py 2017-08-14 22:42:52.471973552 -0500 -@@ -170,7 +170,6 @@ - self.keyring = None - - self.default_qemu_user = CLIConfig.default_qemu_user -- self.preferred_distros = CLIConfig.preferred_distros - self.hv_packages = CLIConfig.hv_packages - self.libvirt_packages = CLIConfig.libvirt_packages - self.askpass_package = CLIConfig.askpass_package ---- virt-manager-1.4.2.orig/virtManager/connection.py 2017-08-02 12:57:43.000000000 -0500 -+++ virt-manager-1.4.2/virtManager/connection.py 2017-08-14 22:44:21.107973719 -0500 -@@ -665,8 +665,8 @@ - continue - - if (devtype == "usb_device" and -- (("Linux Foundation" in str(xmlobj.vendor_name) or -- ("Linux" in str(xmlobj.vendor_name) and -+ (("Free Software Foundation" in str(xmlobj.vendor_name) or -+ ("GNU/Linux" in str(xmlobj.vendor_name) and - xmlobj.vendor_id == "0x1d6b")) and - ("root hub" in str(xmlobj.product_name) or - ("host controller" in str(xmlobj.product_name).lower() and ---- virt-manager-1.4.2.orig/virtManager/create.py 2017-08-02 12:57:43.000000000 -0500 -+++ virt-manager-1.4.2/virtManager/create.py 2017-08-15 00:10:08.678589639 -0500 -@@ -997,9 +997,7 @@ - model = widget.get_model() - model.clear() - -- # Kind of a hack, just show linux + windows by default since -- # that's all 98% of people care about -- supported = {"generic", "linux", "windows"} -+ supported = {"generic"} - - # Move 'generic' to the front of the list - types = virtinst.OSDB.list_types() -@@ -1009,13 +1007,7 @@ - # Pretty names for OSes. If a new OS is not found here, - # its capitalized name is used. - oses = { -- "bsd": _("BSD"), - "generic": _("Generic"), -- "linux": _("Linux"), -- "macos": _("macOS"), -- "other": _("Others"), -- "solaris": _("Solaris"), -- "windows": _("Windows"), - } - - # When only the "supported" types are requested, -@@ -1046,32 +1038,14 @@ - completion_model = self.widget("install-os-version-entry").get_completion().get_model() - completion_model.clear() - -- preferred = self.config.preferred_distros -- - # All the subgroups for top-level types. Distributions not - # belonging to these groups will be shown either in a "Others" - # group, or top-level if there are no other groups. -- groups = { -- "altlinux": _("ALT Linux"), -- "centos": _("CentOS"), -- "debian": _("Debian"), -- "fedora": _("Fedora"), -- "freebsd": _("FreeBSD"), -- "mageia": _("Mageia"), -- "netbsd": _("NetBSD"), -- "openbsd": _("OpenBSD"), -- "opensuse": _("openSUSE"), -- "rhel": _("Red Hat Enterprise Linux"), -- "sled": _("SUSE Linux Enterprise Desktop"), -- "sles": _("SUSE Linux Enterprise Server"), -- "ubuntu": _("Ubuntu"), -- } -+ groups = {} - - if self._show_all_os_was_selected: - # List all the OSes, and determine which OSes have groups, - # and which do not. -- variants = virtinst.OSDB.list_os(typename=_type, -- sortpref=preferred) - all_distros = set([_os.distro for _os in variants]) - distros = [_os for _os in all_distros if _os in groups] - distros.sort() -@@ -1099,15 +1073,13 @@ - else: - # We are showing only the supported systems, so query them, - # and add them directly to their type. -- variants = virtinst.OSDB.list_os(typename=_type, -- sortpref=preferred, only_supported=True) - for v in variants: - self._add_os_row(model, v.name, v.label) - self._add_completion_row(completion_model, v.name, v.label) - - # Add the menu entries to show all the OSes -- self._add_os_row(model, sep=True) -- self._add_os_row(model, label=_("Show all OS options"), action=True) -+ self._add_os_row(model, sep=False) -+ self._add_os_row(model, label=_("Show all OS options"), action=False) - - widget.set_active(0) - -@@ -1224,9 +1196,7 @@ - - osstr = "" - have_os = True -- if self._guest.os.is_container(): -- osstr = _("Linux") -- elif not distro: -+ if not distro: - osstr = _("Generic") - have_os = False - elif not version: -@@ -1328,7 +1298,7 @@ - break - - if not variant: -- return (None, None, False, None, None) -+ return (None, None, True, None, None) - - if drow: - distro = drow[OS_COL_ID] ---- virt-manager-1.4.2.orig/virtcli/cliconfig.py 2017-08-08 17:04:11.000000000 -0500 -+++ virt-manager-1.4.2/virtcli/cliconfig.py 2017-08-15 01:23:24.289573171 -0500 -@@ -79,8 +79,6 @@ - self.default_qemu_user = _get_param("default_qemu_user", "root") - self.stable_defaults = bool(int(_get_param("stable_defaults", "0"))) - -- self.preferred_distros = _split_list( -- _get_param("preferred_distros", "")) - self.hv_packages = _split_list(_get_param("hv_packages", "")) - self.askpass_package = _split_list(_get_param("askpass_packages", "")) - self.libvirt_packages = _split_list(_get_param("libvirt_packages", "")) ---- virt-manager-1.4.2.orig/virtinst/guest.py 2017-08-02 12:57:43.000000000 -0500 -+++ virt-manager-1.4.2/virtinst/guest.py 2017-08-15 01:35:54.605724267 -0500 -@@ -708,7 +708,6 @@ - return - - if (self.conn.is_qemu() and -- self._os_object.supports_qemu_ga() and - self.conn.check_support(self.conn.SUPPORT_CONN_AUTOSOCKET)): - dev = VirtualChannelDevice(self.conn) - dev.type = "unix" -@@ -772,8 +771,7 @@ - # But only if we are installing windows which has a multi stage - # install. - if (dev.is_cdrom() and -- getattr(dev, "installer_media", False) and -- not self._os_object.is_windows()): -+ getattr(dev, "installer_media", False)): - dev.path = None - - def _set_defaults(self): -@@ -856,10 +854,8 @@ - hpet.present = False - - hv_clock = self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_CLOCK) -- hv_clock_rhel = self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_CLOCK_RHEL) - -- if (self._os_object.is_windows() and self._hyperv_supported() and -- (hv_clock or (self.stable_defaults() and hv_clock_rhel))): -+ if (self._hyperv_supported() and (hv_clock or self.stable_defaults())): - hyperv = self.clock.add_timer() - hyperv.name = "hypervclock" - hyperv.present = True -@@ -900,8 +896,6 @@ - return - - self.cpu.set_special_mode(self.x86_cpu_default) -- if self._os_object.broken_x2apic(): -- self.cpu.add_feature("x2apic", policy="disable") - - - def _hyperv_supported(self): -@@ -937,8 +931,7 @@ - return - - default = True -- if (self._os_object.need_old_xen_disable_acpi() and -- not self.conn.check_support(support.SUPPORT_CONN_CAN_ACPI)): -+ if (not self.conn.check_support(support.SUPPORT_CONN_CAN_ACPI)): - default = False - - if self.features.acpi == "default": -@@ -962,8 +955,7 @@ - self.conn.check_support(self.conn.SUPPORT_CONN_VMPORT)): - self.features.vmport = False - -- if (self._os_object.is_windows() and -- self._hyperv_supported() and -+ if (self._hyperv_supported() and - self.conn.check_support(self.conn.SUPPORT_CONN_HYPERV_VAPIC)): - if self.features.hyperv_relaxed is None: - self.features.hyperv_relaxed = True -@@ -1065,9 +1057,7 @@ - return True - - if (self.os.is_arm_vexpress() and -- self.os.dtb and -- self._os_object.supports_virtiommio() and -- self.conn.check_support(support.SUPPORT_CONN_VIRTIO_MMIO)): -+ self.os.dtb): - return True - - return False ---- virt-manager-1.4.2.orig/virtinst/initrdinject.py 2017-08-02 12:57:43.000000000 -0500 -+++ virt-manager-1.4.2/virtinst/initrdinject.py 2017-08-15 01:38:49.171182454 -0500 -@@ -24,61 +24,6 @@ - import tempfile - - --def _rhel4_initrd_inject(initrd, injections): -- try: -- file_proc = subprocess.Popen(["file", "-z", initrd], -- stdout=subprocess.PIPE, -- stderr=subprocess.PIPE) -- if "ext2 filesystem" not in file_proc.communicate()[0]: -- return False -- except Exception: -- logging.exception("Failed to file command for rhel4 initrd detection") -- return False -- -- logging.debug("Is RHEL4 initrd") -- -- # Uncompress the initrd -- newinitrd = open(initrd + ".new", "wb") -- gzip_proc = subprocess.Popen(["gzip", "-d", "-f", "-c", initrd], -- stdout=newinitrd, -- stderr=subprocess.PIPE) -- gzip_proc.wait() -- newinitrd.close() -- -- debugfserr = "" -- for filename in injections: -- # We have an ext2 filesystem, use debugfs to inject files -- cmd = ["debugfs", "-w", "-R", -- "write %s %s" % (filename, os.path.basename(filename)), -- newinitrd.name] -- logging.debug("Copying %s to the initrd with cmd=%s", filename, cmd) -- -- debugfs_proc = subprocess.Popen(cmd, -- stdout=subprocess.PIPE, -- stderr=subprocess.PIPE) -- debugfs_proc.wait() -- debugfserr += debugfs_proc.stderr.read() or "" -- -- gziperr = gzip_proc.stderr.read() -- if gziperr: -- logging.debug("gzip stderr=%s", gziperr) -- if debugfserr: -- logging.debug("debugfs stderr=%s", debugfserr) -- -- # Recompress the initrd -- gzip_proc = subprocess.Popen(["gzip"], -- stdin=open(newinitrd.name, "rb"), -- stdout=open(initrd, "wb"), -- stderr=subprocess.PIPE) -- gzip_proc.wait() -- gziperr = gzip_proc.stderr.read() -- if gziperr: -- logging.debug("gzip stderr=%s", gziperr) -- os.unlink(newinitrd.name) -- -- return True -- -- - def perform_initrd_injections(initrd, injections, scratchdir): - """ - Insert files into the root directory of the initial ram disk -@@ -86,9 +31,6 @@ - if not injections: - return - -- if _rhel4_initrd_inject(initrd, injections): -- return -- - tempdir = tempfile.mkdtemp(dir=scratchdir) - os.chmod(tempdir, 0o775) - ---- virt-manager-1.4.2.orig/virtinst/osdict.py 2017-08-02 12:57:43.000000000 -0500 -+++ virt-manager-1.4.2/virtinst/osdict.py 2017-08-15 01:46:42.306504635 -0500 -@@ -39,10 +39,6 @@ - return int(osobj.name.rsplit(".", 1)[-1]) - - def _find_latest(prefix): -- """ -- Given a prefix like 'rhel4', find the latest 'rhel4.X', -- and remove the rest from the os list -- """ - latest_os = None - first_id = None - for osobj in ret[:]: -@@ -61,15 +57,6 @@ - if latest_os: - ret.insert(first_id, latest_os) - -- _find_latest("rhel4") -- _find_latest("rhel5") -- _find_latest("rhel6") -- _find_latest("rhel7") -- _find_latest("freebsd9") -- _find_latest("freebsd10") -- _find_latest("freebsd11") -- _find_latest("centos6") -- _find_latest("centos7") - return ret - - -@@ -137,49 +124,7 @@ +diff -Naur virt-manager-2.0.0.orig/virtinst/osdict.py virt-manager-2.0.0/virtinst/osdict.py +--- virt-manager-2.0.0.orig/virtinst/osdict.py 2018-10-13 13:59:42.000000000 -0500 ++++ virt-manager-2.0.0/virtinst/osdict.py 2018-10-19 19:37:17.687104677 -0500 +@@ -99,49 +99,7 @@ # This is only for back compatibility with pre-libosinfo support. # This should never change. _aliases = { @@ -677,7 +261,7 @@ "other": "generic", } -@@ -235,17 +180,11 @@ +@@ -208,11 +166,6 @@ return None osname = ret[0].get_short_id() @@ -689,531 +273,343 @@ return osname - def list_types(self): -- approved_types = ["linux", "windows", "bsd", "macos", -- "solaris", "other", "generic"] -+ approved_types = ["generic"] - return approved_types - - def list_os(self, typename=None, only_supported=False, sortpref=None): -@@ -268,13 +207,6 @@ - return _sort(sortmap, sortpref=sortpref, - limit_point_releases=only_supported) +@@ -236,9 +189,6 @@ + return None + return oses[0] - def latest_fedora_version(self): -- for osinfo in self.list_os(): -- if (osinfo.name.startswith("fedora") and -- "unknown" not in osinfo.name): -- # First fedora* occurrence should be the newest -- return osinfo.name +- return self.latest_regex("fedora[0-9]+") - ##################### # OsVariant classes # -@@ -291,7 +223,6 @@ - self.distro = self._os and self._os.get_distro() or "" - - self.sortby = self._get_sortby() -- self.urldistro = self._get_urldistro() - self._supported = None - +diff -Naur virt-manager-2.0.0.orig/virtinst/urldetect.py virt-manager-2.0.0/virtinst/urldetect.py +--- virt-manager-2.0.0.orig/virtinst/urldetect.py 2018-10-13 13:26:55.000000000 -0500 ++++ virt-manager-2.0.0/virtinst/urldetect.py 2018-10-19 19:44:14.306556502 -0500 +@@ -134,110 +134,6 @@ + return version, update -@@ -366,34 +297,6 @@ - return (datetime.datetime.strptime(eol_date, "%Y-%m-%d") > - datetime.datetime.now()) -- if self.name == "fedora-unknown": -- return False -- -- # As of libosinfo 2.11, many clearly EOL distros don't have an -- # EOL date. So assume None == EOL, add some manual work arounds. -- # We should fix this in a new libosinfo version, and then drop -- # this hack -- if self._is_related_to(["fedora24", "rhel7.0", "debian6", -- "ubuntu13.04", "win8", "win2k12", "mageia5", "centos7.0"], -- check_clones=False, check_derives=False): -- return True -- return False -- -- def _get_urldistro(self): -- if not self._os: +-class _SUSEContent(object): +- """ +- Helper class tracking the SUSE 'content' files +- """ +- def __init__(self, content_str): +- self.content_str = content_str +- self.content_dict = {} +- +- for line in self.content_str.splitlines(): +- for prefix in ["LABEL", "DISTRO", "VERSION", +- "BASEARCHS", "DEFAULTBASE", "REPOID"]: +- if line.startswith(prefix + " "): +- self.content_dict[prefix] = line.split(" ", 1)[1] +- +- logging.debug("SUSE content dict: %s", str(self.content_dict)) +- +- self.tree_arch = self._get_tree_arch() +- self.product_name = self._get_product_name() +- self.product_version = self._get_product_version() +- logging.debug("SUSE content product_name=%s product_version=%s " +- "tree_arch=%s", self.product_name, self.product_version, +- self.tree_arch) +- +- def _get_tree_arch(self): +- # Examples: +- # opensuse 11.4: BASEARCHS i586 x86_64 +- # opensuse 12.3: BASEARCHS i586 x86_64 +- # opensuse 10.3: DEFAULTBASE i586 +- distro_arch = (self.content_dict.get("BASEARCHS") or +- self.content_dict.get("DEFAULTBASE")) +- if not distro_arch and "REPOID" in self.content_dict: +- distro_arch = self.content_dict["REPOID"].rsplit('/', 1)[1] +- if not distro_arch: - return None -- urldistro = self.distro -- remap = { -- "opensuse": "suse", -- "sles": "suse", -- "mes": "mandriva" -- } - -- if remap.get(urldistro): -- return remap[urldistro] -- -- return urldistro -- - - ############### - # Public APIs # -@@ -410,43 +313,11 @@ - """ - if not self._os: - return "generic" -- -- if self._family in ['linux']: -- return "linux" -- -- if self._family in ['win9x', 'winnt', 'win16']: -- return "windows" -- -- if self._family in ['solaris']: -- return "solaris" -- -- if self._family in ['openbsd', 'freebsd', 'netbsd']: -- return "bsd" -- -- if self._family in ['darwin']: -- return "macos" -- -- return "other" +- tree_arch = distro_arch.strip() +- # Fix for 13.2 official oss repo +- if tree_arch.find("i586-x86_64") != -1: +- tree_arch = "x86_64" +- return tree_arch - -- def is_windows(self): -- return self.get_typename() == "windows" +- def _get_product_name(self): +- """ +- Parse the SUSE product name. Examples: +- SUSE Linux Enterprise Server 11 SP4 +- openSUSE 11.4 +- """ +- # Some field examples in the wild +- # +- # opensuse 10.3: LABEL openSUSE 10.3 +- # opensuse 11.4: LABEL openSUSE 11.4 +- # opensuse 12.3: LABEL openSUSE +- # sles11sp4 DVD: LABEL SUSE Linux Enterprise Server 11 SP4 +- # +- # +- # DISTRO cpe:/o:opensuse:opensuse:13.2,openSUSE +- # DISTRO cpe:/o:suse:sled:12:sp3,SUSE Linux Enterprise Desktop 12 SP3 +- # +- # As of 2018 all latest distros match only DISTRO and REPOID. +- product_name = None +- if "LABEL" in self.content_dict: +- product_name = self.content_dict["LABEL"] +- elif "," in self.content_dict.get("DISTRO", ""): +- product_name = self.content_dict["DISTRO"].rsplit(",", 1)[1] +- +- logging.debug("SUSE content product_name=%s", product_name) +- return product_name +- +- def _get_product_version(self): +- # Some example fields: +- # +- # opensuse 10.3: VERSION 10.3 +- # opensuse 12.3: VERSION 12.3 +- # SLES-10-SP4-DVD-x86_64-GM-DVD1.iso: VERSION 10.4-0 +- # +- # REPOID obsproduct://build.suse.de/SUSE:SLE-11-SP4:GA/SUSE_SLES/11.4/DVD/x86_64 +- # REPOID obsproduct://build.suse.de/SUSE:SLE-12-SP3:GA/SLES/12.3/DVD/aarch64 +- # +- # As of 2018 all latest distros match only DISTRO and REPOID. +- if not self.product_name: +- return None - -- def need_old_xen_disable_acpi(self): -- return self._is_related_to(["winxp", "win2k"], check_upgrades=False) +- distro_version = self.content_dict.get("VERSION", "") +- if "-" in distro_version: +- distro_version = distro_version.split('-', 1)[0] - -- def broken_x2apic(self): -- # x2apic breaks networking in solaris10 -- # https://bugs.launchpad.net/bugs/1395217 -- return self.name in ('solaris10', 'solaris11') -+ return None - - def get_clock(self): -- if self.is_windows() or self._family in ['solaris']: -- return "localtime" - return "utc" - -- def supports_virtiommio(self): -- return self._is_related_to(["fedora19"]) +- # Special case, parse version out of a line like this +- # cpe:/o:opensuse:opensuse:13.2,openSUSE +- if (not distro_version and +- re.match("^.*:.*,openSUSE*", self.content_dict["DISTRO"])): +- distro_version = self.content_dict["DISTRO"].rsplit( +- ",", 1)[0].strip().rsplit(":")[4] +- distro_version = distro_version.strip() - - def default_netmodel(self): - """ - Default non-virtio net-model, since we check for that separately -@@ -512,9 +383,6 @@ - - return False - -- def supports_qemu_ga(self): -- return self._is_related_to(["debian8", "fedora18", "rhel6.0", "sles11sp4"]) -- - def default_videomodel(self, guest): - if guest.os.is_pseries(): - return "vga" -@@ -525,9 +393,6 @@ - else: - return "qxl" - -- if self.is_windows(): -- return "vga" +- if "Enterprise" in self.product_name or "SLES" in self.product_name: +- sle_version = self.product_name.strip().rsplit(' ')[4] +- if len(self.product_name.strip().rsplit(' ')) > 5: +- sle_version = (sle_version + '.' + +- self.product_name.strip().rsplit(' ')[5][2]) +- distro_version = sle_version - - return None - - def get_recommended_resources(self, guest): ---- virt-manager-1.5.0.orig/virtinst/urlfetcher.py 2018-01-27 15:57:20.000000000 -0500 -+++ virt-manager-1.5.0/virtinst/urlfetcher.py 2018-02-15 22:07:10.133800027 -0500 -@@ -408,96 +408,6 @@ - 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 +- return distro_version - - def getDistroStore(guest, fetcher): - stores = [] logging.debug("Finding distro store for location=%s", fetcher.location) -@@ -788,597 +698,6 @@ - return self.fetcher.acquireFile(self._valid_iso_path) + +@@ -369,455 +265,6 @@ + return None -class RedHatDistro(Distro): - """ -- Base image store for any Red Hat related distros which have -- a common layout +- Baseclass for Red Hat based distros - """ -- uses_treeinfo = True -- _version_number = None +- @classmethod +- def is_valid(cls, cache): +- raise NotImplementedError - -- _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 __init__(self, *args, **kwargs): +- Distro.__init__(self, *args, **kwargs) - -- def isValidStore(self): -- raise NotImplementedError() +- self._kernel_paths = self.cache.get_treeinfo_media(self.type) +- +- def _get_kernel_url_arg(self): +- def _is_old_rhdistro(): +- m = re.match(r"^.*[^0-9\.]+([0-9\.]+)$", self._os_variant or "") +- if m: +- version = float(m.groups()[0]) +- if "fedora" in self._os_variant and version < 19: +- return True +- elif version < 7: +- # rhel, centos, scientific linux, etc +- return True +- +- # If we can't parse, assume it's something recentish and +- # it supports the newer arg +- return False - -- def _get_method_arg(self): -- if (self._version_number is not None and -- ((self.urldistro == "rhel" and self._version_number >= 7) or -- (self.urldistro == "fedora" and self._version_number >= 19))): -- return "inst.repo" -- return "method" +- if _is_old_rhdistro(): +- return "method" +- return "inst.repo" - - --# Fedora distro check -class FedoraDistro(RedHatDistro): -- name = "Fedora" -- urldistro = "fedora" +- PRETTY_NAME = "Fedora" +- matching_distros = ["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) +- @classmethod +- def is_valid(cls, cache): +- famregex = ".*Fedora.*" +- return cache.treeinfo_family_regex(famregex) - +- def _detect_version(self): - 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] +- verstr = self.cache.treeinfo_version +- if not verstr: +- logging.debug("No treeinfo version? Assume latest_variant=%s", +- latest_variant) +- return latest_variant - -- # 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 +- # rawhide trees changed to use version=Rawhide in Apr 2016 +- if verstr in ["development", "rawhide", "Rawhide"]: +- logging.debug("treeinfo version=%s, using latest_variant=%s", +- verstr, latest_variant) +- return latest_variant - -- if vernum > latest_vernum: -- self.os_variant = latest_variant -- else: -- self.os_variant = "fedora" + str(vernum) +- # treeinfo version is just an integer +- variant = "fedora" + verstr +- if OSDB.lookup_os(variant): +- return variant - -- self._version_number = vernum -- return True +- logging.debug("variant=%s from treeinfo version=%s not found, " +- "using latest_variant=%s", variant, verstr, latest_variant) +- return latest_variant - - --# 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 Exception: -- 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: +- PRETTY_NAME = "Red Hat Enterprise Linux" +- matching_distros = ["rhel"] +- _variant_prefix = "rhel" +- +- @classmethod +- def is_valid(cls, cache): +- # Matches: +- # Red Hat Enterprise Linux +- # RHEL Atomic Host +- famregex = ".*(Red Hat Enterprise Linux|RHEL).*" +- return cache.treeinfo_family_regex(famregex) +- +- def _detect_version(self): +- if not self.cache.treeinfo_version: +- logging.debug("No treeinfo version? Not setting an os_variant") - 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) +- version, update = self.cache.split_version() - -- self._version_number = version -- self._setRHELVariant(version, update) -- -- def _setRHELVariant(self, version, update): -- base = "rhel" + str(version) -- if update < 0: -- update = 0 -- -- ret = None +- # start with example base=rhel7, then walk backwards +- # through the OS list to find the latest os name that matches +- # this way we handle rhel7.6 from treeinfo when osdict only +- # knows about rhel7.5 +- base = self._variant_prefix + str(version) - while update >= 0: - tryvar = base + ".%s" % update -- if not self._check_osvariant_valid(tryvar): -- update -= 1 -- continue +- if OSDB.lookup_os(tryvar): +- return tryvar +- update -= 1 - -- 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") +- PRETTY_NAME = "CentOS" +- matching_distros = ["centos"] +- _variant_prefix = "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 +- @classmethod +- def is_valid(cls, cache): +- famregex = ".*(CentOS|Scientific).*" +- return cache.treeinfo_family_regex(famregex) - - --# 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")] +-class SuseDistro(Distro): +- PRETTY_NAME = None +- _suse_regex = [] +- matching_distros = [] +- _variant_prefix = NotImplementedError +- famregex = NotImplementedError +- +- @classmethod +- def is_valid(cls, cache): +- if cache.treeinfo_family_regex(cls.famregex): +- return True - -- def isValidStore(self): -- if self.treeinfo: -- m = re.match(".*Scientific.*", -- self.treeinfo.get("general", "family")) -- ret = (m is not None) +- if not cache.suse_content: +- cache.suse_content = -1 +- content_str = cache.acquire_file_content("content") +- if content_str is None: +- return False - -- if ret: -- self._variantFromVersion() -- return ret +- try: +- cache.suse_content = _SUSEContent(content_str) +- except Exception as e: +- logging.debug("Error parsing SUSE content file: %s", str(e)) +- return False - -- return self.fetcher.hasFile("SL") +- if cache.suse_content == -1: +- return False +- for regex in cls._suse_regex: +- if re.match(regex, cache.suse_content.product_name): +- return True +- return False - +- def __init__(self, *args, **kwargs): +- Distro.__init__(self, *args, **kwargs) - --class SuseDistro(Distro): -- name = "SUSE" +- if not self.cache.suse_content or self.cache.suse_content == -1: +- # This means we matched on treeinfo +- self._kernel_paths = self.cache.get_treeinfo_media(self.type) +- return - -- _boot_iso_paths = ["boot/boot.iso"] +- tree_arch = self.cache.suse_content.tree_arch - -- def __init__(self, *args, **kwargs): -- Distro.__init__(self, *args, **kwargs) -- if re.match(r'i[4-9]86', self.arch): -- self.arch = 'i386' +- if re.match(r'i[4-9]86', tree_arch): +- tree_arch = 'i386' - - oldkern = "linux" - oldinit = "initrd" -- if self.arch == "x86_64": +- if tree_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)) -- +- self._kernel_paths = [] +- if self.type == "xen": - # 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._kernel_paths.append( +- ("boot/%s/vmlinuz-xen" % tree_arch, +- "boot/%s/initrd-xen" % tree_arch)) +- +- if (tree_arch == "s390x" and +- (self._os_variant == "sles11" or self._os_variant == "sled11")): +- self._kernel_paths.append( +- ("boot/s390x/vmrdr.ikr", "boot/s390x/initrd")) +- +- # Tested with SLES 12 for ppc64le, all s390x +- self._kernel_paths.append( +- ("boot/%s/linux" % tree_arch, +- "boot/%s/initrd" % tree_arch)) +- # Tested with Opensuse 10.0 +- self._kernel_paths.append( +- ("boot/loader/%s" % oldkern, +- "boot/loader/%s" % oldinit)) +- # Tested with Opensuse >= 10.2, 11, and sles 10 +- self._kernel_paths.append( +- ("boot/%s/loader/linux" % tree_arch, +- "boot/%s/loader/initrd" % tree_arch)) +- +- def _detect_osdict_from_suse_content(self): +- if not self.cache.suse_content: +- return - -- self._variantFromVersion() +- distro_version = self.cache.suse_content.product_version +- if not distro_version: +- return - -- self.os_variant = self._detect_osdict_from_url() +- version = distro_version.split('.', 1)[0].strip() +- if len(version) == 8: +- # Tumbleweed 8 digit date +- return "opensusetumbleweed" - -- # 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)] +- if int(version) < 10: +- return self._variant_prefix + "9" - -- return True +- if str(self._variant_prefix).startswith(("sles", "sled")): +- sp_version = "" +- if len(distro_version.split('.', 1)) == 2: +- sp_version = 'sp' + distro_version.split('.', 1)[1].strip() - -- def _get_method_arg(self): -- return "install" +- return self._variant_prefix + version + sp_version - -- ################################ -- # osdict autodetection helpers # -- ################################ +- return self._variant_prefix + distro_version - - def _detect_osdict_from_url(self): - root = "opensuse" @@ -1223,39 +619,104 @@ - codename = osobj.name[len(root):] - if re.search("/%s/" % codename, self.uri): - return osobj.name -- return self.os_variant +- +- def _detect_from_treeinfo(self): +- if not self.cache.treeinfo_name: +- return +- if re.search("openSUSE Tumbleweed", self.cache.treeinfo_name): +- return "opensusetumbleweed" +- +- version, update = self.cache.split_version() +- base = self._variant_prefix + str(version) +- while update >= 0: +- tryvar = base +- # SLE doesn't use '.0' for initial releases in +- # osinfo-db (sles11, sles12, etc) +- if update > 0 or not base.startswith('sle'): +- tryvar += ".%s" % update +- if OSDB.lookup_os(tryvar): +- return tryvar +- update -= 1 +- +- def _detect_version(self): +- var = self._detect_from_treeinfo() +- if not var: +- var = self._detect_osdict_from_url() +- if not var: +- var = self._detect_osdict_from_suse_content() +- return var +- +- def _get_kernel_url_arg(self): +- return "install" - - -class SLESDistro(SuseDistro): -- urldistro = "sles" +- PRETTY_NAME = "SLES" +- matching_distros = ["sles"] +- _variant_prefix = "sles" +- _suse_regex = [".*SUSE Linux Enterprise Server*", ".*SUSE SLES*"] +- famregex = ".*SUSE Linux Enterprise.*" - - -class SLEDDistro(SuseDistro): -- urldistro = "sled" +- PRETTY_NAME = "SLED" +- matching_distros = ["sled"] +- _variant_prefix = "sled" +- _suse_regex = [".*SUSE Linux Enterprise Desktop*"] +- famregex = ".*SUSE Linux Enterprise.*" - - --# 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" +- PRETTY_NAME = "openSUSE" +- matching_distros = ["opensuse"] +- _variant_prefix = "opensuse" +- _suse_regex = [".*openSUSE.*"] +- famregex = ".*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" +- # daily builds: https://d-i.debian.org/daily-images/amd64/ +- PRETTY_NAME = "Debian" +- matching_distros = ["debian"] +- _debname = "debian" +- +- @classmethod +- def is_valid(cls, cache): +- def check_manifest(mfile): +- is_ubuntu = cls._debname == "ubuntu" +- if cache.content_regex(mfile, ".*[Uu]buntu.*"): +- return is_ubuntu +- return cache.content_regex(mfile, ".*[Dd]ebian.*") +- +- media_type = None +- if check_manifest("current/images/MANIFEST"): +- media_type = "url" +- elif check_manifest("daily/MANIFEST"): +- media_type = "daily" +- elif cache.content_regex(".disk/info", +- "%s.*" % cls._debname.capitalize()): +- media_type = "disk" +- +- if media_type: +- cache.debian_media_type = media_type +- return bool(media_type) +- - - def __init__(self, *args, **kwargs): - Distro.__init__(self, *args, **kwargs) - -- self._url_prefix = "" -- self._treeArch = self._find_treearch() -- self._installer_dirname = self.name.lower() + "-installer" +- +- self._kernel_paths = [] +- if self.cache.debian_media_type == "disk": +- self._set_installcd_paths() +- else: +- self._set_url_paths() +- - - def _find_treearch(self): -- for pattern in ["^.*/installer-(\w+)/?$", -- "^.*/daily-images/(\w+)/?$"]: +- for pattern in [r"^.*/installer-(\w+)/?$", +- r"^.*/daily-images/(\w+)/?$"]: - arch = re.findall(pattern, self.uri) - if not arch: - continue @@ -1263,7 +724,7 @@ - pattern, arch[0]) - return arch[0] - -- # Check for standard 'i386' and 'amd64' which will be +- # Check for standard arch strings which will be - # in the URI name for --location $ISO mounts - for arch in ["i386", "amd64", "x86_64", "arm64"]: - if arch in self.uri: @@ -1277,120 +738,57 @@ - logging.debug("No treearch found in uri, defaulting to arch=%s", arch) - return arch - -- def _set_media_paths(self): -- self._boot_iso_paths = ["%s/netboot/mini.iso" % self._url_prefix] +- def _set_url_paths(self): +- url_prefix = "current/images" +- if self.cache.debian_media_type == "daily": +- url_prefix = "daily" - -- hvmroot = "%s/netboot/%s/%s/" % (self._url_prefix, -- self._installer_dirname, -- self._treeArch) +- tree_arch = self._find_treearch() +- hvmroot = "%s/netboot/%s-installer/%s/" % (url_prefix, +- self._debname, tree_arch) - initrd_basename = "initrd.gz" - kernel_basename = "linux" -- if self._treeArch in ["ppc64el"]: +- if tree_arch in ["ppc64el"]: - kernel_basename = "vmlinux" - -- if self._treeArch == "s390x": -- hvmroot = "%s/generic/" % self._url_prefix -- kernel_basename = "kernel.%s" % self.name.lower() -- initrd_basename = "initrd.%s" % self.name.lower() -- -- 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 _check_manifest(self, filename): -- if not self.fetcher.hasFile(filename): -- return False -- -- if self.arch == "s390x": -- regex = ".*generic/kernel\.%s.*" % self.name.lower() -- else: -- regex = ".*%s.*" % self._installer_dirname +- if tree_arch == "s390x": +- hvmroot = "%s/generic/" % url_prefix +- kernel_basename = "kernel.%s" % self._debname +- initrd_basename = "initrd.%s" % self._debname - -- if not self._fetchAndMatchRegex(filename, regex): -- logging.debug("Regex didn't match, not a %s distro", self.name) -- return False - -- return True -- -- def _check_info(self, filename): -- if not self.fetcher.hasFile(filename): -- return False +- if self.type == "xen": +- xenroot = "%s/netboot/xen/" % url_prefix +- self._kernel_paths.append( +- (xenroot + "vmlinuz", xenroot + "initrd.gz")) +- self._kernel_paths.append( +- (hvmroot + kernel_basename, hvmroot + initrd_basename)) - -- regex = "%s.*" % self.name -- -- if not self._fetchAndMatchRegex(filename, regex): -- logging.debug("Regex didn't match, not a %s distro", self.name) -- return False -- -- return True -- -- def _is_regular_tree(self): -- # For regular trees -- if not self._check_manifest("current/images/MANIFEST"): -- return False -- -- self._url_prefix = "current/images" -- self._set_media_paths() -- self.os_variant = self._detect_debian_osdict_from_url() -- -- return True -- -- def _is_daily_tree(self): -- # For daily trees -- if not self._check_manifest("daily/MANIFEST"): -- return False -- -- self._url_prefix = "daily" -- self._set_media_paths() -- self.os_variant = self._detect_debian_osdict_from_url() -- -- return True -- -- def _is_install_cd(self): -- # For install CDs -- if not self._check_info(".disk/info"): -- return False -- -- if self.arch == "x86_64": -- kernel_initrd_pair = ("install.amd/vmlinuz", -- "install.amd/initrd.gz") +- def _set_installcd_paths(self): +- if self._debname == "ubuntu": +- if not self.arch == "s390x": +- kpair = ("install/vmlinuz", "install/initrd.gz") +- else: +- kpair = ("boot/kernel.ubuntu", "boot/initrd.ubuntu") +- elif self.arch == "x86_64": +- kpair = ("install.amd/vmlinuz", "install.amd/initrd.gz") - elif self.arch == "i686": -- kernel_initrd_pair = ("install.386/vmlinuz", -- "install.386/initrd.gz") +- kpair = ("install.386/vmlinuz", "install.386/initrd.gz") - elif self.arch == "aarch64": -- kernel_initrd_pair = ("install.a64/vmlinuz", -- "install.a64/initrd.gz") +- kpair = ("install.a64/vmlinuz", "install.a64/initrd.gz") - elif self.arch == "ppc64le": -- kernel_initrd_pair = ("install/vmlinux", -- "install/initrd.gz") +- kpair = ("install/vmlinux", "install/initrd.gz") - elif self.arch == "s390x": -- kernel_initrd_pair = ("boot/linux_vm", "boot/root.bin") +- kpair = ("boot/linux_vm", "boot/root.bin") - else: -- kernel_initrd_pair = ("install/vmlinuz", "install/initrd.gz") -- self._hvm_kernel_paths += [kernel_initrd_pair] -- self._xen_kernel_paths += [kernel_initrd_pair] -- +- kpair = ("install/vmlinuz", "install/initrd.gz") +- self._kernel_paths += [kpair] - return True - -- def isValidStore(self): -- return any(check() for check in [ -- self._is_regular_tree, -- self._is_daily_tree, -- self._is_install_cd, -- ]) -- -- -- ################################ -- # osdict autodetection helpers # -- ################################ +- def _detect_version(self): +- oses = [n for n in OSDB.list_os() if n.name.startswith(self._debname)] - -- 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": +- if self.cache.debian_media_type == "daily": - logging.debug("Appears to be debian 'daily' URL, using latest " - "debian OS") - return oses[0].name @@ -1409,109 +807,80 @@ - 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" +- # https://archive.ubuntu.com/ubuntu/dists/natty/main/installer-amd64/ +- PRETTY_NAME = "Ubuntu" +- matching_distros = ["ubuntu"] +- _debname = "ubuntu" - -- def _is_tree_iso(self): -- # For trees based on ISO's -- if not self._check_info("install/netboot/version.info"): -- return False -- -- self._url_prefix = "install" -- self._set_media_paths() -- self.os_variant = self._detect_debian_osdict_from_url() -- -- return True - -- def _is_install_cd(self): -- # For install CDs -- if not self._check_info(".disk/info"): -- return False -- -- if not self.arch == "s390x": -- kernel_initrd_pair = ("install/vmlinuz", "install/initrd.gz") -- else: -- kernel_initrd_pair = ("boot/kernel.ubuntu", "boot/initrd.ubuntu") -- -- self._hvm_kernel_paths += [kernel_initrd_pair] -- self._xen_kernel_paths += [kernel_initrd_pair] +-class ALTLinuxDistro(Distro): +- PRETTY_NAME = "ALT Linux" +- matching_distros = ["altlinux"] - -- return True +- _kernel_paths = [("syslinux/alt0/vmlinuz", "syslinux/alt0/full.cz")] - +- @classmethod +- def is_valid(cls, cache): +- # altlinux doesn't have installable URLs, so this is just for ISO +- return cache.content_regex(".disk/info", ".*ALT .*") - - -class MandrivaDistro(Distro): - # ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2007.1/x86_64/ -- name = "Mandriva/Mageia" -- urldistro = "mandriva" +- PRETTY_NAME = "Mandriva/Mageia" +- matching_distros = ["mandriva", "mes"] - -- _boot_iso_paths = ["install/images/boot.iso"] -- _xen_kernel_paths = [] +- @classmethod +- def is_valid(cls, cache): +- return cache.content_regex("VERSION", ".*(Mandriva|Mageia).*") - - def __init__(self, *args, **kwargs): - Distro.__init__(self, *args, **kwargs) -- self._hvm_kernel_paths = [] +- self._kernel_paths = [] - - # At least Mageia 5 uses arch in the names -- self._hvm_kernel_paths += [ +- self._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 += [ +- self._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", ".*ALT .*"): -- 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 = [] + class GenericTreeinfoDistro(Distro): + """ + Generic catchall class for .treeinfo using distros +diff -Naur virt-manager-2.0.0.orig/virtManager/details.py virt-manager-2.0.0/virtManager/details.py +--- virt-manager-2.0.0.orig/virtManager/details.py 2018-10-13 16:15:25.000000000 -0500 ++++ virt-manager-2.0.0/virtManager/details.py 2018-10-19 19:34:11.219743958 -0500 +@@ -337,14 +337,6 @@ + + def _label_for_os_type(os_type): + typemap = { +- "dos": _("MS-DOS/FreeDOS"), +- "freebsd": _("FreeBSD"), +- "hurd": _("GNU/Hurd"), +- "linux": _("Linux"), +- "minix": _("MINIX"), +- "netbsd": _("NetBSD"), +- "openbsd": _("OpenBSD"), +- "windows": _("Microsoft Windows"), + } + try: + return typemap[os_type] +diff -Naur virt-manager-2.0.0.orig/virtManager/oslist.py virt-manager-2.0.0/virtManager/oslist.py +--- virt-manager-2.0.0.orig/virtManager/oslist.py 2018-10-13 13:26:55.000000000 -0500 ++++ virt-manager-2.0.0/virtManager/oslist.py 2018-10-20 17:45:29.688394493 -0500 +@@ -55,7 +55,8 @@ + all_os = virtinst.OSDB.list_os() + + for os in all_os: +- os_list_model.append([os, "%s (%s)" % (os.label, os.name)]) ++ if os.name == "generic": ++ os_list_model.append([os, "%s (%s)" % (os.label, os.name)]) + + model_filter = Gtk.TreeModelFilter(child_model=os_list_model) + model_filter.set_visible_func(self._filter_os_cb) |