[packages/adapter: 631/631] simplify version check
glen
glen at pld-linux.org
Mon Sep 12 20:27:19 CEST 2016
commit 6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Mon Sep 12 20:29:44 2016 +0300
simplify version check
the revision is no longer needed, adapter.sh and adapter.awk can't be
updated separately in git like in cvs
adapter.awk | 11 +----------
adapter.sh | 7 ++-----
adapter.spec | 10 ++++++++--
3 files changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/adapter.spec b/adapter.spec
index 9b7b54f..174cf03 100644
--- a/adapter.spec
+++ b/adapter.spec
@@ -23,8 +23,14 @@ cp -p %{SOURCE0} %{SOURCE1} .
%{__sed} -i -e 's,^adapter=.*/adapter.awk,adapter=%{_libdir}/adapter.awk,' adapter.sh
-%{__sed} -i -e '/^VERSION=/s,\([^/]\+\)/.*",\1-RELEASE",' adapter.sh
-%{__sed} -i -e '/\tRCSID =/,/^\trev =/d;/\tVERSION = /s,\([^/]\+\)/.*,\1-RELEASE",' adapter.awk
+%build
+die() { echo >&2 "$*"; exit 1; }
+for f in adapter.sh adapter.awk; do
+ v=$(sed -rne 's/.*VERSION="([^"]+)".*/\1/p' $f)
+ if [ "$v" != "%{version}" ]; then
+ die "VERSION not %{version} in $f"
+ fi
+done
%install
rm -rf $RPM_BUILD_ROOT
diff --git a/adapter.awk b/adapter.awk
index b9561d4..7e26f90 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -33,8 +33,7 @@ BEGIN {
RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun|verifyscript|check"
SECTIONS = "^%(" RPM_SECTIONS ")"
- rev = "1.514"
- VERSION = "0.36/" rev
+ VERSION="1.514"
PREAMBLE_TAGS = "(R|BR|Summary|Name|Version|Release|Epoch|License|Group|URL|BuildArch|BuildRoot|Obsoletes|Conflicts|Provides|ExclusiveArch|ExcludeArch|Pre[Rr]eq|(Build)?Requires|Suggests|Auto(Req|Prov))"
@@ -1954,14 +1953,6 @@ function import_rpm_macros( v) {
exit(rc = 1)
}
- # update this version dep each time some new macro export is added
- v = 1.52
- if (!ENVIRON["ADAPTER_REVISION"] || ENVIRON["ADAPTER_REVISION"] < v) {
- printf("adapter shell script is outdated: Need %s, got %s. Please update it.\n", v, ENVIRON["ADAPTER_REVISION"]) > "/dev/stderr"
- do_not_touch_anything = 1
- exit(rc = 1)
- }
-
prefix = ENVIRON["_prefix"]
bindir = ENVIRON["_bindir"]
sbindir = ENVIRON["_sbindir"]
diff --git a/adapter.sh b/adapter.sh
index 2b1e987..6c08a11 100755
--- a/adapter.sh
+++ b/adapter.sh
@@ -12,11 +12,10 @@
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-REVISION=1.52
-VERSION="v0.35/$REVISION"
+VERSION="1.514"
VERSIONSTRING="\
Adapter adapts .spec files for PLD Linux.
-$VERSION (C) 1999-2013 Free Penguins".
+v$VERSION (C) 1999-2016 Free Penguins".
PROGRAM=${0##*/}
dir=$(d=$0; [ -L "$d" ] && d=$(readlink -f "$d"); dirname "$d")
@@ -247,8 +246,6 @@ import_rpm_macros() {
export _cvsmailfeedback='%{?_cvsmailfeedback}%{!?_cvsmailfeedback:PLD Team <feedback at pld-linux.org>}'
"
- export ADAPTER_REVISION=$REVISION
-
eval $(rpm --eval "$(echo -e $eval_expr)")
}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885
More information about the pld-cvs-commit
mailing list