[packages/adapter: 64/631] - add %clean if it isn't there yet...

glen glen at pld-linux.org
Mon Sep 12 19:39:49 CEST 2016


commit 1c52b18ec5d7089351897bd0c57e634dce225c12
Author: Sebastian Zagrodzki <sebek at zagrodzki.net>
Date:   Thu Jul 13 18:38:13 2000 +0000

    - add %clean if it isn't there yet...
    
    Changed files:
        adapter.awk -> 1.64

 adapter.awk | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index 8a905f9..f2dd321 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -130,20 +130,25 @@ defattr == 1 {
 	use_macros()
 }
 
+# %clean section:
+/^%clean/, (/^%[a-z]+$/ && !/^%clean/) {
+	did_clean = 1
+}
+
 # %install section:
 /^%install/, (/^%[a-z]+$/ && !/^%install/) {
 	
 	preamble = 0
 	
-	if (/^[ \t]*rm([ \t]+-[rf]+)*[ \t]+\${?RPM_BUILD_ROOT}?/ && did_clean==0) {
-		did_clean=1
+	if (/^[ \t]*rm([ \t]+-[rf]+)*[ \t]+\${?RPM_BUILD_ROOT}?/ && did_rmroot==0) {
+		did_rmroot=1
 		print "rm -rf $RPM_BUILD_ROOT"
 		next
 	}
 
-	if (!/^(#?[ \t]*)$/ && !/^%install/ && did_clean==0) {
+	if (!/^(#?[ \t]*)$/ && !/^%install/ && did_rmroot==0) {
 		print "rm -rf $RPM_BUILD_ROOT"
-		did_clean=1
+		did_rmroot=1
 	}
 	
 	use_macros()
@@ -347,6 +352,12 @@ END {
 		print
 	system("rm -f " changelog_file)
 
+	if (did_clean == 0) {
+		print ""
+		print "%clean"
+		print "rm -rf $RPM_BUILD_ROOT"
+	}
+
 	if (date == 0) {
 		print ""
 		print "%define date\t%(echo `LC_ALL=\"C\" date +\"%a %b %d %Y\"`)"
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list