[Kimchi-devel] [PATCH] Add os_arch field to distros
Christy Perez
christy at linux.vnet.ibm.com
Wed Feb 5 21:51:26 UTC 2014
Adding an os_arch field to the distro so we can filter distros
on systems with other architectures. This prevents a user from
creating unusable templates.
Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
---
src/distros.d/debian.json | 1 +
src/distros.d/fedora.json | 3 +++
src/distros.d/gentoo.json | 1 +
src/distros.d/opensuse.json | 1 +
src/distros.d/ubuntu.json | 2 ++
src/kimchi/distroloader.py | 3 ++-
6 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/distros.d/debian.json b/src/distros.d/debian.json
index 0a00ae0..0754cf3 100644
--- a/src/distros.d/debian.json
+++ b/src/distros.d/debian.json
@@ -2,6 +2,7 @@
{
"name": "debian-Wheezy",
"os_distro": "debian",
+ "os_arch": "x86_64",
"os_version": "7.2.0",
"path": "http://cdimage.debian.org/debian-cd/7.2.0-live/amd64/iso-hybrid/debian-live-7.2-amd64-gnome-desktop.iso"
}
diff --git a/src/distros.d/fedora.json b/src/distros.d/fedora.json
index b4a82eb..d78205b 100644
--- a/src/distros.d/fedora.json
+++ b/src/distros.d/fedora.json
@@ -2,18 +2,21 @@
{
"name": "fedora-18",
"os_distro": "fedora",
+ "os_arch": "x86_64",
"os_version": "18",
"path": "http://fedora.mirrors.tds.net/pub/fedora/releases/18/Live/x86_64/Fedora-18-x86_64-Live-Desktop.iso"
},
{
"name": "fedora-19",
"os_distro": "fedora",
+ "os_arch": "x86_64",
"os_version": "19",
"path": "http://fedora.mirrors.tds.net/pub/fedora/releases/19/Live/x86_64/Fedora-Live-Desktop-x86_64-19-1.iso"
},
{
"name": "fedora-20",
"os_distro": "fedora",
+ "os_arch": "x86_64",
"os_version": "20",
"path": "http://fedora.mirrors.tds.net/pub/fedora/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso"
}
diff --git a/src/distros.d/gentoo.json b/src/distros.d/gentoo.json
index dffeadf..fa5e55b 100644
--- a/src/distros.d/gentoo.json
+++ b/src/distros.d/gentoo.json
@@ -2,6 +2,7 @@
{
"name": "gentoo-20131010",
"os_distro": "gentoo",
+ "os_arch": "x86_64",
"os_version": "20131010",
"path": "http://distfiles.gentoo.org/releases/amd64/autobuilds/current-iso/install-amd64-minimal-20131010.iso"
}
diff --git a/src/distros.d/opensuse.json b/src/distros.d/opensuse.json
index ff03f41..315cf78 100644
--- a/src/distros.d/opensuse.json
+++ b/src/distros.d/opensuse.json
@@ -2,6 +2,7 @@
{
"name": "opensuse-12.3",
"os_distro": "opensuse",
+ "os_arch": "x86_64",
"os_version": "12.3",
"path": "http://suse.mirrors.tds.net/pub/opensuse/distribution/12.3/iso/openSUSE-12.3-DVD-x86_64.iso"
}
diff --git a/src/distros.d/ubuntu.json b/src/distros.d/ubuntu.json
index 4ad6a19..fbd931a 100644
--- a/src/distros.d/ubuntu.json
+++ b/src/distros.d/ubuntu.json
@@ -2,12 +2,14 @@
{
"name": "Ubuntu 13.04 (Raring Ringtail)",
"os_distro": "ubuntu",
+ "os_arch": "x86_64",
"os_version": "13.04",
"path": "http://ubuntu-releases.cs.umn.edu/13.04/ubuntu-13.04-desktop-amd64.iso"
},
{
"name": "Ubuntu 13.10 (Saucy Salamander)",
"os_distro": "ubuntu",
+ "os_arch": "x86_64",
"os_version": "13.10",
"path": "http://ubuntu-releases.cs.umn.edu/13.10/ubuntu-13.10-desktop-amd64.iso"
}
diff --git a/src/kimchi/distroloader.py b/src/kimchi/distroloader.py
index 98fd764..d8e76bf 100644
--- a/src/kimchi/distroloader.py
+++ b/src/kimchi/distroloader.py
@@ -51,9 +51,10 @@ class DistroLoader(object):
raise OperationFailed(msg)
def get(self):
+ arch = os.uname()[4]
all_json_files = glob.glob("%s/%s" % (self.location, "*.json"))
distros = []
for f in all_json_files:
distros.extend(self._get_json_info(f))
- return dict([(distro['name'], distro) for distro in distros])
+ return dict([(distro['name'], distro) for distro in distros if distro['os_arch'] == arch])
--
1.8.5.3
More information about the Kimchi-devel
mailing list