]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - adapter.awk
- change @ to # when doing tags
[packages/rpm-build-tools.git] / adapter.awk
index 7a0cb88b9d803b6e8954c27c00bf45f0e8b2f078..ea72b3fec65100435fb8d0cd9f7d1982d5fb0e94 100644 (file)
@@ -8,7 +8,7 @@
 #      Sebastian Zagrodzki <s.zagrodzki@mimuw.edu.pl>
 #      Tomasz K³oczko <kloczek@rudy.mif.pg.gda.pl>
 #      Artur Frysiak <wiget@pld.org.pl>
-#      Michal Kochanowicz <mkochano@ee.pw.edu.pl>
+#      Michal Kochanowicz <mkochano@pld.org.pl>
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 BEGIN {
@@ -28,7 +28,7 @@ BEGIN {
        # File with rpm groups
        "rpm --eval %_sourcedir" | getline groups_file
        groups_file = groups_file "/rpm.groups"
-       system("cd `rpm --eval %_sourcedir`; cvs up rpm.groups 1>&2")
+       system("cd `rpm --eval %_sourcedir`; cvs up rpm.groups >/dev/null")
 
        # Temporary file for changelog section
        changelog_file = ENVIRON["HOME"] "/tmp/adapter.changelog"
@@ -65,7 +65,7 @@ defattr == 1 {
 }
 
 # Comments
-/^#/ {
+/^#/ && (description == 0) {
        if (/This file does not like to be adapterized!/) {
                print                   # print this message
                while (getline)         # print the rest of spec as it is
@@ -326,19 +326,32 @@ preamble == 1 {
        
        field = tolower($1)
        fieldnlower = $1
-       if (Byla_grupa == 1 && field ~ /^#/)
+       if (field ~ /group(\([^)]+\)):/)
                next
-       if (Byla_grupa == 1 && field !~ /group(\([^)]+\))?:/) {
-               Byla_grupa = 0
-               print "Group:\t\t" Grupa["en"]
-               if (Grupa["en"] ~ /^X11/ && x11 == 0)   # Is it X11 application?
+       if (field ~ /group:/) {
+               format_preamble()
+               sub(/^Utilities\//,"Applications/",$2)
+               sub(/^Games/,"Applications/Games",$2)
+               sub(/^X11\/Games/,"X11/Applications/Games",$2)
+               sub(/^X11\/GNOME\/Development\/Libraries/,"X11/Development/Libraries",$2)
+               sub(/^X11\/GNOME\/Applications/,"X11/Applications",$2)
+               sub(/^X11\/GNOME/,"X11/Applications",$2)
+               sub(/^X11\/Utilities/,"X11/Applications",$2)
+               sub(/^X11\/Games\/Strategy/,"X11/Applications/Games/Strategy",$2)
+               sub(/^Shells/,"Applications/Shells",$2)
+
+               sub(/^[^ \t]*[ \t]*/,"")
+               Grupa = $0
+
+               print "Group:\t\t" Grupa
+               if (Grupa ~ /^X11/ && x11 == 0) # Is it X11 application?
                       x11 = 1
 
                byl_plik_z_grupami = 0
                byl_opis_grupy = 0
                while ((getline linia_grup < groups_file) > 0) {
                        byl_plik_z_grupami = 1
-                       if (linia_grup == Grupa["en"]) {
+                       if (linia_grup == Grupa) {
                                byl_opis_grupy = 1
                                break
                        }
@@ -348,23 +361,9 @@ preamble == 1 {
                        print "######\t\t" groups_file ": no such file"
                else if (!byl_opis_grupy)
                        print "######\t\t" "Unknown group!"
-               else
-                       while (getline linia_grup < groups_file) {
-                               if (linia_grup == "")
-                                       break
-                               split(linia_grup, g, /[\[\]:]/)
-                               sub(/^[ \t]*/,"",g[4])
-                               Grupa[g[2]]=g[4]
-                       }
                
                close(groups_file)
-
-               delete Grupa["en"]
-               for (jezyk in Grupa) {
-                       print "Group(" jezyk "):\t" Grupa[jezyk] | "sort"
-                       delete Grupa[jezyk]
-               }
-               close ("sort")
+               next
        }
        
        if (field ~ /packager:|distribution:|docdir:|prefix:/)
@@ -373,29 +372,6 @@ preamble == 1 {
        if (field ~ /buildroot:/)
                $0 = $1 "%{tmpdir}/%{name}-%{version}-root-%(id -u -n)"
 
-       if (field ~ /group(\([^)]+\))?:/) {
-               format_preamble()
-               sub(/^Utilities\//,"Applications/",$2)
-               sub(/^Games/,"Applications/Games",$2)
-               sub(/^X11\/Games/,"X11/Applications/Games",$2)
-               sub(/^X11\/GNOME\/Development\/Libraries/,"X11/Development/Libraries",$2)
-               sub(/^X11\/GNOME\/Applications/,"X11/Applications",$2)
-               sub(/^X11\/GNOME/,"X11/Applications",$2)
-               sub(/^X11\/Utilities/,"X11/Applications",$2)
-               sub(/^X11\/Games\/Strategy/,"X11/Applications/Games/Strategy",$2)
-               sub(/^Shells/,"Applications/Shells",$2)
-
-               if (!match(fieldnlower,/\([^)]+\):/))
-                       glang="en"
-               else
-                       glang=substr(fieldnlower,RSTART+1,RLENGTH-3)
-               sub(/^[^ \t]*[ \t]*/,"")
-               Grupa[glang] = $0
-               Byla_grupa = 1
-               
-               next    # Line is already formatted and printed
-       }
-               
        # Use "License" instead of "Copyright" if it is (L)GPL or BSD
        if (field ~ /copyright:/ && $2 ~ /GPL|BSD/)
                $1 = "License:"
@@ -538,7 +514,7 @@ function fixedsub(s1,s2,t,      ind) {
 function format_preamble()
 {
        sub(/:[ \t]*/, ":")
-       if (match($0, /[A-Za-z0-9()#_ \t]+[ \t]*:[ \t]*/) == 1) {
+       if (match($0, /[A-Za-z0-9(),#_ \t]+[ \t]*:[ \t]*/) == 1) {
                if (RLENGTH < 8)
                        sub(/:/, ":\t\t")
                else
@@ -570,7 +546,7 @@ function use_macros()
                gsub("%{_prefix}/lib", "%{_libdir}")
 
        for (c = 1; c <= NF; c++) {
-               if ($c ~ sysconfdir "/{?cron.d")
+               if ($c ~ sysconfdir "/{?cron.")
                        continue;
                if ($c ~ sysconfdir "/{?crontab.d")
                        continue;
@@ -613,7 +589,9 @@ function use_macros()
        gsub("%{prefix}/info", "%{_infodir}")
        gsub("%{_prefix}/info", "%{_infodir}")
 
-       gsub("%{_datadir}/aclocal", "%{_aclocaldir}")
+       if (prefix !~ "/X11R6") {
+               gsub("%{_datadir}/aclocal", "%{_aclocaldir}")
+       }
 
        if (prefix != "/") {
                for (c = 1; c <= NF; c++) {
@@ -627,8 +605,11 @@ function use_macros()
        gsub("%{PACKAGE_VERSION}", "%{version}")
        gsub("%{PACKAGE_NAME}", "%{name}")
 
-       gsub("%{_datadir}/gnome/apps", "%{_applnkdir}")
-       gsub("%{_datadir}/applnk", "%{_applnkdir}")
+       # we can move files between tge dirs below
+       if ($0 !~ "%{_applnkdir}") {
+               gsub("%{_datadir}/gnome/apps", "%{_applnkdir}")
+               gsub("%{_datadir}/applnk", "%{_applnkdir}")
+       }
 
        gsub("^make$", "%{__make}")
        gsub("^make ", "%{__make} ")
This page took 0.033963 seconds and 4 git commands to generate.