pthbs_genpkgpy

Template engine for producing packages for pthbs written using Python and Jinja
git clone https://ccx.te2000.cz/git/pthbs_genpkgpy
Log | Files | Refs | README

commit 1476cc806c3387c103f35ed94ce24dcec1553d99
parent 39be9a95c27bd0d6498124d3fb1ede249c37f67b
Author: Jan Pobrislo <ccx@te2000.cz>
Date:   Tue,  4 Nov 2025 16:24:42 +0000

Allow addressing downloads by full URL

Diffstat:
Mgenpkg.py | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/genpkg.py b/genpkg.py @@ -58,6 +58,7 @@ class DownloadsInfo: def __init__(self, downloadlist_path): assert isinstance(downloadlist_path, Path) self._basenames = {} + self._urls = {} with downloadlist_path.open('rt') as f: for line in f: if line[0] in '#\n': @@ -65,6 +66,8 @@ class DownloadsInfo: sha256, size, url = line.rstrip().split(maxsplit=2) assert len(bytes.fromhex(sha256)) == 32 assert int(size) >= 0 + assert url not in self._urls + self._urls[url] = 'sha256:' + sha256 basename = os.path.basename(url) if basename in self._basenames: self._basenames[basename] = ValueError( @@ -74,7 +77,10 @@ class DownloadsInfo: self._basenames[basename] = 'sha256:' + sha256 def __getitem__(self, key): - value = self._basenames[key] + if '/' in key: + value = self._urls[key] + else: + value = self._basenames[key] if isinstance(value, Exception): raise value return value