Merge branch 'master' into el6

This commit is contained in:
Dennis Gilmore 2016-02-23 13:10:58 -06:00
commit 96f6a0700c
3 changed files with 91 additions and 3 deletions

View File

@ -0,0 +1,75 @@
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

View File

@ -15,13 +15,14 @@
Name: python-productmd
Version: 1.0
Release: 9%{?dist}
Release: 12%{?dist}
Summary: Library providing parsers for metadata related to OS installation
Group: Development/Tools
License: LGPLv2+
URL: https://github.com/release-engineering/productmd
Source0: productmd-%{version}.tar.gz
Source0: productmd-%{version}.tar.bz2
Patch0: 0001-update-the-other-two-_validate_version-functions-to-.patch
Obsoletes: productmd <= %{version}-%{release}
Provides: productmd = %{version}-%{release}
@ -54,6 +55,9 @@ and installation media.
%prep
%setup -qc -n productmd-%{version}
pushd productmd-%{version}
%patch0 -p1
popd
mv productmd-%{version} python2
cp -a python2 python3
@ -109,6 +113,15 @@ popd
%endif
%changelog
* Thu Feb 18 2016 Dennis Gilmore <dennis@ausil.us> - 1.0-12
- add a patch to make rawhide as a version consistently an option
* Thu Feb 18 2016 Dennis Gilmore <dennis@ausil.us> - 1.0-11
- update from git to allow us to use rawhide as the version
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Jan 26 2016 Dennis Gilmore <dennis@ausil.us> - 1.0-10
- provide python2-productmd
- remove defattr

View File

@ -1 +1 @@
e46907ebeb70c2d96f4c2beca5f65850 productmd-1.0.tar.gz
5e0c776551ebca6aeb89f233ca290a19 productmd-1.0.tar.bz2