1
0
mirror of https://src.fedoraproject.org/rpms/virt-manager.git synced 2025-07-16 09:04:55 +00:00
Files
virt-manager/0017-urlfetcher-Bunch-of-distro-detection-fixes.patch
Cole Robinson f1443be186 Fix F21 URL installs (bz #1147720)
Only add 2 usbredir devices by default (bz #1135488)
2014-10-29 14:05:34 -04:00

256 lines
9.8 KiB
Diff

From: Cole Robinson <crobinso@redhat.com>
Date: Sat, 6 Sep 2014 15:35:30 -0400
Subject: [PATCH virt-manager] urlfetcher: Bunch of distro detection fixes
And update test_urls to ensure it's passing
(cherry picked from commit 2e7d477156e9d0f6fb218fa19fc00d6229d33e85)
---
tests/test_urls.py | 57 +++++++++++++++++++++-------------------
virtinst/urlfetcher.py | 71 +++++++++++++++++++++++++-------------------------
2 files changed, 65 insertions(+), 63 deletions(-)
diff --git a/tests/test_urls.py b/tests/test_urls.py
index cea20b7..ebdc9b0 100644
--- a/tests/test_urls.py
+++ b/tests/test_urls.py
@@ -41,11 +41,11 @@ from virtinst.urlfetcher import MandrivaDistro
# Access to protected member, needed to unittest stuff
OLD_FEDORA_URL = "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/%s/Fedora/%s/os/"
-DEVFEDORA_URL = "http://download.fedoraproject.org/pub/fedora/linux/development/%s/%s/os/"
-FEDORA_URL = "http://download.fedoraproject.org/pub/fedora/linux/releases/%s/Fedora/%s/os/"
+DEVFEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/development/%s/%s/os/"
+FEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/releases/%s/Fedora/%s/os/"
OLD_CENTOS_URL = "http://vault.centos.org/%s/os/%s"
-CENTOS_URL = "http://ftp.linux.ncsu.edu/pub/CentOS/%s/os/%s/"
+CENTOS_URL = "http://mirrors.mit.edu/centos/%s/os/%s/"
OLD_SCIENTIFIC_URL = "http://ftp.scientificlinux.org/linux/scientific/%s/%s/"
SCIENTIFIC_URL = "http://ftp.scientificlinux.org/linux/scientific/%s/%s/os"
@@ -60,7 +60,7 @@ OLD_DEBIAN_URL = "http://archive.debian.org/debian/dists/%s/main/installer-%s/"
DAILY_DEBIAN_URL = "http://d-i.debian.org/daily-images/%s/"
DEBIAN_URL = "http://ftp.us.debian.org/debian/dists/%s/main/installer-%s/"
-MANDRIVA_URL = "http://ftp.uwsg.indiana.edu/linux/mandrake/official/%s/%s/"
+MANDRIVA_URL = "ftp://mirror.cc.columbia.edu/pub/linux/mandriva/official/%s/%s"
urls = {}
@@ -108,14 +108,18 @@ _set_distro(FedoraDistro)
_add(OLD_FEDORA_URL % ("14", "x86_64"), "fedora14",
i686=OLD_FEDORA_URL % ("14", "i386"))
# 2 Latest releases
-_add(FEDORA_URL % ("18", "x86_64"), "fedora18")
_add(FEDORA_URL % ("19", "x86_64"), "fedora19")
+_add(FEDORA_URL % ("20", "x86_64"), "fedora20")
# Any Dev release
-_add(DEVFEDORA_URL % ("20", "x86_64"), "fedora20")
+_add(DEVFEDORA_URL % ("21", "x86_64"), "fedora20", name="fedora21")
+_add(
+"https://dl.fedoraproject.org/pub/alt/stage/21_Alpha_TC6/Server/x86_64/os/",
+"fedora20", name="fedora21-tc")
# Rawhide w/ i686 test
-_add(DEVFEDORA_URL % ("rawhide", "x86_64"), "fedora20",
- i686=DEVFEDORA_URL % ("rawhide", "i386"),
- name="fedora-rawhide")
+# XXX: Nowadays rawhide isn't a full install tree
+# _add(DEVFEDORA_URL % ("rawhide", "x86_64"), "fedora20",
+# i686=DEVFEDORA_URL % ("rawhide", "i386"),
+# name="fedora-rawhide")
_set_distro(CentOSDistro)
@@ -125,53 +129,52 @@ _add(OLD_CENTOS_URL % ("4.9", "x86_64"), name="centos-4.9")
# One old centos 5
_add(OLD_CENTOS_URL % ("5.0", "x86_64"), name="centos-5.0")
# Latest centos 5 w/ i686
-_add(CENTOS_URL % ("5", "x86_64"), "rhel5.4", name="centos-5-latest",
+_add(CENTOS_URL % ("5", "x86_64"), "rhel5.8", name="centos-5-latest",
i686=CENTOS_URL % ("5", "i386"))
# Latest centos 6 w/ i686
-_add(CENTOS_URL % ("6", "x86_64"), "rhel6", name="centos-6-latest",
+_add(CENTOS_URL % ("6", "x86_64"), "rhel6.5", name="centos-6-latest",
i686=CENTOS_URL % ("6", "i386"))
+# Latest centos 7, but no i686 as of 2014-09-06
+_add(CENTOS_URL % ("7", "x86_64"), "rhel7.0", name="centos-7-latest")
_set_distro(SLDistro)
-# Latest scientific 5
-_add(OLD_SCIENTIFIC_URL % ("55", "x86_64"), "rhel5.4", name="sl-5latest")
+# scientific 5
+_add(OLD_SCIENTIFIC_URL % ("55", "x86_64"), "rhel5.5", name="sl-5latest")
# Latest scientific 6
-_add(SCIENTIFIC_URL % ("6", "x86_64"), "rhel6", name="sl-6latest")
+_add(SCIENTIFIC_URL % ("6", "x86_64"), "rhel6.1", name="sl-6latest")
_set_distro(SuseDistro)
-# opensuse 10.0 uses different paths, so keep this around
-_add(OPENSUSE10, i686=OPENSUSE10, hasxen=False, hasbootiso=False,
- name="opensuse-10.0")
# Latest 10 series
-_add(OLD_OPENSUSE_URL % ("10.3"), hasbootiso=False, name="opensuse-10.3")
+_add(OLD_OPENSUSE_URL % ("10.3"), "opensuse10.3", hasbootiso=False)
# Latest 11 series
-_add(OLD_OPENSUSE_URL % ("11.4"), "opensuse11", hasbootiso=False)
+_add(OLD_OPENSUSE_URL % ("11.4"), "opensuse11.4", hasbootiso=False)
# Latest 12 series
# Only keep i686 for the latest opensuse
-_add(OPENSUSE_URL % ("12.3"), "opensuse12",
+_add(OPENSUSE_URL % ("12.3"), "opensuse12.3",
i686=OPENSUSE_URL % ("12.3"), hasbootiso=False, testshortcircuit=True)
_set_distro(DebianDistro)
# Debian releases rarely enough that we can just do every release since lenny
-_add(OLD_DEBIAN_URL % ("lenny", "amd64"), "debianlenny", hasxen=False,
+_add(OLD_DEBIAN_URL % ("lenny", "amd64"), "debian5", hasxen=False,
testshortcircuit=True)
-_add(DEBIAN_URL % ("squeeze", "amd64"), "debiansqueeze")
-_add(DEBIAN_URL % ("wheezy", "amd64"), "debianwheezy")
+_add(DEBIAN_URL % ("squeeze", "amd64"), "debian6")
+_add(DEBIAN_URL % ("wheezy", "amd64"), "debian7")
# And daily builds, since we specially handle that URL
-_add(DAILY_DEBIAN_URL % ("amd64"), "debianwheezy", name="debiandaily")
+_add(DAILY_DEBIAN_URL % ("amd64"), "debian7", name="debiandaily")
_set_distro(UbuntuDistro)
# One old ubuntu
-_add(OLD_UBUNTU_URL % ("hardy", "amd64"), "ubuntuhardy",
+_add(OLD_UBUNTU_URL % ("hardy", "amd64"), "ubuntu8.04",
i686=OLD_UBUNTU_URL % ("hardy", "i386"), hasxen=False,
testshortcircuit=True)
# Latest LTS
-_add(UBUNTU_URL % ("precise", "amd64"), "ubuntuprecise")
+_add(UBUNTU_URL % ("precise", "amd64"), "ubuntu12.04")
# Latest release
-_add(UBUNTU_URL % ("raring", "amd64"), "ubunturaring")
+_add(OLD_UBUNTU_URL % ("raring", "amd64"), "ubuntu13.04")
_set_distro(MandrivaDistro)
diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index 0d9a066..af647a6 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -674,15 +674,21 @@ class FedoraDistro(RedHatDistro):
lateststr, latestnum = self._latestFedoraVariant()
ver = self.treeinfo.get("general", "version")
+ if not ver:
+ return False
+
if ver == "development" or ver == "rawhide":
- vernum = latestnum
+ self._version_number = latestnum
self.os_variant = lateststr
- elif ver:
- vernum = int(str(ver).split("-")[0])
- if vernum > latestnum:
- self.os_variant = lateststr
- else:
- self.os_variant = "fedora" + str(vernum)
+ return
+
+ if "_" in ver:
+ ver = ver.split("_")[0]
+ vernum = int(str(ver).split("-")[0])
+ if vernum > latestnum:
+ self.os_variant = lateststr
+ else:
+ self.os_variant = "fedora" + str(vernum)
self._version_number = vernum
return True
@@ -773,15 +779,14 @@ class CentOSDistro(RHELDistro):
urldistro = None
def isValidStore(self):
- if self._hasTreeinfo():
- m = re.match(".*CentOS.*", self.treeinfo.get("general", "family"))
- ret = (m is not None)
-
- if ret:
- self._variantFromVersion()
- return ret
+ if not self._hasTreeinfo():
+ return self.fetcher.hasFile("CentOS")
- return self.fetcher.hasFile("CentOS")
+ m = re.match(".*CentOS.*", self.treeinfo.get("general", "family"))
+ ret = (m is not None)
+ if ret:
+ self._variantFromVersion()
+ return ret
# Scientific Linux distro check
@@ -818,18 +823,9 @@ class SuseDistro(Distro):
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"
-
# 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))
# Matches Opensuse > 10.2 and sles 10
self._xen_kernel_paths = [("boot/%s/vmlinuz-xen" % self.arch,
@@ -851,13 +847,12 @@ class SuseDistro(Distro):
def _detect_osdict_from_url(self):
root = "opensuse"
- our_os_vals = [n.name for n in osdict.list_os() if
- n.name.startswith(root)]
+ oses = [n for n in osdict.list_os() if n.name.startswith(root)]
- for name in our_os_vals:
- codename = name[len(root):]
- if re.search("/%s\.[1-9]/" % codename, self.uri):
- return name
+ for osobj in oses:
+ codename = osobj.name[len(root):]
+ if re.search("/%s/" % codename, self.uri):
+ return osobj.name
return self.os_variant
@@ -922,15 +917,19 @@ class DebianDistro(Distro):
def _detect_osdict_from_url(self):
root = self.name.lower()
- our_os_vals = [n.name for n in osdict.list_os() if
- n.name.startswith(root)]
+ oses = [n for n in osdict.list_os() if n.name.startswith(root)]
if self._prefix == "daily":
- return our_os_vals[0]
- for name in our_os_vals:
- codename = name[len(root):]
+ return oses[0].name
+
+ for osobj in oses:
+ # name looks like 'Debian Sarge'
+ if " " not in osobj.label:
+ continue
+
+ codename = osobj.label.lower().split()[1]
if ("/%s/" % codename) in self.uri:
- return name
+ return osobj.name
return self.os_variant