[packages/adapter] capture %global macros, subst gh_owner, gh_project

glen glen at pld-linux.org
Sat May 6 22:17:25 CEST 2017


commit b2dd02da451d66f0f2dcf08f7404fe0218244d80
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat May 6 23:17:14 2017 +0300

    capture %global macros, subst gh_owner, gh_project

 adapter.awk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/adapter.awk b/adapter.awk
index 214f50f..a09532d 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -2,7 +2,7 @@
 #
 # Adapter adapts .spec files for PLD Linux.
 #
-# Copyright (C) 1999-2016 PLD-Team <feedback at pld-linux.org>
+# Copyright (C) 1999-2017 PLD-Team <feedback at pld-linux.org>
 # Authors:
 # 	Michał Kuratczyk <kura at pld.org.pl>
 # 	Sebastian Zagrodzki <s.zagrodzki at mimuw.edu.pl>
@@ -46,6 +46,9 @@ BEGIN {
 	b_idx = 0		# index of BR/R arrays
 	BR_count = 0	# number of additional BuildRequires
 
+	# %global defines
+	globals["nil"] = ""
+
 	# If variable removed, then 1 (for removing it from export)
 	removed["LDFLAGS"] = 0
 	removed["CFLAGS"] = 0
@@ -142,6 +145,11 @@ function b_makekey(a, b,	s) {
 	}
 }
 
+# load globals
+/^%global/ {
+	globals[$2] = $3;
+}
+
 /^%define/ {
 	# FIXME: this section will likely never match after cvs->git migration
 	if ($2 == "date") {
@@ -1871,6 +1879,13 @@ function demacroize(str)
 	if (subver) {
 		sub("%{subver}", subver, str)
 	}
+
+	if (globals["gh_owner"]) {
+		sub("%{gh_owner}", globals["gh_owner"], str)
+	}
+	if (globals["gh_project"]) {
+		sub("%{gh_project}", globals["gh_project"], str)
+	}
 	return str
 }
 
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list