Update python-productmd to 1.3-1
This commit is contained in:
parent
12e405b06b
commit
5933d1fc6a
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
/productmd-1.0.tar.gz
|
||||
/productmd-1.1.tar.gz
|
||||
/productmd-1.2.tar.bz2
|
||||
/python-productmd-1.3.tar.gz
|
||||
|
@ -1,75 +0,0 @@
|
||||
From c01b76db26893f8257c17dcff838005625adc529 Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Gilmore <dennis@ausil.us>
|
||||
Date: Thu, 18 Feb 2016 19:50:52 -0600
|
||||
Subject: [PATCH] update the other two _validate_version functions to allow for
|
||||
Rawhide to be valid
|
||||
|
||||
Fix up the tests
|
||||
|
||||
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
|
||||
---
|
||||
productmd/common.py | 3 ++-
|
||||
productmd/treeinfo.py | 3 ++-
|
||||
tests/test_header.py | 10 +++++-----
|
||||
3 files changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/productmd/common.py b/productmd/common.py
|
||||
index 3447c05..b23d71f 100644
|
||||
--- a/productmd/common.py
|
||||
+++ b/productmd/common.py
|
||||
@@ -195,7 +195,8 @@ class Header(MetadataBase):
|
||||
|
||||
def _validate_version(self):
|
||||
self._assert_type("version", six.string_types)
|
||||
- self._assert_matches_re("version", [r"^\d+\.\d+$"])
|
||||
+ if re.match('^\d', self.version):
|
||||
+ self._assert_matches_re("version", [r"^\d+(\.\d+)*$"])
|
||||
|
||||
@property
|
||||
def version_tuple(self):
|
||||
diff --git a/productmd/treeinfo.py b/productmd/treeinfo.py
|
||||
index a14305e..67f5ed9 100644
|
||||
--- a/productmd/treeinfo.py
|
||||
+++ b/productmd/treeinfo.py
|
||||
@@ -166,7 +166,8 @@ class BaseProduct(productmd.common.MetadataBase):
|
||||
|
||||
def _validate_version(self):
|
||||
self._assert_type("version", list(six.string_types))
|
||||
- self._assert_matches_re("version", [r"^\d+(\.\d+)*$"])
|
||||
+ if re.match('^\d', self.version):
|
||||
+ self._assert_matches_re("version", [r"^\d+(\.\d+)*$"])
|
||||
|
||||
def _validate_short(self):
|
||||
self._assert_type("short", list(six.string_types))
|
||||
diff --git a/tests/test_header.py b/tests/test_header.py
|
||||
index 206307a..5c18dcf 100755
|
||||
--- a/tests/test_header.py
|
||||
+++ b/tests/test_header.py
|
||||
@@ -40,19 +40,19 @@ class TestHeader(unittest.TestCase):
|
||||
self.assertRaises(TypeError, hdr.validate)
|
||||
|
||||
# invalid version
|
||||
- hdr.version = "first"
|
||||
- self.assertRaises(ValueError, hdr.validate)
|
||||
-
|
||||
hdr.version = "1.alpha2"
|
||||
self.assertRaises(ValueError, hdr.validate)
|
||||
|
||||
+ # valid version
|
||||
hdr.version = "1"
|
||||
- self.assertRaises(ValueError, hdr.validate)
|
||||
+ hdr.validate()
|
||||
|
||||
- # valid version
|
||||
hdr.version = "1.22"
|
||||
hdr.validate()
|
||||
|
||||
+ hdr.version = "first"
|
||||
+ hdr.validate()
|
||||
+
|
||||
def test_deserialize(self):
|
||||
hdr = Header(None)
|
||||
data = {
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,126 +0,0 @@
|
||||
From e0e360766b8e3882f7a947ba00c82ae59f392d80 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Sun, 28 Feb 2016 12:48:42 -0800
|
||||
Subject: [PATCH] add 'subvariant' property to images
|
||||
|
||||
This is to solve a problem we have with the Fedora composes.
|
||||
There are 'Spins' and 'Labs' variants which produce several
|
||||
live images and ARM appliances with differing content. With the
|
||||
current metadata, there is no good way to tell the KDE live
|
||||
image from the Xfce or LXDE live images; the only property
|
||||
which indicates this is the 'path', but that has lots of other
|
||||
information in it and is not trivially parseable (as image
|
||||
names don't really strictly follow the naming policy you
|
||||
cannot strictly tell what element of the image file name is
|
||||
the 'subvariant').
|
||||
|
||||
Thus we add a 'subvariant' property which Pungi will populate as
|
||||
appropriate. For many images the 'subvariant' will be the variant,
|
||||
but for Spins and Labs it will indicate the actual content of
|
||||
each image.
|
||||
|
||||
The image metadata version should probably change with this,
|
||||
but I couldn't see the right way to do that (surely I don't
|
||||
just universally bump it to 1, 1 in common.py?) Pungi will
|
||||
also need a few corresponding changes, I will send a Pagure
|
||||
PR for those.
|
||||
---
|
||||
doc/images-1.0.rst | 1 +
|
||||
productmd/images.py | 7 +++++++
|
||||
tests/test_images.py | 12 +++++++-----
|
||||
3 files changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/doc/images-1.0.rst b/doc/images-1.0.rst
|
||||
index fa04ad3..6ac36b7 100644
|
||||
--- a/doc/images-1.0.rst
|
||||
+++ b/doc/images-1.0.rst
|
||||
@@ -40,6 +40,7 @@ in order to read and diff images.json files easily.
|
||||
"implant_md5": <str|null>, # md5 checksum implanted directly on media (see implantisomd5 and checkisomd5 commands)
|
||||
"mtime": <int>, # mtime of the image stored as a decimal unix timestamp
|
||||
"path": <str>, # relative path to the image
|
||||
+ "subvariant": <str>, # image content (e.g. 'Workstation' or 'KDE')
|
||||
"size": <int>, # file size of the image
|
||||
"type": <str>, # see productmd.images.SUPPORTED_IMAGE_TYPES
|
||||
"volume_id": <str|null> # volume ID; null if not available/applicable
|
||||
diff --git a/productmd/images.py b/productmd/images.py
|
||||
index ca8fbd4..df825bb 100644
|
||||
--- a/productmd/images.py
|
||||
+++ b/productmd/images.py
|
||||
@@ -119,6 +119,7 @@ def __init__(self, parent):
|
||||
self.checksums = {} #: (*str*) -- Release name, for example: "Fedora", "Red Hat Enterprise Linux"
|
||||
self.implant_md5 = None #: (*str* or *None*) -- value of implanted md5
|
||||
self.bootable = False #: (*bool=False*) --
|
||||
+ self.subvariant = None #: (*str*) -- image contents, may be same as variant or e.g. 'KDE', 'LXDE'
|
||||
|
||||
def _validate_path(self):
|
||||
self._assert_type("path", list(six.string_types))
|
||||
@@ -166,6 +167,10 @@ def _validate_implant_md5(self):
|
||||
def _validate_bootable(self):
|
||||
self._assert_type("bootable", [bool])
|
||||
|
||||
+ def _validate_subvariant(self):
|
||||
+ self._assert_type("subvariant", list(six.string_types))
|
||||
+ self._assert_not_blank("subvariant")
|
||||
+
|
||||
def serialize(self, parser):
|
||||
data = parser
|
||||
self.validate()
|
||||
@@ -182,6 +187,7 @@ def serialize(self, parser):
|
||||
"checksums": self.checksums,
|
||||
"implant_md5": self.implant_md5,
|
||||
"bootable": self.bootable,
|
||||
+ "subvariant": self.subvariant,
|
||||
}
|
||||
data.append(result)
|
||||
|
||||
@@ -198,6 +204,7 @@ def deserialize(self, data):
|
||||
self.checksums = data["checksums"]
|
||||
self.implant_md5 = data["implant_md5"]
|
||||
self.bootable = bool(data["bootable"])
|
||||
+ self.subvariant = data["subvariant"]
|
||||
self.validate()
|
||||
|
||||
def add_checksum(self, root, checksum_type, checksum_value):
|
||||
diff --git a/tests/test_images.py b/tests/test_images.py
|
||||
index 614ab21..603297f 100755
|
||||
--- a/tests/test_images.py
|
||||
+++ b/tests/test_images.py
|
||||
@@ -72,7 +72,7 @@ def test_fedora_20(self):
|
||||
im.compose.respin = 0
|
||||
|
||||
i = Image(im)
|
||||
- i.path = "Fedora/x86_64/iso/Fedora-20-x86_64-DVD.iso"
|
||||
+ i.path = "Fedora/x86_64/iso/Fedora-Server-dvd-x86_64-20.iso"
|
||||
i.mtime = 1410855216
|
||||
i.size = 4603248640
|
||||
i.arch = "x86_64"
|
||||
@@ -80,7 +80,8 @@ def test_fedora_20(self):
|
||||
i.format = "iso"
|
||||
i.disc_number = 1
|
||||
i.disc_count = 1
|
||||
- i.volume_id = "Fedora 20 x86_64"
|
||||
+ i.volume_id = "Fedora-S-dvd-x86_64-20"
|
||||
+ i.subvariant = "Server"
|
||||
|
||||
# checksums
|
||||
i.add_checksum(root=None, checksum_type="sha256", checksum_value="f2eeed5102b8890e9e6f4b9053717fe73031e699c4b76dc7028749ab66e7f917")
|
||||
@@ -98,15 +99,16 @@ def test_fedora_20(self):
|
||||
im.add("Fedora", "x86_64", i)
|
||||
|
||||
i = Image(im)
|
||||
- i.path = "Fedora/x86_64/iso/Fedora-20-x86_64-netinst.iso"
|
||||
+ i.path = "Fedora/x86_64/iso/Fedora-Server-boot-x86_64-20.iso"
|
||||
i.mtime = 1410855243
|
||||
i.size = 336592896
|
||||
i.arch = "x86_64"
|
||||
- i.type = "netinst"
|
||||
+ i.type = "boot"
|
||||
i.format = "iso"
|
||||
i.disc_number = 1
|
||||
i.disc_count = 1
|
||||
- i.volume_id = "Fedora 20 x86_64"
|
||||
+ i.volume_id = "Fedora-S-boot-x86_64-20"
|
||||
+ i.subvariant = "Server"
|
||||
|
||||
# checksums
|
||||
i.add_checksum(root=None, checksum_type="sha256", checksum_value="376be7d4855ad6281cb139430606a782fd6189dcb01d7b61448e915802cc350f")
|
@ -13,27 +13,38 @@
|
||||
%global with_python3 0
|
||||
%endif
|
||||
|
||||
# compatibility with older releases
|
||||
%{!?__python2: %global __python2 /usr/bin/python2}
|
||||
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
|
||||
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
|
||||
%{!?py2_build: %global py2_build %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} build --executable="%{__python2} -s"}}
|
||||
%{!?py2_install: %global py2_install %{expand: CFLAGS="%{optflags}" %{__python2} setup.py %{?py_setup_args} install -O1 --skip-build --root %{buildroot}}}
|
||||
|
||||
Name: python-productmd
|
||||
Version: 1.2
|
||||
Release: 2%{?dist}
|
||||
Version: 1.3
|
||||
Release: 1%{?dist}
|
||||
Summary: Library providing parsers for metadata related to OS installation
|
||||
|
||||
Group: Development/Tools
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/release-engineering/productmd
|
||||
Source0: https://files.pythonhosted.org/packages/source/p/productmd/productmd-%{version}.tar.bz2
|
||||
Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
|
||||
|
||||
Obsoletes: productmd <= %{version}-%{release}
|
||||
Provides: productmd = %{version}-%{release}
|
||||
Provides: python2-productmd = %{version}-%{release}
|
||||
|
||||
Requires: python-six
|
||||
|
||||
BuildRequires: python2-devel python-setuptools
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python-setuptools
|
||||
BuildRequires: python-six
|
||||
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python3-devel python3-setuptools
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
BuildRequires: python3-six
|
||||
%endif
|
||||
BuildRequires: python-six
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@ -53,44 +64,27 @@ and installation media.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -qc -n productmd-%{version}
|
||||
mv productmd-%{version} python2
|
||||
|
||||
cp -a python2 python3
|
||||
cp python2/LICENSE .
|
||||
cp python2/AUTHORS .
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
pushd python2
|
||||
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
|
||||
popd
|
||||
%py2_build
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd python3
|
||||
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
|
||||
popd
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
%install
|
||||
pushd python2
|
||||
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
||||
popd
|
||||
%py2_install
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd python3
|
||||
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
|
||||
popd
|
||||
%py3_install
|
||||
%endif
|
||||
|
||||
%check
|
||||
pushd python2
|
||||
%{__python2} ./setup.py test
|
||||
popd
|
||||
|
||||
%if 0%{?with_python3}
|
||||
pushd python3
|
||||
%{__python3} ./setup.py test
|
||||
popd
|
||||
%endif
|
||||
|
||||
%files
|
||||
@ -109,6 +103,9 @@ popd
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Nov 23 2016 Lubomír Sedlář <lsedlar@redhat.com> 1.3-1
|
||||
- new package built with tito
|
||||
|
||||
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-2
|
||||
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user