]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - adapter.awk
- poldek -u works again
[packages/rpm-build-tools.git] / adapter.awk
index b17305839f009b3893a8fffe25161d2c210e10c0..36de9035bfeee3a2a60e7ef4d211bbecfb7fef8f 100644 (file)
@@ -31,6 +31,11 @@ BEGIN {
        removed["CFLAGS"] = 0
        removed["CXXFLAGS"] = 0
 
+       # get cvsaddress for changelog section
+       # using rpm macros as too lazy to add ~/.adapterrc parsing support.
+       "rpm --eval '%{?_cvsmaildomain}%{!?_cvsmaildomain:@pld-linux.org}'" | getline _cvsmaildomain
+       "rpm --eval '%{?_cvsmailfeedback}%{!?_cvsmailfeedback:PLD Team <feedback@pld-linux.org>}'" | getline _cvsmailfeedback
+
        # If 1, we are inside of comment block (started with /^#%/)
        comment_block = 0
 
@@ -99,7 +104,8 @@ function b_makekey(a, b,     s) {
 #   so don't adapterize when the BR/R are mixed with comments
 ENVIRON["SORTBR"] == 1 && preamble == 1 && /(Build)?Requires/, /(Build)?Requires/ { # && !/^%/) {
        b_idx++;
-       b_ktmp = b_makekey($1, $2);
+       l = substr($0, index($0, $2));
+       b_ktmp = b_makekey($1, l);
        b_key[b_idx] = b_ktmp;
        b_val[b_ktmp] = $0;
 
@@ -210,6 +216,15 @@ preamble == 1 {
        if (/^%setup/) {
                gsub(name, "%{name}");
                gsub(version, "%{version}");
+               if (_beta) {
+                       gsub(_beta, "%{_beta}");
+               }
+               if (_rc) {
+                       gsub(_rc, "%{_rc}");
+               }
+               if (_snap) {
+                       gsub(_snap, "%{_snap}");
+               }
        }
 
        if (/^%setup/ && /-n %{name}-%{version}( |$)/) {
@@ -357,8 +372,8 @@ preamble == 1 {
        skip = 0
        # There should be some CVS keywords on the first line of %changelog.
        if (boc == 3) {
-               if (!/PLD Team/)
-                       print "* %{date} PLD Team <feedback@pld-linux.org>" > changelog_file
+               if ($0 !~ _cvsmailfeedback)
+                       print "* %{date} " _cvsmailfeedback > changelog_file
                else
                        skip = 1
                boc = 2
@@ -366,7 +381,7 @@ preamble == 1 {
        if (boc == 2 && !skip) {
                if (!/All persons listed below/) {
                        printf "All persons listed below can be reached at " > changelog_file
-                       print "<cvs_login>@pld-linux.org\n" > changelog_file
+                       print "<cvs_login>" _cvsmaildomain "\n" > changelog_file
                } else
                        skip = 1
                boc = 1
@@ -401,7 +416,15 @@ preamble == 1 {
 ###########
 /^%pre/, (/^%[a-z]+$/ && !/^%pre/) {
        preamble = 0
+
+       # %useradd and %groupadd may not be wrapped
+       if (/%(useradd|groupadd).*\\$/) {
+               a = $0; getline;
+               sub(/^[\s\t]*/, "");
+               $0 = substr(a, 1, length(a) - 1) $0;
+       }
 }
+
 /^%post/, (/^%[a-z]+$/ && !/^%post/) {
        preamble = 0
 }
@@ -489,7 +512,7 @@ preamble == 1 {
        }
 
        # split (build)requires on commas
-       if (field ~ /requires:/ && $2 ~ /,/) {
+       if (field ~ /requires:/ && $0 ~ /,/) {
                l = substr($0, index($0, $2));
                n = split(l, p, / *, */);
                for (i in p) {
@@ -597,6 +620,7 @@ preamble == 1 {
 
                sub("^http://.*\.dl\.sourceforge\.net/", "http://dl.sourceforge.net/", $2)
                sub("^http://dl\.sourceforge\.net/sourceforge/", "http://dl.sourceforge.net/", $2)
+               sub("^http://dl\.sf\.net/", "http://dl.sourceforge.net/", $2)
        }
 
 
@@ -837,12 +861,16 @@ function use_macros()
 
        gsub("^make$", "%{__make}")
        gsub("^make ", "%{__make} ")
+       gsub("^gcc ", "%{__cc} ")
 
        # mandrake specs
        gsub("^%make$", "%{__make}")
        gsub("^%make ", "%{__make} ")
        gsub("^%makeinstall_std", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
+       gsub("^%{makeinstall}", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT")
        gsub("^%{__rm} -rf %{buildroot}", "rm -rf $RPM_BUILD_ROOT")
+       gsub("^%{__install}", "install")
+       gsub("^%{__rm}", "rm")
        gsub("%optflags", "%{rpmcflags}")
        gsub("%{compat_perl_vendorarch}", "%{perl_vendorarch}")
 
This page took 0.032096 seconds and 4 git commands to generate.