[packages/adapter: 20/631] - Source: -> Source0: - Patch: -> Patch0: - removed unnecessary semicolons

glen glen at pld-linux.org
Mon Sep 12 19:36:08 CEST 2016


commit aec1bddbd61af396b6627d359aa69043778c1a7c
Author: Sebastian Zagrodzki <sebek at zagrodzki.net>
Date:   Fri Feb 18 15:39:52 2000 +0000

    - Source: -> Source0:
    - Patch: -> Patch0:
    - removed unnecessary semicolons
    
    Changed files:
        adapter.awk -> 1.20

 adapter.awk | 250 +++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 128 insertions(+), 122 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index 7760a7d..daaed9f 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -4,15 +4,15 @@
 # Copyright (C) 1999 Micha� Kuratczyk <kura at pld.org.pl>
 
 BEGIN {
-	preamble = 1;
-	boc = 2;			# Beggining of %changelog
-	bod = 0;			# Beggining of %description
-	tw = 77;        		# Descriptions width
+	preamble = 1
+	boc = 2			# Beggining of %changelog
+	bod = 0			# Beggining of %description
+	tw = 77        		# Descriptions width
 	groups_file = ENVIRON["HOME"] "/rpm/groups" # File with rpm groups
 	
 	# Is 'date' macro already defined?
 	if (is_there_line("%define date"))
-		date = 1;
+		date = 1
 	
 	"rpm --eval %_prefix"	| getline prefix
 	"rpm --eval %_bindir"	| getline bindir
@@ -28,155 +28,155 @@ BEGIN {
 # There should be a comment with CVS keywords on the first line of file.
 FNR == 1 {
 	if (!/# \$Revision:/)		# If this line is already OK?
-		print "# $" "Revision:$, " "$" "Date:$";	# No
+		print "# $" "Revision:$, " "$" "Date:$"		# No
 	else {
-		print $0;						# Yes
-		next;				# It is enough for first line
+		print $0						# Yes
+		next				# It is enough for first line
 	}
 }
 
 # If the latest line matched /%files/
 defattr == 1 {
 	if ($0 !~ /defattr/)	# If no %defattr
-		print "%defattr(644,root,root,755)";	# Add it
+		print "%defattr(644,root,root,755)"	# Add it
 	else
-		$0 = "%defattr(644,root,root,755)";	# Correct mistakes (if any)
-	defattr = 0;
+		$0 = "%defattr(644,root,root,755)"	# Correct mistakes (if any)
+	defattr = 0
 }
 
 # descriptions:
 /%description/, (/^%[a-z]+/ && !/%description/) {
-	preamble = 0;
+	preamble = 0
 
 	if (/^%description/)
-		bod++;
+		bod++
 	
 	# Define _prefix and _mandir if it is X11 application
 	if (/^%description$/ && x11 == 1) {
-		print "%define\t\t_prefix\t\t/usr/X11R6";
-		print "%define\t\t_mandir\t\t%{_prefix}/man\n";
-		prefix = "/usr/X11R6";
-		x11 = 2;
+		print "%define\t\t_prefix\t\t/usr/X11R6"
+		print "%define\t\t_mandir\t\t%{_prefix}/man\n"
+		prefix = "/usr/X11R6"
+		x11 = 2
 	}
 
         # Collect whole text of description
 	if (description == 1 && !/^%[a-z]+/ && !/%description/) {
-		description_text = description_text $0 " ";
-		next;
+		description_text = description_text $0 " "
+		next
 	}
  
 	# Formt description to the length of tw (default == 77)
 	if (/^%[a-z]+/ && (!/%description/ || bod == 2)) {
-		n = split(description_text, dt, / /);
+		n = split(description_text, dt, / /)
 		for (i = 1; i <= n; i++) {
 			if (length(line) + length(dt[i]) + 1 < tw)
-				line = line dt[i] " ";
+				line = line dt[i] " "
 			else {
-				sub(/[ ]+$/, "", line);
-				print line;
-				line = "";
-				i--;
+				sub(/[ ]+$/, "", line)
+				print line
+				line = ""
+				i--
 			}
 		}
 
-		sub(/[ ]+$/, "", line);
-		print line "\n";
-		line = "";
-		delete dt;
-		description_text = "";
+		sub(/[ ]+$/, "", line)
+		print line "\n"
+		line = ""
+		delete dt
+		description_text = ""
 		if (bod == 2) {
-			bod = 1;
-			description = 1;
+			bod = 1
+			description = 1
 		} else {
-			bod = 0;
-			description = 0;
+			bod = 0
+			description = 0
 		}
 	} else
-		description = 1;
+		description = 1
 }
 
 # %prep section:
 /%prep/, (/^%[a-z]+$/ && !/%prep/) {
-	preamble = 0;
+	preamble = 0
 	
 	# Add '-q' to %setup
 	if (/%setup/ && !/-q/)
-		sub(/%setup/, "%setup -q");
+		sub(/%setup/, "%setup -q")
 }
 
 # %build section:
 /%build/, (/^%[a-z]+$/ && !/%build/) {
-	preamble = 0;
+	preamble = 0
 
-	use_macros();
+	use_macros()
 }
 
 # %install section:
 /%install/, (/^[a-z]+$/ && !/%install/) {
-	preamble = 0;
+	preamble = 0
 	
-	use_macros();
+	use_macros()
 
 	# 'install -d' instead 'mkdir -p'
 	if (/mkdir -p/)
-		sub(/mkdir -p/, "install -d");
+		sub(/mkdir -p/, "install -d")
 		
 	# No '-u root' or '-g root' for 'install'
 	if (/^install/ && /-[ug][ \t]*root/)
-		gsub(/-[ug][ \t]*root /, "");
+		gsub(/-[ug][ \t]*root /, "")
 	
 	if (/^install/ && /-m[ \t]*644/)
-		gsub(/-m[ \t]*644 /, "");
+		gsub(/-m[ \t]*644 /, "")
 	
 	# No lines contain 'chown' or 'chgrp', which changes
 	# owner/group to 'root'
 	if (($1 ~ /chown/ && $2 ~ /root\.root/) || ($1 ~ /chgrp/ && $2 ~ /root/))
-		next;
+		next
 	
 	# No lines contain 'chmod' if it sets the modes to '644'
 	if ($1 ~ /chmod/ && $2 ~ /644/)
-		next;
+		next
 	
 	# 'gzip -9nf' for compressing
 	if ($1 ~ /gzip|bzip2/) {
 		if ($2 ~ /^-/)
-			sub(/-[A-Za-z0-9]+ /, "", $0);
-		sub($1, "gzip -9nf");
+			sub(/-[A-Za-z0-9]+ /, "", $0)
+		sub($1, "gzip -9nf")
 	}
 }
 
 # %files section:
 /%files/, (/^%[a-z \-]+$/ && !/%files/) {
-	preamble = 0;
+	preamble = 0
 	
 	if ($0 ~ /%files/)
-		defattr = 1;
+		defattr = 1
 	
-	use_macros();
+	use_macros()
 }
 
 # %changelog section:
 /%changelog/, (/^%[a-z]+$/ && !/%changelog/) {
-	preamble = 0;
+	preamble = 0
 	
 	# There should be some CVS keywords on the first line of %changelog.
 	if (boc == 1) {
 		if (!/PLD Team/) {
-			print "* %{date} PLD Team <pld-list at pld.org.pl>";
-			printf "All below listed persons can be reached on ";
-			print "<cvs_login>@pld.org.pl\n";
-			print "$" "Log:$";
+			print "* %{date} PLD Team <pld-list at pld.org.pl>"
+			printf "All below listed persons can be reached on "
+			print "<cvs_login>@pld.org.pl\n"
+			print "$" "Log:$"
 		}
-		boc = 0;
+		boc = 0
 	}
 	
 	# Define date macro.
 	if (boc == 2) {
 		if (date == 0) {
-			printf "%%define date\t%%(echo `LC_ALL=\"C\"";
+			printf "%%define date\t%%(echo `LC_ALL=\"C\""
 			print " date +\"%a %b %d %Y\"`)"
 		}
-	boc--;
+	boc--
 	}
 }
 
@@ -184,87 +184,93 @@ defattr == 1 {
 preamble == 1 {
 	# There should not be a space after the name of field
 	# and before the colon.
-	sub(/[ \t]*:/, ":");
+	sub(/[ \t]*:/, ":")
 	
-	field = tolower($1);
+	field = tolower($1)
 
 	if (field ~ /packager:|distribution:|prefix:/)
-		next;
+		next
 	
 	if (field ~ /buildroot:/)
-		$2 = "/tmp/%{name}-%{version}-root";
+		$2 = "/tmp/%{name}-%{version}-root"
 
 	if (field ~ /group:/) {
-		format_preamble();
-		print $0;
+		format_preamble()
+		print $0
 		
-		translate_group($2);
-		close(groups_file);
+		translate_group($2)
+		close(groups_file)
 		
 		if ($2 ~ /^X11/ && x11 == 0)	# Is it X11 application?
-		       x11 = 1;
+		       x11 = 1
 
-		next;	# Line is already formatted and printed
+		next	# Line is already formatted and printed
 	}
 		
 	# Use "License" instead of "Copyright" if it is (L)GPL or BSD
 	if (field ~ /copyright:/ && $2 ~ /GPL|BSD/)
-		$1 = "License:";
+		$1 = "License:"
 	
 	if (field ~ /name:/)
-		name = $2;
+		name = $2
 
 	if (field ~ /version:/)
-		version = $2;
+		version = $2
 
 	# Use %{name} and %{version} in the filenames in "Source:"
 	if (field ~ /source/ && $2 ~ /^ftp:|^http:/) {
-		n = split($2, url, /\//);
-		filename = url[n];
-		sub(name, "%{name}", url[n]);
-		sub(version, "%{version}", url[n]);
-		sub(filename, url[n], $2);
+		n = split($2, url, /\//)
+		filename = url[n]
+		sub(name, "%{name}", url[n])
+		sub(version, "%{version}", url[n])
+		sub(filename, url[n], $2)
 	}
 
-	format_preamble();
+	if (field ~ /source:/)
+		$1 = "Source0:"	
+
+	if (field ~ /patch:/)
+		$1 = "Patch0:"
+
+	format_preamble()
 	
 	if ($1 ~ /%define/) {
 		# Do not add %define of _prefix if it already is.
 	       	if ($2 ~ /_prefix/) {
-			prefix = $3;
-			x11 = 2;
+			prefix = $3
+			x11 = 2
 		}
 		if ($2 ~ /_bindir/ && !/_sbindir/)
-			bindir = $3;
+			bindir = $3
 		if ($2 ~ /_sbindir/)
-			sbindir = $3;
+			sbindir = $3
 		if ($2 ~ /_libdir/)
-			libdir = $3;
+			libdir = $3
 		if ($2 ~ /_sysconfdir/)
-			sysconfdir = $3;
+			sysconfdir = $3
 		if ($2 ~ /_datadir/)
-			datadir = $3;
+			datadir = $3
 		if ($2 ~ /_includedir/)
-			includedir = $3;
+			includedir = $3
 		if ($2 ~ /_mandir/)
-			mandir = $3;
+			mandir = $3
 		if ($2 ~ /_infodir/)
-			infodir = $3;
+			infodir = $3
 	}
 }
 
 {
-	preamble = 1;
+	preamble = 1
 	
-	print;
+	print
 }
 
 END {
 	if (boc == 1) {
-		print "* %{date} PLD Team <pld-list at pld.org.pl>";
-		printf "All below listed persons can be reached on ";
-		print "<cvs_login>@pld.org.pl\n";
-		print "$" "Log:$";
+		print "* %{date} PLD Team <pld-list at pld.org.pl>"
+		printf "All below listed persons can be reached on "
+		print "<cvs_login>@pld.org.pl\n"
+		print "$" "Log:$"
 	}
 }
 
@@ -272,45 +278,45 @@ END {
 # which matches regexp.
 function is_there_line(line, l)
 {
-	command = "grep \"" line "\" " ARGV[1];
-	command	| getline l;
-	close(command);
+	command = "grep \"" line "\" " ARGV[1]
+	command	| getline l
+	close(command)
 
 	if (l != "")
-		return 1;
+		return 1
 	else
-		return 0;
+		return 0
 }
 
 # This function prints translated names of groups.
 function translate_group(group)
 {
 	for(;;) {
-		result = getline line < groups_file;
+		result = getline line < groups_file
 		
 		if (result == -1) {
-			print "######\t\t" groups_file ": no such file";
-			return;
+			print "######\t\t" groups_file ": no such file"
+			return
 		}
 
 		if (result == 0) {
-			print "######\t\t" "Unknown group!";
-			return;
+			print "######\t\t" "Unknown group!"
+			return
 		}
 		
 		if (line ~ group) {
-			found = 1;
-			continue;
+			found = 1
+			continue
 		}
 
 		if (found == 1)
 			if (line ~ /\[[a-z][a-z]\]:/) {
-				split(line, g, /\[|\]|\:/);
+				split(line, g, /\[|\]|\:/)
 				if (!is_there_line("^Group(" g[2] "):"))
-						printf("Group(%s):%s\n", g[2], g[4]);
+						printf("Group(%s):%s\n", g[2], g[4])
 			} else {
-				found = 0;
-				return;
+				found = 0
+				return
 			}
 	}
 }
@@ -318,26 +324,26 @@ function translate_group(group)
 # There should be one or two tabs after the colon.
 function format_preamble()
 {
-	sub(/:[ \t]*/, ":");
+	sub(/:[ \t]*/, ":")
 	if (match($0, /[A-Za-z0-9()# \t]+[ \t]*:[ \t]*/) == 1) {
 		if (RLENGTH < 8)
-			sub(/:/, ":\t\t");
+			sub(/:/, ":\t\t")
 		else
-			sub(/:/, ":\t");
+			sub(/:/, ":\t")
 	}
 }
 
 # Replace directly specified directories with macros
 function use_macros()
 {
-	gsub(bindir, "%{_bindir}");
-	gsub(sbindir, "%{_sbindir}");
-	gsub(libdir, "%{_libdir}");
-	gsub(sysconfdir, "%{_sysconfdir}");
-	gsub(datadir, "%{_datadir}");
-	gsub(includedir, "%{_includedir}");
-	gsub(mandir, "%{_mandir}");
-	gsub(infodir, "%{_infodir}");
-	gsub(prefix, "%{_prefix}");
+	gsub(bindir, "%{_bindir}")
+	gsub(sbindir, "%{_sbindir}")
+	gsub(libdir, "%{_libdir}")
+	gsub(sysconfdir, "%{_sysconfdir}")
+	gsub(datadir, "%{_datadir}")
+	gsub(includedir, "%{_includedir}")
+	gsub(mandir, "%{_mandir}")
+	gsub(infodir, "%{_infodir}")
+	gsub(prefix, "%{_prefix}")
 }
 
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list