[packages/adapter: 247/631] - allow skipping certain replaces - prevent NoPatch -> Patch0 subst

glen glen at pld-linux.org
Mon Sep 12 19:55:09 CEST 2016


commit 13b24a87fbbdda80b8de009da288b5527e6eacdd
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Tue Dec 13 14:58:49 2005 +0000

    - allow skipping certain replaces
    - prevent NoPatch -> Patch0 subst
    
    Changed files:
        adapter.awk -> 1.238
        adapter.sh -> 1.11

 adapter.awk | 23 ++++++++++++++---------
 adapter.sh  | 15 ++++++++++++---
 2 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index d5d4d2e..ca1e6c4 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -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}")
diff --git a/adapter.sh b/adapter.sh
index 27cc498..21a3c5e 100644
--- a/adapter.sh
+++ b/adapter.sh
@@ -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
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885



More information about the pld-cvs-commit mailing list