[packages/adapter: 261/631] - set order for other preamble tags

glen glen at pld-linux.org
Mon Sep 12 19:56:20 CEST 2016


commit c58d13578e2a50f6d51d16c4b33f7a41b9e750a8
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Mon Dec 26 22:57:00 2005 +0000

    - set order for other preamble tags
    
    Changed files:
        adapter.awk -> 1.251

 adapter.awk | 97 +++++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 55 insertions(+), 42 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index f707428..8459489 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -27,6 +27,8 @@ BEGIN {
 	RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun"
 	SECTIONS = "^%(" RPM_SECTIONS ")"
 
+	PREAMBLE_TAGS = "(Summary|Name|Version|Release|License|Group|URL|BuildArch|BuildRoot|Obsoletes|Provides|PreReq|(Build)?Requires)"
+
 	preamble = 1		# Is it part of preamble? Default - yes
 	boc = 4			# Beginning of %changelog
 	bod = 0			# Beginning of %description
@@ -108,51 +110,22 @@ function b_makekey(a, b,	s) {
 	# kill commented out items
     gsub(/[# \t]*/, "", s);
 
-	# hack: change Obsoletes -> ZObsoletes to sort as last
-    gsub(/^Provides/, "YProvides", s);
-    gsub(/^Obsoletes/, "ZObsoletes", s);
+	# force order
+    gsub(/^Summary/, "1Summary", s);
+    gsub(/^Name/, "2Name", s);
+    gsub(/^Version/, "3Version", s);
+    gsub(/^Release/, "4Release", s);
+    gsub(/^License/, "5License", s);
+    gsub(/^Group/, "6Group", s);
+    gsub(/^URL/, "7URL", s);
+
+    gsub(/^Provides/, "XProvides", s);
+    gsub(/^Obsoletes/, "YObsoletes", s);
+    gsub(/^BuildArch/, "ZBuildArch", s);
+    gsub(/^BuildRoot/, "ZBuildRoot", s);
 	return s;
 }
 
-# sort BR/R!
-#
-# NOTES:
-# - mixing BR/R and anything else confuses this (all will be sorted together)
-#   so don't do that.
-# - comments leading the BR/R can not be associated,
-#   so don't adapterize when the BR/R are mixed with comments
-ENVIRON["SKIP_SORTBR"] != 1 && preamble == 1 && /(Obsoletes|Provides|PreReq|(Build)?Requires)/, /(Obsoletes|Provides|PreReq|(Build)?Requires)/ {
-	if ($1 ~ /PreReq:/) {
-		sub(/PreReq:/, "Requires:", $1);
-	}
-	format_preamble()
-	kill_preamble_macros();
-
-	b_idx++;
-	l = substr($0, index($0, $2));
-	b_ktmp = b_makekey($1, l);
-	b_key[b_idx] = b_ktmp;
-	b_val[b_ktmp] = $0;
-
-	next;
-}
-
-/^%bcond_/ {
-	# do nothing
-	print
-	next
-}
-
-preamble == 1 {
-	if (b_idx > 0) {
-		isort(b_key, b_idx);
-		for (i = 1; i <= b_idx; i++) {
-			print "" b_val[b_key[i]];
-		}
-		b_idx = 0
-	}
-}
-
 # Comments
 /^#/ && (description == 0) {
 	if (/This file does not like to be adapterized!/) {
@@ -773,6 +746,46 @@ preamble == 1 {
 	}
 }
 
+
+# sort BR/R!
+#
+# NOTES:
+# - mixing BR/R and anything else confuses this (all will be sorted together)
+#   so don't do that.
+# - comments leading the BR/R can not be associated,
+#   so don't adapterize when the BR/R are mixed with comments
+ENVIRON["SKIP_SORTBR"] != 1 && preamble == 1 && $0 ~ PREAMBLE_TAGS, $0 ~ PREAMBLE_TAGS {
+	if ($1 ~ /PreReq:/) {
+		sub(/PreReq:/, "Requires:", $1);
+	}
+	format_preamble()
+	kill_preamble_macros();
+
+	b_idx++;
+	l = substr($0, index($0, $2));
+	b_ktmp = b_makekey($1, l);
+	b_key[b_idx] = b_ktmp;
+	b_val[b_ktmp] = $0;
+
+	next;
+}
+
+/^%bcond_/ {
+	# do nothing
+	print
+	next
+}
+
+preamble == 1 {
+	if (b_idx > 0) {
+		isort(b_key, b_idx);
+		for (i = 1; i <= b_idx; i++) {
+			print "" b_val[b_key[i]];
+		}
+		b_idx = 0
+	}
+}
+
 # main() ;-)
 {
 	preamble = 1
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885



More information about the pld-cvs-commit mailing list