[virt-tools-list] [PATCH 6/7] urlfetcher: return repository information for repomd trees
Lubomir Rintel
lkundrak at v3.sk
Fri Mar 23 09:17:05 UTC 2018
This recognizes the RPM repository trees typically used by Fedora, RHEL,
CentOS, etc. E.g.:
virt-install ... \
--location http://download.fedoraproject.org/pub/fedora/linux/releases/27/Server/x86_64/os
---
virtinst/urlfetcher.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index d535bac86..087d45307 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -822,6 +822,12 @@ class RedHatDistro(Distro):
return "inst.repo"
return "method"
+ def _check_repomd(self):
+ if self.fetcher.hasFile("repodata/repomd.xml"):
+ self._repo_type = 'repomd'
+ self._repo_url = self.fetcher.location
+ self._repo_version = self._version_number
+
# Fedora distro check
class FedoraDistro(RedHatDistro):
@@ -853,6 +859,7 @@ class FedoraDistro(RedHatDistro):
if ver in ["development", "rawhide", "Rawhide"]:
self._version_number = latest_vernum
self.os_variant = latest_variant
+ self._check_repomd()
return True
# Dev versions can be like '23_Alpha'
@@ -874,6 +881,7 @@ class FedoraDistro(RedHatDistro):
self.os_variant = "fedora" + str(vernum)
self._version_number = vernum
+ self._check_repomd()
return True
@@ -893,13 +901,18 @@ class RHELDistro(RedHatDistro):
if ret:
self._variantFromVersion()
+ self._check_repomd()
return ret
if (self.fetcher.hasFile("Server") or
self.fetcher.hasFile("Client")):
self.os_variant = "rhel5"
+ self._check_repomd()
+ return True
+
+ if self.fetcher.hasFile("RedHat"):
+ self._check_repomd()
return True
- return self.fetcher.hasFile("RedHat")
################################
@@ -985,6 +998,7 @@ class CentOSDistro(RHELDistro):
new_variant = self.os_variant.replace("rhel", "centos")
if self._check_osvariant_valid(new_variant):
self.os_variant = new_variant
+ self._check_repomd()
return ret
@@ -1005,6 +1019,7 @@ class SLDistro(RHELDistro):
if ret:
self._variantFromVersion()
+ self._check_repomd()
return ret
return self.fetcher.hasFile("SL")
--
2.14.3
More information about the virt-tools-list
mailing list