]> git.pld-linux.org Git - packages/adapter.git/commitdiff
- allow skipping certain replaces
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 13 Dec 2005 14:58:49 +0000 (14:58 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Tue, 13 Dec 2005 14:58:49 +0000 (14:58 +0000)
- prevent NoPatch -> Patch0 subst

Changed files:
    adapter.awk -> 1.238
    adapter.sh -> 1.11

adapter.awk
adapter.sh

index d5d4d2e926b61dd1616242aa6fe648b33f9f0960..ca1e6c43aed77b0e5c19f97cd2e1003ff5c60258 100644 (file)
@@ -83,10 +83,13 @@ FNR == 1 {
 
 # If the latest line matched /%files/
 defattr == 1 {
-       if ($0 !~ /defattr/)    # If no %defattr
-               print "%defattr(644,root,root,755)"     # Add it
-       else
-               $0 = "%defattr(644,root,root,755)"      # Correct mistakes (if any)
+       if (ENVIRON["SKIP_DEFATTR"] != 1) {
+               if ($0 !~ /defattr/) {  # If no %defattr
+                       print "%defattr(644,root,root,755)"     # Add it
+               } else {
+                       $0 = "%defattr(644,root,root,755)"      # Correct mistakes (if any)
+               }
+       }
        defattr = 0
 }
 
@@ -223,7 +226,7 @@ preamble == 1 {
        }
 
        # Format description
-       if (description == 1 && !/^%[a-z]+/ && !/^%description/) {
+       if (ENVIRON["SKIP_DESC"] != 1 && description == 1 && !/^%[a-z]+/ && !/^%description/) {
                if (/^[ \t]*$/) {
                        format_flush(format_line, format_indent)
                        print ""
@@ -727,12 +730,11 @@ preamble == 1 {
        if (field ~ /^source:/)
                $1 = "Source0:"
 
-       if (field ~ /patch:/)
+       if (field ~ /^patch:/)
                $1 = "Patch0:"
 
        format_preamble()
 
-
        if (field ~ /requires/) {
                # atrpms
                $0 = fixedsub("%{eversion}", "%{epoch}:%{version}-%{release}", $0);
@@ -772,8 +774,6 @@ END {
                print
        system("rm -f " changelog_file)
 
-
-
        if (did_clean == 0) {
                print ""
                print "%clean"
@@ -820,6 +820,11 @@ function format_preamble()
 # Replace directly specified directories with macros
 function use_macros()
 {
+       # -m, --skip-macros, --no-macros -- skip macros subst
+       if (ENVIRON["SKIP_MACROS"]) {
+               return
+       }
+
        gsub(perl_sitearch, "%{perl_sitearch}")
        gsub(perl_archlib, "%{perl_archlib}")
        gsub(perl_privlib, "%{perl_privlib}")
index 27cc498f8ee889558f1be33eb96fead360a43cc1..21a3c5e89e9d1530e63f931d10807a3db14127cc 100644 (file)
@@ -1,9 +1,9 @@
 #!/bin/sh
 
 self=$(basename "$0")
-usage="Usage: $self [--sort[-br]|-s] filename"
+usage="Usage: $self [--sort[-br]|-s|-m|--no-macros] filename"
 
-t=`getopt -o hs --long help,sort,sort-br -n "$self" -- "$@"` || exit $?
+t=`getopt -o hsmda --long help,sort,sort-br,no-macros,skip-macros,skip-desc,skip-defattr -n "$self" -- "$@"` || exit $?
 eval set -- "$t"
 
 while true; do
@@ -12,9 +12,18 @@ while true; do
                echo 2>&1 "$usage"
                exit 1
        ;;
-       --sort|--sort-br|-s)
+       -s|--sort|--sort-br)
                export SORTBR=1
        ;;
+       -m|--no-macros|--skip-macros)
+               export SKIP_MACROS=1
+       ;;
+       -d|--skip-desc)
+               export SKIP_DESC=1
+       ;;
+       -a|--skip-defattr)
+               export SKIP_DEFATTR=1
+       ;;
        --)
                shift
                break
This page took 0.08168 seconds and 4 git commands to generate.