[packages/adapter: 2/631] version 0.2 - "Copyright:" is replaced with "License:" if it is (L)GPL or BSD - added using %{name}
glen
glen at pld-linux.org
Mon Sep 12 19:34:38 CEST 2016
commit 681a4871ef0d9c9e9b5b1e685e773f81e60fa9fd
Author: kura <kura at pld-linux.org>
Date: Tue Nov 16 16:11:11 1999 +0000
version 0.2
- "Copyright:" is replaced with "License:" if it is (L)GPL or BSD
- added using %{name} and %{version} in the filenames in "Source:" (if
there is "ftp:" or "http:" on the beggining of filename)
- If the Group is started with X11 - add defines of _prefix and _mandir
- '-m' is removed fro parametrs list of 'install' only if sets modes to 644
- '-g' and '-u' are removed from parameters list of 'install' only if
sets user/group to root
- lines contain 'chown' or 'chgrp' are removed only if changes owner/group
to root
- lines contain 'chmod' are removed only if chmod sets the modes to 644
- some cosmetics
Changed files:
adapter.awk -> 1.2
adapter.awk | 82 +++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 61 insertions(+), 21 deletions(-)
---
diff --git a/adapter.awk b/adapter.awk
index ce278b3..637f767 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -1,28 +1,31 @@
#!/bin/awk -f
#
-# This is adapter v0.1. Adapter adapts .spec files for PLD.
+# This is adapter v0.2. Adapter adapts .spec files for PLD.
# Copyright (C) 1999 Micha� Kuratczyk <kura at pld.org.pl>
BEGIN {
preamble = 1;
- BOF = 1; # Beggining of file
- BOC = 2; # Beggining of %changelog
+ bof = 1; # Beggining of file
+ boc = 2; # Beggining of %changelog
}
# There should be a comment with CVS keywords on the first line of file.
-BOF == 1 {
+bof == 1 {
if (!/# \$Revision:/)
print "# $Revision$, $Date$";
- BOF = 0;
+ bof = 0;
}
# descriptions:
/%description/, (/^%[a-z]+/ && !/%description/) {
preamble = 0;
- # I have not idea what to put here, but it is possible that some
- # descriptions contain lines with "Word:" on the beggining of line,
- # so for %descriptions preamble is zero.
+ # 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";
+ x11 == 2;
+ }
}
# %prep section:
@@ -49,12 +52,20 @@ BOF == 1 {
if (/mkdir -p/)
sub(/mkdir -p/, "install -d");
- # no '-m', '-u' or '-g' for 'install'
- if (/^install/ && /-[mug][ \t]*[a-z0-7]+/)
- gsub(/-[mug][ \t]*[a-z0-7]+/, "\b");
+ # no '-u root' or '-g root' for 'install'
+ if (/^install/ && /-[ug][ \t]*root/)
+ gsub(/-[ug][ \t]*root/, "\b");
+
+ if (/^install/ && /-m[ \t]*644/)
+ gsub(/-m[ \t]*644/, "\b");
+
+ # no lines contain 'chown' or 'chgrp', which changes
+ # owner/group to 'root'
+ if ($1 ~ /chown|chgrp/ && $2 ~ /root|root.root/)
+ noprint = 1;
- # no lines contain either of 'chmod', 'chown' or 'chgrp'
- if ($1 ~ /chmod|chown|chgrp/)
+ # no lines contain 'chmod' if it sets the modes to '644'
+ if ($1 ~ /chmod/ && $2 ~ /644/)
noprint = 1;
# 'gzip -9nf' for compressing
@@ -78,29 +89,58 @@ BOF == 1 {
preamble = 0;
# There should be some CVS keywords on the first line of %changelog.
- if (BOC == 1) {
+ 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 "<_login>@pld.org.pl\n"
}
- BOC = 0;
+ boc = 0;
}
- if (BOC == 2)
- BOC--;
+ if (boc == 2)
+ boc--;
}
# preambles:
preamble == 1 {
+ # There should not be a space after the name of field
+ # and before the colon.
+ sub(/[ \t]*:/, ":");
+
if (tolower($1) ~ /buildroot:/)
$2 = "/tmp/%{name}-%{version}-root";
+
+ # Is it X11 application?
+ if (tolower($1) ~ /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/)
+ $1 = "License:";
- # There should not be a space after the name of field and before the
- # colon, but there should be one or two tabs after the colon.
- sub(/[ \t]*:/, ":");
+ if (tolower($1) ~ /name:/)
+ name = $2;
+
+ if (tolower($1) ~ /version:/)
+ version = $2;
+
+ # Use %{name} and %{version} in the filenames in "Source:"
+ if (tolower($1) ~ /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);
+ }
+
+ # There should be one or two tabs after the colon.
sub(/:[ \t]*/, ":");
- if (match($0, /[#A-Z][A-Za-z0-9()]+[ \t]*:[ \t]*/) == 1) {
+ if (match($0, /[A-Za-z0-9()# \t]+[ \t]*:[ \t]*/) == 1) {
if (RLENGTH < 8)
sub(/:/, ":\t\t");
else
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885
More information about the pld-cvs-commit
mailing list