From 977da53c5870eb72bfdf63beda5601ec3b4978c3 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 10 Jun 2020 07:39:27 +0200 Subject: acme2certifier: pkgver(): track *really* first appearance of version line in acme/version.py --- acme2certifier/PKGBUILD | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'acme2certifier/PKGBUILD') diff --git a/acme2certifier/PKGBUILD b/acme2certifier/PKGBUILD index be5e7b30..06a54f34 100644 --- a/acme2certifier/PKGBUILD +++ b/acme2certifier/PKGBUILD @@ -35,16 +35,26 @@ pkgver() { git -C "${pkgname}" rev-parse "${_trial}" 2>/dev/null ) && break done - _version_line=$( - git -C "${pkgname}" archive ${_commit} -- acme/version.py \ + + _line_revision="${_commit}" + while true; do + _version_line=$( + git -C "${pkgname}" archive "${_line_revision}" -- acme/version.py \ + | tar -Ox \ + | grep -n '^__version__\s*=' + ) + _line="${_version_line%%:*}" + _line_revision=$( + git -C "${pkgname}" blame -L"${_line},${_line}" "${_line_revision}" -- acme/version.py \ + | awk '{print $1}' + ) + if ! git -C "${pkgname}" archive "${_line_revision}^" -- acme/version.py \ | tar -Ox \ - | grep -n '^__version__\s*=' - ) - _line="${_version_line%%:*}" - _line_revision=$( - git -C "${pkgname}" blame -L"${_line},${_line}" "${_commit}" -- acme/version.py \ - | awk '{print $1}' - ) + | grep -qxF "${_version_line#*:}"; then + break + fi + _line_revision="${_line_revision}^" + done _version="${_version_line%\'*}" _version="${_version##*\'}" _version="${_version%-*}" -- cgit v1.2.3-70-g09d2