]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
- fixed problem with substitutions:
authorSebastian Zagrodzki <sebek@zagrodzki.net>
Mon, 7 Aug 2000 13:27:53 +0000 (13:27 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
.zip -> .%{name} (zip.spec)
.tar.gz -> .%{name}.gz (tar.spec)
.patch -> .%{name} (patch.spec)
- fixed problem with regexps in filenames - (try to use fixedsub() where
  possible)

Changed files:
    adapter.awk -> 1.69

adapter.awk

index cbc094b97ff05c098f429ae1bb1f375c10676bed..5b71a173f7c83153374786737a44a48881f5e7d2 100644 (file)
@@ -329,10 +329,31 @@ preamble == 1 {
        # Use %{name} and %{version} in the filenames in "Source:"
        if (field ~ /source/ || field ~ /patch/) {
                n = split($2, url, /\//)
+               if (url[n] ~ /\.gz$/) {
+                       url[n+1] = ".gz" url[n+1]
+                       sub(/\.gz$/,"",url[n])
+               }
+               if (url[n] ~ /\.zip$/) {
+                       url[n+1] = ".zip" url[n+1]
+                       sub(/\.zip$/,"",url[n])
+               }
+               if (url[n] ~ /\.tar$/) {
+                       url[n+1] = ".tar" url[n+1]
+                       sub(/\.tar$/,"",url[n])
+               }
+               if (url[n] ~ /\.patch$/) {
+                       url[n+1] = ".patch" url[n+1]
+                       sub(/\.patch$/,"",url[n])
+               }
+               if (url[n] ~ /\.bz2$/) {
+                       url[n+1] = ".bz2" url[n+1]
+                       sub(/\.bz2$/,"",url[n])
+               }
                filename = url[n]
-               sub(name, "%{name}", url[n])
-               if (field ~ /source/) sub(version, "%{version}", url[n])
-               sub(filename, url[n], $2)
+               url[n] = fixedsub(name, "%{name}", url[n])
+               if (field ~ /source/) 
+                       url[n] = fixedsub(version, "%{version}", url[n])
+               $2 = fixedsub(filename, url[n], $2)
        }
 
        if (field ~ /source:/)
@@ -410,6 +431,13 @@ END {
        }
 }
 
+function fixedsub(s1,s2,t,      ind) {
+# substitutes fixed strings (not regexps)
+        if (ind = index(t,s1))
+                t = substr(t, 1, ind-1) s2 substr(t, ind+length(s1))
+        return t
+}
+
 # There should be one or two tabs after the colon.
 function format_preamble()
 {
This page took 0.065069 seconds and 4 git commands to generate.