[packages/adapter: 90/631] version 0.25 - do not touch commented sections (thanks Misiek) - do not add ?!debug stuff to C{,XX}F

glen glen at pld-linux.org
Mon Sep 12 19:42:00 CEST 2016


commit 246ad57ee08404e018a521cf88c58adab504ff48
Author: kura <kura at pld-linux.org>
Date:   Sun Feb 18 23:27:30 2001 +0000

    version 0.25
    - do not touch commented sections (thanks Misiek)
    - do not add ?!debug stuff to C{,XX}FLAGS if it is already there
    - added pre/post/preun/postun sections with simple "preamble = 0"
    
    Changed files:
        adapter.awk -> 1.90

 adapter.awk | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 60 insertions(+), 11 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index 4ba0580..1900121 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -1,6 +1,6 @@
 #!/bin/awk -f
 #
-# This is adapter v0.24. Adapter adapts .spec files for PLD.
+# This is adapter v0.25. Adapter adapts .spec files for PLD.
 #
 # Copyright (C) 1999-2001 PLD-Team <pld-list at pld.org.pl>
 # Authors:
@@ -22,6 +22,9 @@ BEGIN {
 	removed["CFLAGS"] = 0
 	removed["CXXFLAGS"] = 0
 
+	# If 1, we are inside of comment block (started with /^#%/)
+	comment_block = 0
+	
 	# File with rpm groups
 	"rpm --eval %_sourcedir" | getline groups_file
 	groups_file = groups_file "/rpm.groups"
@@ -61,6 +64,20 @@ defattr == 1 {
 	defattr = 0
 }
 
+# Do not touch commented sections!
+/^#%/ {
+	comment_block = 1
+}
+
+comment_block == 1 {
+	if (/^#/) {
+		# Print as is
+		print $0
+		next
+	} else
+		comment_block = 0
+}
+
 # Remove defining _applnkdir (this macro has been included in rpm-3.0.4)
 /^%define/ {
 	if ($2 == "_applnkdir")
@@ -69,7 +86,9 @@ defattr == 1 {
 		date = 1
 }
 
-# descriptions:
+################
+# %description #
+################
 /^%description/, (/^%[a-z]+/ && !/^%description/) {
 	preamble = 0
 
@@ -118,7 +137,9 @@ defattr == 1 {
 		description = 1
 }
 
-# %prep section:
+#########
+# %prep #
+#########
 /^%prep/, (/^%[a-z]+$/ && !/^%prep/) {
 	preamble = 0
 	
@@ -127,7 +148,9 @@ defattr == 1 {
 		sub(/^%setup/, "%setup -q")
 }
 
-# %build section:
+##########
+# %build #
+##########
 /^%build/, (/^%[a-z]+$/ && !/^%build/) {
 	preamble = 0
 
@@ -174,12 +197,16 @@ defattr == 1 {
 			
 }
 
-# %clean section:
+##########
+# %clean #
+##########
 /^%clean/, (/^%[a-z]+$/ && !/^%clean/) {
 	did_clean = 1
 }
 
-# %install section:
+############
+# %install #
+############
 /^%install/, (/^%[a-z]+$/ && !/^%install/) {
 	
 	preamble = 0
@@ -217,8 +244,9 @@ defattr == 1 {
 		next
 }
 
-
-# %files section:
+##########
+# %files #
+##########
 /^%files/, (/^%[a-z \-]+$/ && !/^%files/) {
 	preamble = 0
 	
@@ -228,7 +256,9 @@ defattr == 1 {
 	use_macros()
 }
 
-# %changelog section:
+##############
+# %changelog #
+##############
 /^%changelog/, (/^%[a-z]+$/ && !/^%changelog/) {
 	preamble = 0
 	has_changelog = 1
@@ -260,7 +290,25 @@ defattr == 1 {
 	next
 }
 
-# preambles:
+###########
+# SCRIPTS #
+###########
+/^%pre/, (/^%[a-z]+$/ && !/^%pre/) {
+	preamble = 0
+}
+/^%post/, (/^%[a-z]+$/ && !/^%post/) {
+	preamble = 0
+}
+/^%preun/, (/^%[a-z]+$/ && !/^%preun/) {
+	preamble = 0
+}
+/^%postun/, (/^%[a-z]+$/ && !/^%postun/) {
+	preamble = 0
+}
+
+#############
+# PREAMBLES #
+#############
 preamble == 1 {
 	# There should not be a space after the name of field
 	# and before the colon.
@@ -612,7 +660,8 @@ function cflags(var)
 		return 0
 	}
 		
-	sub("\$RPM_OPT_FLAGS", "%{!?debug:$RPM_OPT_FLAGS}%{?debug:-O0 -g}")
+	if (!/!\?debug/)
+		sub("\$RPM_OPT_FLAGS", "%{!?debug:$RPM_OPT_FLAGS}%{?debug:-O0 -g}")
 	return 1
 }
 
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list