From 6af21c0cbca1fbbf6c3e0ba08aebb21c6d00fed7 Mon Sep 17 00:00:00 2001 From: John-Eric Kamps Date: Thu, 27 Jan 2022 21:20:54 +0100 Subject: [PATCH 1/3] Add support for all development files Signed-off-by: John-Eric Kamps --- releases.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/releases.py b/releases.py index 8dd8abe..ea4e44d 100755 --- a/releases.py +++ b/releases.py @@ -46,7 +46,8 @@ PRETTYNAME = '^%s-.*-([0-9]+\.[0-9]+\.[0-9]+)' % DISTRO_NAME -PRETTYNAME_NIGHTLY = '^LibreELEC-.*-([0-9]+\.[0-9]+\-.*-[0-9]{8}-[0-9a-z]{7})' % DISTRO_NAME +# For DEVEL(14 numbers), NIGHTLY(8 numbers), DAILY (7 numbers), WEEKLY (6 numbers), MONTHLY (6 numbers) builds +PRETTYNAME_DEVELOPMENT_BUILDS = '^%s-.*-([0-9]+\.[0-9]+\-.*\-[0-9]{6,14}-[0-9a-z]{7})' % DISTRO_NAME class ChunkedHash(): # Calculate hash for chunked data @@ -102,7 +103,7 @@ def __init__(self, args): self._regex_xyz_custom_sort = re.compile(r'([0-9]+)\.([0-9]+)\.([0-9]+)') self._regex_xydate_custom_sort = re.compile(r'([0-9]+)\.([0-9]+)-.*-([0-9]{14})-') - self._regex_xydate_custom_short_sort = re.compile(r'([0-9]+)\.([0-9]+)-.*-([0-9]{8})-') + self._regex_xydate_custom_short_sort = re.compile(r'([0-9]+)\.([0-9]+)-.*-([0-9]{6,8})-') self._regex_builds = re.compile(r'%s-([^-]*)-.*' % DISTRO_NAME) self.display_name = {'A64.arm': 'Allwinner A64', From 506b3db1e51cd9b95bfffb0b68fbedb269734091 Mon Sep 17 00:00:00 2001 From: John-Eric Kamps Date: Thu, 27 Jan 2022 21:21:55 +0100 Subject: [PATCH 2/3] Add argument "-d" to enable prettyname regex for development builds (devel, nightly, daily, weekly, monthly). No need to set them manually. Signed-off-by: John-Eric Kamps --- releases.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/releases.py b/releases.py index ea4e44d..898b087 100755 --- a/releases.py +++ b/releases.py @@ -93,7 +93,10 @@ def __init__(self, args): if args.prettyname: self._prettyname = args.prettyname else: - self._prettyname = PRETTYNAME + if args.dev_prettyname: + self._prettyname = PRETTYNAME_DEVELOPMENT_BUILDS + else: + self._prettyname = PRETTYNAME if not os.path.exists(self._indir): raise Exception('ERROR: %s is not a valid path' % self._indir) @@ -395,6 +398,9 @@ def WriteFile(self): parser.add_argument('-p', '--prettyname', metavar='REGEX', required=False, \ help='Optional prettyname regex, default is %s' % PRETTYNAME) +parser.add_argument('-d', '--dev_prettyname', action="store_true", required=False, \ + help=' Enable prettyname regex for development builds (devel, nightly, daily, weekly, monthly)') + parser.add_argument('-v', '--verbose', action="store_true", help='Enable verbose output (ignored files etc.)') args = parser.parse_args() From 429622c939d2d2c855c3f851a8f39a807eb78106 Mon Sep 17 00:00:00 2001 From: John-Eric Kamps Date: Thu, 27 Jan 2022 21:25:09 +0100 Subject: [PATCH 3/3] Add error exception message if the filename is not like expected. Signed-off-by: John-Eric Kamps --- releases.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/releases.py b/releases.py index 898b087..b00beb6 100755 --- a/releases.py +++ b/releases.py @@ -195,6 +195,9 @@ def custom_sort_release(self, a, b): if not a_maj_min_patch: a_maj_min_patch = self._regex_xydate_custom_short_sort.search(a) + if not a_maj_min_patch: + raise Exception('ERROR: Filename not like expected') + b_maj_min_patch = self._regex_xyz_custom_sort.search(b) if not b_maj_min_patch: b_maj_min_patch = self._regex_xydate_custom_sort.search(b) @@ -202,6 +205,9 @@ def custom_sort_release(self, a, b): if not b_maj_min_patch: b_maj_min_patch = self._regex_xydate_custom_short_sort.search(b) + if not b_maj_min_patch: + raise Exception('ERROR: Filename not like expected') + a_int = int('%04d%04d%014d' % (int(a_maj_min_patch.groups(0)[0]), int(a_maj_min_patch.groups(0)[1]), int(a_maj_min_patch.groups(0)[2]))) b_int = int('%04d%04d%014d' % (int(b_maj_min_patch.groups(0)[0]), int(b_maj_min_patch.groups(0)[1]), int(b_maj_min_patch.groups(0)[2])))