]> git.pld-linux.org Git - packages/adapter.git/commitdiff
capture %global macros, subst gh_owner, gh_project
authorElan Ruusamäe <glen@delfi.ee>
Sat, 6 May 2017 20:17:14 +0000 (23:17 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Sat, 6 May 2017 20:17:14 +0000 (23:17 +0300)
adapter.awk

index 214f50ff4010c2e259575e786afff042e38b7bd0..a09532d6603b7a453dcc3db80994581da106706c 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Adapter adapts .spec files for PLD Linux.
 #
-# Copyright (C) 1999-2016 PLD-Team <feedback@pld-linux.org>
+# Copyright (C) 1999-2017 PLD-Team <feedback@pld-linux.org>
 # Authors:
 #      Michał Kuratczyk <kura@pld.org.pl>
 #      Sebastian Zagrodzki <s.zagrodzki@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
 }
 
This page took 0.129364 seconds and 4 git commands to generate.