add patch to allow us to use rawhide as the version
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
This commit is contained in:
parent
ca5fcbffbd
commit
edaff75a35
81
0001-Relax-version-validation.patch
Normal file
81
0001-Relax-version-validation.patch
Normal file
@ -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?= <lsedlar@redhat.com>
|
||||
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
|
||||
|
@ -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 <dennis@ausil.us> - 1.0-11
|
||||
- add patch 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user