RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun|verifyscript|check"
SECTIONS = "^%(" RPM_SECTIONS ")"
- RCSID = "$Id$"
- rev = RCSID # TODO: parse from RCSID
- VERSION = "0.35/" rev
+ rev = "1.514"
+ VERSION = "0.36/" rev
PREAMBLE_TAGS = "(R|BR|Summary|Name|Version|Release|Epoch|License|Group|URL|BuildArch|BuildRoot|Obsoletes|Conflicts|Provides|ExclusiveArch|ExcludeArch|Pre[Rr]eq|(Build)?Requires|Suggests|Auto(Req|Prov))"
usedigest = 0 # Enable to switch to rpm 4.4.6+ md5 digests
preamble = 1 # Is it part of preamble? Default - yes
- boc = 4 # Beginning of %changelog
bod = 0 # Beginning of %description
tw = 70 # Descriptions width
import_rpm_macros()
packages_dir = topdir
- groups_file = packages_dir "/rpm.groups"
+ groups_file = packages_dir "/../rpm-build-tools/rpm.groups"
- system("cd "packages_dir"; [ -f rpm.groups ] || cvs up rpm.groups > /dev/null")
system("[ -d ../PLD-doc ] && cd ../PLD-doc && ([ -f BuildRequires.txt ] || cvs up BuildRequires.txt >/dev/null)");
-
- # Temporary file for changelog section
- changelog_file = mktemp("adapter.changelogXXXXXX")
-}
-
-# There should be a comment with CVS keywords on the first line of file.
-FNR == 1 {
- if (!/^# \$[R]evision: .* \$, \$[D]ate: .* \$$/) { # If this line is already OK?
- print "# $" "Revision:$, " "$" "Date:$" # No
- if ( /^#.*([rR]evision|[dD]ate)/ ) # There was something similar, but incorrect
- next
- } else {
- print $0 # Yes
- next # It is enough for first line
- }
}
# If the latest line matched /%files/
if ($2 == "_applnkdir") {
next
}
+
+ # FIXME: this section will likely never match after cvs->git migration
if ($2 == "date") {
- date = 1
if (did_files == 0) {
print "%files"
print ""
if (/CC=%{__cc} /) {
sub("CC=%{__cc}", "CC=\"%{__cc}\"")
}
-
+
# use PLD Linux macros
$0 = fixedsub("glib-gettextize --copy --force","%{__glib_gettextize}", $0);
$0 = fixedsub("intltoolize --copy --force", "%{__intltoolize}", $0);
}
}
-##############
-# %changelog #
-##############
-/^%changelog/, (!/^%changelog/ && $0 ~ SECTIONS) {
- preamble = 0
- has_changelog = 1
- skip = 0
- # There should be some CVS keywords on the first line of %changelog.
- if (boc == 3) {
- if ($0 !~ _cvsmailfeedback) {
- print "* %{date} " _cvsmailfeedback > changelog_file
- } else {
- skip = 1
- }
- boc = 2
- }
- if (boc == 2 && !skip) {
- if (!/All persons listed below/) {
- printf "All persons listed below can be reached at " > changelog_file
- print "<cvs_login>" _cvsmaildomain "\n" > changelog_file
- } else {
- skip = 1
- }
- boc = 1
- }
- if (boc == 1 && !skip) {
- if (!/^$/) {
- if (!/\$.*Log:.*\$/) {
- print "$" "Log:$" > changelog_file
- }
- boc = 0
- }
- }
- # Define date macro.
- if (boc == 4) {
- if (date == 0) {
- printf "%%define date\t%%(echo `LC_ALL=\"C\"" > changelog_file
- print " date +\"%a %b %d %Y\"`)" > changelog_file
- date = 1
- }
- boc = 3
- }
-
- sub(/[ \t]+$/, "");
- if (!/^%[a-z]+$/ || /changelog/) {
- # stop changelog if "real" changelog starts
- if (boc == 0 && /^\* /) {
- boc = -1
- }
- if (boc == -1) {
- next;
- }
- print > changelog_file
- } else {
- print
- }
- next
-}
-
###########
# SCRIPTS #
###########
if (field ~ /summary:/ && !/etc\.$/ && !/Inc\.$/) {
sub(/\.$/, "", $0);
}
- if (field ~ /group(\([^)]+\)):/)
+ if (field ~ /group(\([^)]+\)):/) {
next
- if (field ~ /group:/) {
+ }
+
+ if (field == "group:") {
format_preamble()
group = $0;
sub(/^[^ \t]*[ \t]*/, "", group);
group = replace_groupnames(group);
$0 = "Group:\t\t" group
- if (group ~ /^X11/ && x11 == 0) # Is it X11 application?
- x11 = 1
-
byl_plik_z_groupmi = 0
byl_opis_grupy = 0
while ((getline linia_grup < groups_file) > 0) {
did_groups = 1
}
- if (field ~ /prereq:/) {
+ if (field == "prereq:") {
sub(/Pre[Rr]eq:/, "Requires:", $1);
}
}
# BR: tar (and others) is to common (rpm-build requires it)
- if (field ~ /^buildrequires:/) {
+ if (field == "buildrequires:") {
l = substr($0, index($0, $2));
if (l == "awk" ||
l == "binutils" ||
next
}
- replace_requires();
+ replace_requires(field);
}
- if (field ~ /^requires:/ || field ~ /^requires\(/) {
- replace_requires();
+ if (field == "requires:" || field ~ /^requires\(/) {
+ replace_requires(field);
}
}
}
- close(changelog_file)
- while ((getline < changelog_file) > 0)
- 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\"`)"
- }
-
- if (has_changelog == 0) {
- print "%changelog"
- }
-
- if (boc > 2) {
- print "* %{date} PLD Team <feedback@pld-linux.org>"
- }
- if (boc > 1) {
- printf "All persons listed below can be reached at "
- print "<cvs_login>@pld-linux.org\n"
- }
- if (boc > 0) {
- print "$" "Log:$"
- }
}
# substitutes fixed strings (not regexps)
gsub(perl_vendorlib, "%{perl_vendorlib}")
gsub(perl_vendorarch, "%{perl_vendorarch}")
gsub(perl_sitelib, "%{perl_sitelib}")
-
+
gsub(py_sitescriptdir, "%{py_sitescriptdir}")
gsub(py_sitedir, "%{py_sitedir}")
gsub(py_scriptdir, "%{py_scriptdir}")
continue;
if ($c ~ sysconfdir "/apm")
continue;
+ if ($c ~ sysconfdir "/modules-load\.d")
+ continue;
gsub(sysconfdir, "%{_sysconfdir}", $c)
}
exit(rc = 1);
}
- # get cvsaddress for changelog section
- # using rpm macros as too lazy to add ~/.adapterrc parsing support.
- _cvsmaildomain = ENVIRON["_cvsmaildomain"]
- _cvsmailfeedback = ENVIRON["_cvsmailfeedback"]
-
prefix = ENVIRON["_prefix"]
bindir = ENVIRON["_bindir"]
sbindir = ENVIRON["_sbindir"]
}
# php virtual deps as discussed in devel-en
-function replace_php_virtual_deps() {
+function replace_php_virtual_deps(field) {
pkg = $2
# if (pkg == "php-program") {
# $0 = $1 "\t/usr/bin/php"
# return
# }
-# if (pkg ~ /^php-[a-z]/ && pkg !~ /^php-(pear|common|cli|devel|fcgi|cgi|dirs|program|pecl-)/) {
-# sub(/^php-/, "php(", pkg);
-# sub(/$/, ") # verify this correctness -- it may be wanted to use specific not virtual dep", pkg);
-# $2 = pkg
-# }
+ if (field == "requires:") {
+ if (pkg ~ /^php-(bcmath|bz2|calendar|ctype|curl|dba|date|dom|enchant|exif|fileinfo|filter|fpm|ftp|gd|gettext|gmp|hash|iconv|imap|interbase|intl|json|ldap|mbstring|mcrypt|mssql|mysql|mysqli|odbc|openssl|pcntl|pcre|pdo|pdo-dblib|pdo-firebird|pdo-mysql|pdo-odbc|pdo-pgsql|pdo-sqlite|pgsql|phar|posix|pspell|readline|recode|session|shmop|simplexml|snmp|soap|sockets|spl|sqlite|sqlite3|sybase-ct|sysvmsg|sysvsem|sysvshm|tidy|tokenizer|wddx|xml|xmlreader|xmlrpc|xmlwriter|xsl|zip|zlib)/) {
+ sub(/^php-/, "php(", pkg);
+ sub(/$/, ")", pkg);
+ $2 = pkg
+ }
+ }
- if (pkg ~/^php$/) {
- $2 = "webserver(php)";
+ if (pkg == "php" || pkg == "php-common") {
+ $2 = "php(core)";
if ($4 ~ /^[0-9]:/) {
$4 = substr($4, 3);
}
}
- if (pkg ~/^php4$/) {
+ if (pkg == "php4") {
$2 = "webserver(php)";
if ($4 ~ /^[0-9]:/) {
$4 = substr($4, 3);
return group;
}
-function replace_requires() {
+function replace_pkgconfig(pkg, cmd, path, n, i, line, r) {
+ n = split("/usr/lib64/pkgconfig /usr/lib/pkgconfig /usr/share/pkgconfig", path, / /);
+ for (i = 1; i <= n; i++) {
+ cmd = "rpm -qf --qf '%{N}' " path[i] "/" pkg ".pc";
+ # Getline returns 0 on end-of-file, -1 on error, otherwise 1.
+ if ((cmd | getline line) <= 0) {
+ continue;
+ }
+
+ if (line !~ /No such file or directory/) {
+ # @modifies global $2
+ $2 = line;
+ return
+ }
+ }
+}
+
+function replace_requires(field, pkg) {
+ # pkg-config -> package names
+ if (match($2, /pkgconfig\(([^)]+)\)/)) {
+ pkg = substr($2, RSTART + 10, RLENGTH - 11);
+ replace_pkgconfig(pkg);
+ }
sub(/^python-setuptools-devel$/, "python-distribute", $2);
sub(/^gcc-g77/, "gcc-fortran", $2);
sub(/^db4-devel$/, "db-devel", $2);
sub(/^dbus-python$/, "python-dbus", $2);
sub(/^desktop-notification-daemon$/, "dbus(org.freedesktop.Notifications)", $2);
+ sub(/^elfutils-libelf-devel$/, "elfutils-devel", $2);
sub(/^file-devel$/, "libmagic-devel", $2);
sub(/^freetype2-devel$/, "freetype-devel", $2);
sub(/^fuse-devel$/, "libfuse-devel", $2);
sub(/^iscsi-initiator-utils$/, "open-iscsi", $2);
sub(/^keyutils-libs-devel$/, "keyutils-devel", $2);
sub(/^libSM-devel$/, "xorg-lib-libSM-devel", $2);
+ sub(/^libXv-devel$/, "xorg-lib-libXv-devel", $2);
+ sub(/^libxkbfile-devel$/, "xorg-lib-libxkbfile", $2);
sub(/^libX11-devel$/, "xorg-lib-libX11-devel", $2);
sub(/^libXScrnSaver-devel$/, "xorg-lib-libXScrnSaver-devel", $2);
sub(/^libXau-devel$/, "xorg-lib-libXau-devel", $2);
sub(/^libXinerama-devel$/, "xorg-lib-libXinerama-devel", $2);
sub(/^libXrandr-devel$/, "xorg-lib-libXrandr-devel", $2);
sub(/^libXrender-devel$/, "xorg-lib-libXrender-devel", $2);
+ sub(/^libXtst-devel$/, "xorg-lib-libXtst-devel", $2);
sub(/^libXxf86vm-devel$/, "xorg-lib-libXxf86vm-devel", $2);
sub(/^libacl-devel$/, "acl-devel", $2);
sub(/^libcurl-devel$/, "curl-devel", $2);
sub(/^monodoc-core$/, "mono-monodoc", $2);
sub(/^python-gtk$/, "python-pygtk-gtk", $2);
- replace_php_virtual_deps()
+ replace_php_virtual_deps(field)
}
# vim:ts=4:sw=4