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 4d8a815b3af6813efbe995554b93b4ba3d1d4dc5
parent 26fa36f36e9f0d12e23d8827cedf303d7f998f4a
Author: Jan Pobrislo <ccx@te2000.cz>
Date:   Tue, 15 Apr 2025 00:26:32 +0000

use env var to determine whether we want commited or current head for submodules

Diffstat:
Mgenpkg.py | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/genpkg.py b/genpkg.py @@ -18,9 +18,17 @@ class SubmoduleInfo: def current(self): if self._current_commits is not None: return self._current_commits - out = subprocess.check_output( - ("git", "submodule", "status", "--cached") - ).decode('utf8') + source_type = os.environ.get('pthbs_genpkgpy_submodule_source', None) + if source_type == 'current': + cmd = ("git", "submodule", "status") + elif source_type == 'cached': + cmd = ("git", "submodule", "status", '--cached') + else: + raise RuntimeError( + 'Environment variable pthbs_genpkgpy_submodule_source' + ' must be set to either "current" or "cached"' + ) + out = subprocess.check_output(cmd).decode('utf8') lines = out.strip('\n').split('\n') records = [[line[0]] + line[1:].split() for line in lines] self._current_commits = {