SPECS: adapter.awk, adapter - allow skipping certain replaces - pr...

glen glen at pld-linux.org
Tue Dec 13 15:58:54 CET 2005


Author: glen                         Date: Tue Dec 13 14:58:54 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- allow skipping certain replaces
- prevent NoPatch -> Patch0 subst

---- Files affected:
SPECS:
   adapter.awk (1.237 -> 1.238) , adapter (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: SPECS/adapter.awk
diff -u SPECS/adapter.awk:1.237 SPECS/adapter.awk:1.238
--- SPECS/adapter.awk:1.237	Tue Dec 13 15:37:10 2005
+++ SPECS/adapter.awk	Tue Dec 13 15:58:49 2005
@@ -83,10 +83,13 @@
 
 # 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 @@
 	}
 
 	# 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 @@
 	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 @@
 		print
 	system("rm -f " changelog_file)
 
-
-
 	if (did_clean == 0) {
 		print ""
 		print "%clean"
@@ -820,6 +820,11 @@
 # 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: SPECS/adapter
diff -u SPECS/adapter:1.10 SPECS/adapter:1.11
--- SPECS/adapter:1.10	Mon Sep  5 15:24:39 2005
+++ SPECS/adapter	Tue Dec 13 15:58:49 2005
@@ -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,8 +12,17 @@
  		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
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/adapter.awk?r1=1.237&r2=1.238&f=u
    http://cvs.pld-linux.org/SPECS/adapter?r1=1.10&r2=1.11&f=u




More information about the pld-cvs-commit mailing list