From ca5fcbffbdbc5e0b3f2b09a199c2152d6c7b2b84 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 4 Feb 2016 20:32:09 +0000 Subject: [PATCH 1/6] - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild --- python-productmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-productmd.spec b/python-productmd.spec index 9cd82b0..8016439 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -15,7 +15,7 @@ Name: python-productmd Version: 1.0 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Library providing parsers for metadata related to OS installation Group: Development/Tools @@ -109,6 +109,9 @@ popd %endif %changelog +* Thu Feb 04 2016 Fedora Release Engineering - 1.0-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + * Tue Jan 26 2016 Dennis Gilmore - 1.0-10 - provide python2-productmd - remove defattr From edaff75a35baf9683a1a9acbe6e900b322935633 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 18 Feb 2016 14:35:07 -0600 Subject: [PATCH 2/6] add patch to allow us to use rawhide as the version Signed-off-by: Dennis Gilmore --- 0001-Relax-version-validation.patch | 81 +++++++++++++++++++++++++++++ python-productmd.spec | 8 ++- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 0001-Relax-version-validation.patch diff --git a/0001-Relax-version-validation.patch b/0001-Relax-version-validation.patch new file mode 100644 index 0000000..299c13a --- /dev/null +++ b/0001-Relax-version-validation.patch @@ -0,0 +1,81 @@ +From 3abc0e781f69872c199f8078fd9ec165650be8b3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= +Date: Tue, 2 Feb 2016 13:18:12 +0100 +Subject: [PATCH] Relax version validation + +Check the format only if version starts with a digit. This allows having +non-numeric versions such as Rawhide. + +Fixes #11 +--- + doc/terminology.rst | 6 ++++++ + productmd/composeinfo.py | 6 +++++- + tests/test_composeinfo.py | 10 +++++++++- + 3 files changed, 20 insertions(+), 2 deletions(-) + +diff --git a/doc/terminology.rst b/doc/terminology.rst +index 785693b..a98f1da 100644 +--- a/doc/terminology.rst ++++ b/doc/terminology.rst +@@ -108,6 +108,12 @@ Recommended schema is dot separated numbers: + * **X.Y.Z** -- bugfix version / hotfix version + + ++.. note :: ++ It is technically possible to use arbitrary string as a version, but this ++ is highly discouraged as it does not allow sorting. If you need it, just ++ start your version with any non-digit character. ++ ++ + .. _Milestones: + + ========== +diff --git a/productmd/composeinfo.py b/productmd/composeinfo.py +index bb6c757..aece4a0 100644 +--- a/productmd/composeinfo.py ++++ b/productmd/composeinfo.py +@@ -374,8 +374,12 @@ class BaseProduct(productmd.common.MetadataBase): + self._assert_type("name", list(six.string_types)) + + def _validate_version(self): ++ """If the version starts with a digit, it must be a sematic-versioning ++ style string. ++ """ + 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_composeinfo.py b/tests/test_composeinfo.py +index e24984d..79cad82 100755 +--- a/tests/test_composeinfo.py ++++ b/tests/test_composeinfo.py +@@ -29,7 +29,7 @@ import shutil + DIR = os.path.dirname(__file__) + sys.path.insert(0, os.path.join(DIR, "..")) + +-from productmd.composeinfo import ComposeInfo, Variant ++from productmd.composeinfo import ComposeInfo, Variant, Release + + + class TestComposeInfo(unittest.TestCase): +@@ -117,6 +117,14 @@ class TestComposeInfo(unittest.TestCase): + ci.compose.label = "GA" + self.assertRaises(ValueError, ci.dump, self.ci_path) + ++ def test_release_non_numeric_version(self): ++ r = Release(None) ++ r.name = "Fedora" ++ r.short = "f" ++ r.version = "Rawhide" ++ ++ r.validate() ++ + + if __name__ == "__main__": + unittest.main() +-- +2.5.0 + diff --git a/python-productmd.spec b/python-productmd.spec index 8016439..565a222 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -15,13 +15,14 @@ Name: python-productmd Version: 1.0 -Release: 10%{?dist} +Release: 11%{?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 +Patch0: 0001-Relax-version-validation.patch Obsoletes: productmd <= %{version}-%{release} Provides: productmd = %{version}-%{release} @@ -54,6 +55,8 @@ and installation media. %prep %setup -qc -n productmd-%{version} +%patch0 -p1 + mv productmd-%{version} python2 cp -a python2 python3 @@ -109,6 +112,9 @@ popd %endif %changelog +* Thu Feb 18 2016 Dennis Gilmore - 1.0-11 +- add patch to allow us to use rawhide as the version + * Thu Feb 04 2016 Fedora Release Engineering - 1.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild From ea44d502eb7cf673c1385b26c75a133cc2518bc9 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 18 Feb 2016 14:42:44 -0600 Subject: [PATCH 3/6] just update to a git snapshot Signed-off-by: Dennis Gilmore --- 0001-Relax-version-validation.patch | 81 ----------------------------- python-productmd.spec | 3 +- sources | 2 +- 3 files changed, 2 insertions(+), 84 deletions(-) delete mode 100644 0001-Relax-version-validation.patch diff --git a/0001-Relax-version-validation.patch b/0001-Relax-version-validation.patch deleted file mode 100644 index 299c13a..0000000 --- a/0001-Relax-version-validation.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 3abc0e781f69872c199f8078fd9ec165650be8b3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= -Date: Tue, 2 Feb 2016 13:18:12 +0100 -Subject: [PATCH] Relax version validation - -Check the format only if version starts with a digit. This allows having -non-numeric versions such as Rawhide. - -Fixes #11 ---- - doc/terminology.rst | 6 ++++++ - productmd/composeinfo.py | 6 +++++- - tests/test_composeinfo.py | 10 +++++++++- - 3 files changed, 20 insertions(+), 2 deletions(-) - -diff --git a/doc/terminology.rst b/doc/terminology.rst -index 785693b..a98f1da 100644 ---- a/doc/terminology.rst -+++ b/doc/terminology.rst -@@ -108,6 +108,12 @@ Recommended schema is dot separated numbers: - * **X.Y.Z** -- bugfix version / hotfix version - - -+.. note :: -+ It is technically possible to use arbitrary string as a version, but this -+ is highly discouraged as it does not allow sorting. If you need it, just -+ start your version with any non-digit character. -+ -+ - .. _Milestones: - - ========== -diff --git a/productmd/composeinfo.py b/productmd/composeinfo.py -index bb6c757..aece4a0 100644 ---- a/productmd/composeinfo.py -+++ b/productmd/composeinfo.py -@@ -374,8 +374,12 @@ class BaseProduct(productmd.common.MetadataBase): - self._assert_type("name", list(six.string_types)) - - def _validate_version(self): -+ """If the version starts with a digit, it must be a sematic-versioning -+ style string. -+ """ - 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_composeinfo.py b/tests/test_composeinfo.py -index e24984d..79cad82 100755 ---- a/tests/test_composeinfo.py -+++ b/tests/test_composeinfo.py -@@ -29,7 +29,7 @@ import shutil - DIR = os.path.dirname(__file__) - sys.path.insert(0, os.path.join(DIR, "..")) - --from productmd.composeinfo import ComposeInfo, Variant -+from productmd.composeinfo import ComposeInfo, Variant, Release - - - class TestComposeInfo(unittest.TestCase): -@@ -117,6 +117,14 @@ class TestComposeInfo(unittest.TestCase): - ci.compose.label = "GA" - self.assertRaises(ValueError, ci.dump, self.ci_path) - -+ def test_release_non_numeric_version(self): -+ r = Release(None) -+ r.name = "Fedora" -+ r.short = "f" -+ r.version = "Rawhide" -+ -+ r.validate() -+ - - if __name__ == "__main__": - unittest.main() --- -2.5.0 - diff --git a/python-productmd.spec b/python-productmd.spec index 565a222..76d83cb 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -22,7 +22,6 @@ Group: Development/Tools License: LGPLv2+ URL: https://github.com/release-engineering/productmd Source0: productmd-%{version}.tar.gz -Patch0: 0001-Relax-version-validation.patch Obsoletes: productmd <= %{version}-%{release} Provides: productmd = %{version}-%{release} @@ -113,7 +112,7 @@ popd %changelog * Thu Feb 18 2016 Dennis Gilmore - 1.0-11 -- add patch to allow us to use rawhide as the version +- update from git to allow us to use rawhide as the version * Thu Feb 04 2016 Fedora Release Engineering - 1.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 92b88ea..afa2bdd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e46907ebeb70c2d96f4c2beca5f65850 productmd-1.0.tar.gz +5e0c776551ebca6aeb89f233ca290a19 productmd-1.0.tar.bz2 From 7c82aaacf8c04b92ff1a39703fd3685bc39d1faa Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 18 Feb 2016 14:46:44 -0600 Subject: [PATCH 4/6] cleanups Signed-off-by: Dennis Gilmore --- python-productmd.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python-productmd.spec b/python-productmd.spec index 76d83cb..e45f554 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -21,7 +21,7 @@ Summary: Library providing parsers for metadata related to OS installatio Group: Development/Tools License: LGPLv2+ URL: https://github.com/release-engineering/productmd -Source0: productmd-%{version}.tar.gz +Source0: productmd-%{version}.tar.bz2 Obsoletes: productmd <= %{version}-%{release} Provides: productmd = %{version}-%{release} @@ -54,7 +54,6 @@ and installation media. %prep %setup -qc -n productmd-%{version} -%patch0 -p1 mv productmd-%{version} python2 From aa6d06094c160bbd101e21c881c53c2b915bbd6c Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 18 Feb 2016 20:02:42 -0600 Subject: [PATCH 5/6] add a patch to make rawhide as a version consistently an option Signed-off-by: Dennis Gilmore --- ...-two-_validate_version-functions-to-.patch | 43 +++++++++++++++++++ python-productmd.spec | 8 +++- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 0001-update-the-other-two-_validate_version-functions-to-.patch diff --git a/0001-update-the-other-two-_validate_version-functions-to-.patch b/0001-update-the-other-two-_validate_version-functions-to-.patch new file mode 100644 index 0000000..7241e0c --- /dev/null +++ b/0001-update-the-other-two-_validate_version-functions-to-.patch @@ -0,0 +1,43 @@ +From e28a89916a484e05ccc77bc603e61ecf892d1055 Mon Sep 17 00:00:00 2001 +From: Dennis Gilmore +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 + +Signed-off-by: Dennis Gilmore +--- + productmd/common.py | 3 ++- + productmd/treeinfo.py | 3 ++- + 2 files changed, 4 insertions(+), 2 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)) +-- +2.5.0 + diff --git a/python-productmd.spec b/python-productmd.spec index e45f554..f78e4b1 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -15,13 +15,14 @@ Name: python-productmd Version: 1.0 -Release: 11%{?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.bz2 +Patch0: 0001-update-the-other-two-_validate_version-functions-to-.patch Obsoletes: productmd <= %{version}-%{release} Provides: productmd = %{version}-%{release} @@ -54,7 +55,7 @@ and installation media. %prep %setup -qc -n productmd-%{version} - +%patch0 -p1 mv productmd-%{version} python2 cp -a python2 python3 @@ -110,6 +111,9 @@ popd %endif %changelog +* Thu Feb 18 2016 Dennis Gilmore - 1.0-12 +- add a patch to make rawhide as a version consistently an option + * Thu Feb 18 2016 Dennis Gilmore - 1.0-11 - update from git to allow us to use rawhide as the version From d8f514fdb47aca2bbe4735eaebd68f0fc2826e5d Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Thu, 18 Feb 2016 20:28:29 -0600 Subject: [PATCH 6/6] fix up the patch soe tests pass Signed-off-by: Dennis Gilmore --- ...-two-_validate_version-functions-to-.patch | 40 +++++++++++++++++-- python-productmd.spec | 2 + 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/0001-update-the-other-two-_validate_version-functions-to-.patch b/0001-update-the-other-two-_validate_version-functions-to-.patch index 7241e0c..87fd570 100644 --- a/0001-update-the-other-two-_validate_version-functions-to-.patch +++ b/0001-update-the-other-two-_validate_version-functions-to-.patch @@ -1,14 +1,17 @@ -From e28a89916a484e05ccc77bc603e61ecf892d1055 Mon Sep 17 00:00:00 2001 +From c01b76db26893f8257c17dcff838005625adc529 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore 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 --- - productmd/common.py | 3 ++- - productmd/treeinfo.py | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) + 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 @@ -38,6 +41,35 @@ index a14305e..67f5ed9 100644 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 diff --git a/python-productmd.spec b/python-productmd.spec index f78e4b1..04695d9 100644 --- a/python-productmd.spec +++ b/python-productmd.spec @@ -55,7 +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