[packages/adapter: 7/631] version 0.5 - many 'tolower($1)' replaced with a variable (I hope it is faster) - removed stupid usi

glen glen at pld-linux.org
Mon Sep 12 19:35:03 CEST 2016


commit 69501a12664d42625c451c1c5a0318fa0159db99
Author: kura <kura at pld-linux.org>
Date:   Sun Nov 28 00:50:30 1999 +0000

    version 0.5
    - many 'tolower($1)' replaced with a variable (I hope it is faster)
    - removed stupid using 'noprint' variable (replaced with 'next;')
    - ignorig some preamble fields moved to preamble section and fixed
    
    Changed files:
        adapter.awk -> 1.7

 adapter.awk | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index e1d09aa..490f4cd 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -1,6 +1,6 @@
 #!/bin/awk -f
 #
-# This is adapter v0.4. Adapter adapts .spec files for PLD.
+# This is adapter v0.5. Adapter adapts .spec files for PLD.
 # Copyright (C) 1999 Micha� Kuratczyk <kura at pld.org.pl>
 
 BEGIN {
@@ -108,40 +108,36 @@ bof == 1 {
 	}
 }
 
-# ignore some spec filelds
-/^[Pp]ackager:/	{next}
-/^[Dd]istribution:/ {next}
-/^[Pp]refix:/ {next}
-
 # preambles:
 preamble == 1 {
 	# There should not be a space after the name of field
 	# and before the colon.
 	sub(/[ \t]*:/, ":");
 	
-	if (tolower($1) ~ /buildroot:/)
+	field = tolower($1);
+
+	if (field ~ /packager:|distribution:|prefix:/)
+		next;
+	
+	if (field ~ /buildroot:/)
 		$2 = "/tmp/%{name}-%{version}-root";
 
 	# Is it X11 application?
-	if (tolower($1) ~ /group/ && $2 ~ /^X11/ && x11 == 0)
+	if (field ~ /group/ && $2 ~ /^X11/ && x11 == 0)
 		x11 = 1;
 		
-	# Do not add %define of _prefix if it already is.
-	if ($1 ~ /%define/ && $2 ~ /_prefix/)
-		x11 = 2;
-			
 	# Use "License" instead of "Copyright" if it is (L)GPL or BSD
-	if (tolower($1) ~ /copyright:/ && $2 ~ /GPL|BSD/)
+	if (field ~ /copyright:/ && $2 ~ /GPL|BSD/)
 		$1 = "License:";
 	
-	if (tolower($1) ~ /name:/)
+	if (field ~ /name:/)
 		name = $2;
 
-	if (tolower($1) ~ /version:/)
+	if (field ~ /version:/)
 		version = $2;
 
 	# Use %{name} and %{version} in the filenames in "Source:"
-	if (tolower($1) ~ /source/ && $2 ~ /^ftp:|^http:/) {
+	if (field ~ /source/ && $2 ~ /^ftp:|^http:/) {
 		n = split($2, url, /\//);
 		filename = url[n];
 		sub(name, "%{name}", url[n]);
@@ -157,6 +153,11 @@ preamble == 1 {
 		else
 			sub(/:/, ":\t");
 	}
+	
+	# Do not add %define of _prefix if it already is.
+	if ($1 ~ /%define/ && $2 ~ /_prefix/)
+		x11 = 2;
+			
 }
 
 
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list