X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=adapter.awk;h=e84d29ec6df1010f9597af5cf30499c770ee18a3;hb=f109b86611f0be73ab5d8ed5fd8d26618c2ac705;hp=cfb8bbacb2f21097c6dc0f0b0a1ec74250f69c53;hpb=b5861818496faeaa8eaf1af1057ea375535fbd0e;p=packages%2Fadapter.git diff --git a/adapter.awk b/adapter.awk index cfb8bba..e84d29e 100644 --- a/adapter.awk +++ b/adapter.awk @@ -2,7 +2,7 @@ # # Adapter adapts .spec files for PLD Linux. # -# Copyright (C) 1999-2014 PLD-Team +# Copyright (C) 1999-2021 PLD-Team # Authors: # Michał Kuratczyk # Sebastian Zagrodzki @@ -33,8 +33,7 @@ BEGIN { RPM_SECTIONS = "package|build|changelog|clean|description|install|post|posttrans|postun|pre|prep|pretrans|preun|triggerin|triggerpostun|triggerun|verifyscript|check" SECTIONS = "^%(" RPM_SECTIONS ")" - rev = "1.514" - VERSION = "0.36/" rev + VERSION="1.515" 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))" @@ -47,6 +46,9 @@ BEGIN { b_idx = 0 # index of BR/R arrays BR_count = 0 # number of additional BuildRequires + # %global defines + globals["nil"] = "" + # If variable removed, then 1 (for removing it from export) removed["LDFLAGS"] = 0 removed["CFLAGS"] = 0 @@ -143,6 +145,11 @@ function b_makekey(a, b, s) { } } +# load globals +/^%global/ { + globals[$2] = $3; +} + /^%define/ { # FIXME: this section will likely never match after cvs->git migration if ($2 == "date") { @@ -239,6 +246,23 @@ function b_makekey(a, b, s) { } } + # capture for URL unify in perl packages + if ($2 == "pdir") { + pdir = $3 + } + if ($2 == "pnam") { + pnam = $3 + } + if ($2 == "pkgname") { + pkgname = $3 + } + if ($2 == "pkg") { + pkg = $3 + } + if ($2 == "module") { + module = $3 + } + sub(/[ \t]+$/, "") # do nothing further, otherwise adapter thinks we're at preamble print @@ -254,6 +278,8 @@ function b_makekey(a, b, s) { /^%package/, (!/^%package/ && $0 ~ SECTIONS) { # FIXME: this breaks \t indenting in preamble? gsub(/\t/, " ") + + sub(/%{python3_pkgversion}/, "3", $2) } ################ @@ -268,6 +294,10 @@ function b_makekey(a, b, s) { format_indent = -1 } + # try ASCII quotes and apostrophes + gsub(/’/, "'") + gsub(/—/, " - ") + # Format description if (ENVIRON["SKIP_DESC"] != 1 && description == 1 && !/^%[a-z]+/ && !/^%description/) { if (/^[ \t]*$/) { @@ -350,13 +380,13 @@ function b_makekey(a, b, s) { } # invalid in %prep - sub("^rm -rf \$RPM_BUILD_ROOT.*", "") + sub("^rm -rf \\$RPM_BUILD_ROOT.*", "") } ########## # %build # ########## -/^%build/, (!/^%build/ && $0 ~ SECTIONS) { +/^%build([^A-Za-z0-9_]|$)/, (!/^%build/ && $0 ~ SECTIONS) { preamble = 0 if (did_prep == 0) { @@ -414,19 +444,21 @@ function b_makekey(a, b, s) { # use PLD Linux macros $0 = fixedsub("glib-gettextize --copy --force","%{__glib_gettextize}", $0) + $0 = fixedsub("glib-gettextize --force --copy", "%{__glib_gettextize}", $0) $0 = fixedsub("intltoolize --copy --force", "%{__intltoolize}", $0) $0 = fixedsub("automake --add-missing --copy", "%{__automake}", $0) $0 = fixedsub("automake -a --foreign --copy", "%{__automake}", $0) $0 = fixedsub("automake -a -c --foreign", "%{__automake}", $0) $0 = fixedsub("automake -a -c", "%{__automake}", $0) $0 = fixedsub("libtoolize --force --automake --copy", "%{__libtoolize}", $0) + $0 = fixedsub("libtoolize --force --copy", "%{__libtoolize}", $0) $0 = fixedsub("libtoolize -c -f --automake", "%{__libtoolize}", $0) - sub(/^aclocal$/, "%{__aclocal}") - sub(/^autoheader$/, "%{__autoheader}") - sub(/^autoconf$/, "%{__autoconf}") + sub(/^aclocal( --force)?$/, "%{__aclocal}") + sub(/^(%{_bindir}\/)?autoheader( --force)?$/, "%{__autoheader}") + sub(/^(%{_bindir}\/)?autoconf( --force)?$/, "%{__autoconf}") sub(/^automake$/, "%{__automake}") - sub(/^libtoolize$/, "%{__libtoolize}") + sub(/^libtoolize( --copy --force)?$/, "%{__libtoolize}") # atrpms $0 = fixedsub("%perl_configure", "%{__perl} Makefile.PL \\\n\tINSTALLDIRS=vendor", $0) @@ -456,6 +488,7 @@ function b_makekey(a, b, s) { sub("^%{__rm} -rf %{buildroot}", "rm -rf $RPM_BUILD_ROOT") sub("%buildroot", "$RPM_BUILD_ROOT") sub("%{buildroot}", "$RPM_BUILD_ROOT") + sub("%{\\?buildroot}", "$RPM_BUILD_ROOT") if (/^[ \t]*rm([ \t]+-[rf]+)*[ \t]+(\${?RPM_BUILD_ROOT}?|%{?buildroot}?)/ && did_rmroot==0) { did_rmroot=1 @@ -474,7 +507,7 @@ function b_makekey(a, b, s) { } if (!/%{_lib}/) { - sub("\$RPM_BUILD_ROOT/%", "$RPM_BUILD_ROOT%") + sub("\\$RPM_BUILD_ROOT/%", "$RPM_BUILD_ROOT%") } use_macros() @@ -532,15 +565,15 @@ function b_makekey(a, b, s) { preamble = 0 if (gsub("/usr/sbin/useradd", "%useradd")) { - sub(" 2> /dev/null \|\| :", "") - sub(" >/dev/null 2>&1 \|\|:", "") + sub(" 2> /dev/null \\|\\| :", "") + sub(" >/dev/null 2>&1 \\|\\|:", "") } # fedora extras macros if (/%__fe_useradd/) { sub("%__fe_useradd", "%useradd -u ") - sub(" 2> /dev/null \|\| :", "") - sub(" >/dev/null 2>&1 \|\|:", "") + sub(" 2> /dev/null \\|\\| :", "") + sub(" >/dev/null 2>&1 \\|\\|:", "") sub(" &>/dev/null \\|\\| :", "") } @@ -566,7 +599,7 @@ function b_makekey(a, b, s) { sub("update-desktop-database &> /dev/null \\|\\| :", "%update_desktop_database") sub("touch --no-create %{_datadir}/icons/hicolor", "%update_icon_cache_post hicolor") - sub("if \\[ -x %{_bindir}/gtk-update-icon-cache \\]; then\n\t%{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor \|\| :\nfi", "") + sub("if \\[ -x %{_bindir}/gtk-update-icon-cache \\]; then\n\t%{_bindir}/gtk-update-icon-cache -q %{_datadir}/icons/hicolor \\|\\| :\nfi", "") sub("export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`", "") if (/gconftool-2 --makefile-install-rule/) { @@ -694,7 +727,7 @@ preamble == 1 { $0 = format_requires($1, value) } - # BR: tar (and others) are too common (rpm-build requires it) + # BR: tar (and others) are too common (rpm-build requires them) if (field == "buildrequires:") { l = substr($0, index($0, $2)) if (l == "awk" || @@ -717,11 +750,16 @@ preamble == 1 { next } - replace_requires(field) + replace_requires() + } + + if (field ~ /triggerpostun/) { + # rpm 4.16 does not have Requires(triggerpostun): + sub(/triggerpostun/, "post", $1) } if (field == "requires:" || field ~ /^requires\(/ || field == "suggests:") { - replace_requires(field) + replace_requires() } @@ -812,6 +850,9 @@ preamble == 1 { if (l == "MPLv1.1") { l = "MPL v1.1" } + if (l == "Mozilla Public License, version 2.0") { + l = "MPL v2.0" + } $0 = "License:\t" l } @@ -848,10 +889,28 @@ preamble == 1 { if (field ~ /home-page:/) $1 = "URL:" - # proper caps - if (field ~ /^url:$/) + if (field ~ /^url:$/) { + # set proper caps $1 = "URL:" + # should not use these in URL field, for copy-paste + if (/%{pdir}/ || /%{pnam}/) { + gsub(/%{pdir}/, pdir, $2); + gsub(/%{pnam}/, pnam, $2); + } + + if (/%{pkgname}/ && pkgname) { + gsub(/%{pkgname}/, pkgname, $2); + } + + if (/%{pkg}/ && pkg) { + gsub(/%{pkg}/, pkg, $2); + } + if (/%{module}/ && module) { + gsub(/%{module}/, module, $2); + } + } + if (field ~ /^patch/) $1 = "Patch" substr(field, 6) @@ -1118,9 +1177,17 @@ function use_macros() common_macros() sub("%{_defaultdocdir}", "%{_docdir}") + sub("%{_pkgdocdir}", "%{_docdir}") sub("%{_datadir}/doc", "%{_docdir}") sub("%{_bindir}/perl", "%{__perl}") sub("%{_bindir}/python", "%{__python}") + sub("%{__python2}", "%{__python}") + sub("%{nodejs_sitelib}", "%{nodejs_libdir}") + + sub("%py2_build", "%py_build") + sub("%py2_install", "%py_install") + sub("%{py2_build}", "%py_build") + sub("%{py2_install}", "%py_install") gsub(infodir, "%{_infodir}") @@ -1134,12 +1201,15 @@ function use_macros() gsub(py_sitescriptdir, "%{py_sitescriptdir}") gsub(py_sitedir, "%{py_sitedir}") gsub(py_scriptdir, "%{py_scriptdir}") + gsub("%{python2_sitelib}", "%{py_sitescriptdir}") gsub(py3_sitescriptdir, "%{py3_sitescriptdir}") gsub(py3_sitedir, "%{py3_sitedir}") gsub(py3_scriptdir, "%{py3_scriptdir}") gsub("%{python3_sitelib}", "%{py3_sitescriptdir}") gsub("%{python3_version}", "%{py3_ver}") + gsub("%{python2_version}", "%{py_ver}") + gsub("%{python3_sitearch}", "%{py3_sitedir}") gsub(ruby_archdir, "%{ruby_archdir}") gsub(ruby_libdir, "%{ruby_libdir}") @@ -1274,7 +1344,7 @@ function use_macros() continue if ($c ~ sysconfdir "/apm") continue - if ($c ~ sysconfdir "/modules-load\.d") + if ($c ~ sysconfdir "/modules-load\\.d") continue gsub(sysconfdir, "%{_sysconfdir}", $c) } @@ -1289,6 +1359,9 @@ function use_macros() gsub(php_pear_dir, "%{php_pear_dir}") gsub(php_data_dir, "%{php_data_dir}") gsub("%{_datadir}/php", "%{php_data_dir}") + gsub("%{php_home}", "%{php_data_dir}") + gsub("%{phpdir}", "%{php_data_dir}") + gsub("%{php_extdir}", "%{php_extensiondir}") # change to %{_datadir}, with some exceptions for (c = 1; c <= NF; c++) { @@ -1301,8 +1374,10 @@ function use_macros() gsub(datadir, "%{_datadir}", $c) } - # bash completions dir, after datadir change + # completions dir, after datadir change gsub("%{_datadir}/bash-completion/completions", "%{bash_compdir}") + gsub("%{_datadir}/fish/vendor_completions.d", "%{fish_compdir}") + gsub("%{_datadir}/zsh/site-functions", "%{zsh_compdir}") gsub("%{prefix}/share", "%{_datadir}") if (prefix"/share" == datadir) @@ -1389,6 +1464,7 @@ function use_macros() gsub("%{ruby_sitearch}", "%{ruby_sitearchdir}") gsub("%{python_sitearch}", "%{py_sitedir}") gsub("%{python_sitelib}", "%{py_sitescriptdir}") + gsub("%{python2_sitearch}", "%{py_sitedir}") # alt linux gsub("%_man1dir", "%{_mandir}/man1") @@ -1404,10 +1480,11 @@ function use_macros() gsub("%optflags", "%{rpmcflags}") gsub("%{compat_perl_vendorarch}", "%{perl_vendorarch}") - gsub("^%{__make} install DESTDIR=\$RPM_BUILD_ROOT", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT") + gsub("^%{__make} install DESTDIR=\\$RPM_BUILD_ROOT", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT") gsub("^fix-info-dir$", "[ ! -x /usr/sbin/fix-info-dir ] || /usr/sbin/fix-info-dir -c %{_infodir} >/dev/null 2>\\&1") $0 = fixedsub("%buildroot", "$RPM_BUILD_ROOT", $0) $0 = fixedsub("%{buildroot}", "$RPM_BUILD_ROOT", $0) + $0 = fixedsub("%{?buildroot}", "$RPM_BUILD_ROOT", $0) $0 = fixedsub("CXXFLAGS=%{rpmcflags} %configure", "CXXFLAGS=%{rpmcflags}\n%configure", $0) $0 = fixedsub("%__install", "install", $0) @@ -1432,6 +1509,9 @@ function use_macros() gsub(/%__cat/, "cat") gsub(/%__chmod/, "chmod") + gsub(/%desktop_database_postun/, "%update_desktop_database") + gsub(/%desktop_database_post/, "%update_desktop_database") + gsub("/usr/src/linux", "%{_kernelsrcdir}") gsub("%{_prefix}/src/linux", "%{_kernelsrcdir}") @@ -1442,6 +1522,12 @@ function use_macros() add_br("BuildRequires: rpmbuild(macros) >= 1.300") } + if (/^%meson / || /^%{meson}/) { + sub(/^meson/, "%meson") + sub(/^%{meson}/, "%meson") + add_br("BuildRequires: rpmbuild(macros) >= 1.726") + } + $0 = fixedsub("%(%{__cc} -dumpversion)", "%{cc_version}", $0) $0 = fixedsub("%(%{__cxx} -dumpversion)", "%{cxx_version}", $0) @@ -1488,6 +1574,7 @@ function use_files_macros( i, n, t, a, l) } sub("^%doc %{_mandir}", "%{_mandir}") + sub("^%license", "%doc") gsub("^%{_sbindir}", "%attr(755,root,root) %{_sbindir}") gsub("^%{_bindir}", "%attr(755,root,root) %{_bindir}") @@ -1503,12 +1590,12 @@ function use_files_macros( i, n, t, a, l) } # replace back - gsub("%{_sysconfdir}/cron\.d", "/etc/cron.d") - gsub("%{_sysconfdir}/crontab\.d", "/etc/crontab.d") - gsub("%{_sysconfdir}/logrotate\.d", "/etc/logrotate.d") - gsub("%{_sysconfdir}/pam\.d", "/etc/pam.d") - gsub("%{_sysconfdir}/profile\.d", "/etc/profile.d") - gsub("%{_sysconfdir}/rc\.d", "/etc/rc.d") + gsub("%{_sysconfdir}/cron\\.d", "/etc/cron.d") + gsub("%{_sysconfdir}/crontab\\.d", "/etc/crontab.d") + gsub("%{_sysconfdir}/logrotate\\.d", "/etc/logrotate.d") + gsub("%{_sysconfdir}/pam\\.d", "/etc/pam.d") + gsub("%{_sysconfdir}/profile\\.d", "/etc/profile.d") + gsub("%{_sysconfdir}/rc\\.d", "/etc/rc.d") gsub("%{_sysconfdir}/security", "/etc/security") gsub("%{_sysconfdir}/skel", "/etc/skel") gsub("%{_sysconfdir}/sysconfig", "/etc/sysconfig") @@ -1601,7 +1688,7 @@ function use_files_macros( i, n, t, a, l) } if (/%{_mandir}/) { - gsub("\.gz$", "*") + gsub("\\.gz$", "*") gsub("%ext_man$", "*") } @@ -1654,8 +1741,8 @@ function use_files_macros( i, n, t, a, l) function use_script_macros() { if (gsub("/sbin/service", "%service")) { - sub(" >/dev/null 2>&1 \|\|:", "") - sub(" 2> /dev/null \|\| :", "") + sub(" >/dev/null 2>&1 \\|\\|:", "") + sub(" 2> /dev/null \\|\\| :", "") } } @@ -1704,7 +1791,7 @@ function cflags(var) } if (!/!\?debug/) - sub("\$RPM_OPT_FLAGS", "%{rpmcflags}") + sub("\\$RPM_OPT_FLAGS", "%{rpmcflags}") return 1 } @@ -1721,19 +1808,23 @@ function unify_url(url) # sourceforge urls # Docs about sourceforge mirror system: http://sourceforge.net/apps/trac/sourceforge/wiki/Mirrors + # 0. strip "#", rpm5 chops it off + sub("#.*", "", url) + # 1. unify domains - sub("^http://prdownloads\.sourceforge\.net/", "http://downloads.sourceforge.net/", url) - sub("^http://download\.sf\.net/", "http://downloads.sourceforge.net/", url) - sub("^http://download\.sourceforge\.net/", "http://downloads.sourceforge.net/", url) - sub("^http://dl\.sourceforge\.net/", "http://downloads.sourceforge.net/", url) - sub("^http://.*\.dl\.sourceforge\.net/", "http://downloads.sourceforge.net/", url) - sub("^http://dl\.sf\.net/", "http://downloads.sourceforge.net/", url) - sub("^http://downloads\.sourceforge\.net/sourceforge/", "http://downloads.sourceforge.net/", url) + sub("^http://prdownloads\\.sourceforge\\.net/", "http://downloads.sourceforge.net/", url) + sub("^http://download\\.sf\\.net/", "http://downloads.sourceforge.net/", url) + sub("^http://download\\.sourceforge\\.net/", "http://downloads.sourceforge.net/", url) + sub("^http://dl\\.sourceforge\\.net/", "http://downloads.sourceforge.net/", url) + sub("^http://.*\\.dl\\.sourceforge\\.net/", "http://downloads.sourceforge.net/", url) + sub("^http://dl\\.sf\\.net/", "http://downloads.sourceforge.net/", url) + sub("^http://downloads\\.sourceforge\\.net/sourceforge/", "http://downloads.sourceforge.net/", url) # 3. unify urls if (url ~ /sourceforge.net/) { sub("[?&]big_mirror=.*$", "", url) sub("[?&]modtime=.*$", "", url) + sub("[?&]r=.*$", "", url) sub("[?]use_mirror=.*$", "", url) sub("[?]download$", "", url) sub("/download$", "", url) @@ -1751,20 +1842,20 @@ function unify_url(url) url = sprintf("http://downloads.sourceforge.net/%s/%s", substr(url, 42, RLENGTH - 41), matchstr(url, "[^/]+$")) } - sub("^ftp://ftp\.gnome\.org/", "http://ftp.gnome.org/", url) - sub("^http://ftp\.gnome\.org/pub/gnome/", "http://ftp.gnome.org/pub/GNOME/", url) + sub("^ftp://ftp\\.gnome\\.org/", "http://ftp.gnome.org/", url) + sub("^http://ftp\\.gnome\\.org/pub/gnome/", "http://ftp.gnome.org/pub/GNOME/", url) # apache urls sub("^http://apache.zone-h.org/", "http://www.apache.org/dist/", url) # gnu.org - sub("^ftp://ftp\.gnu\.org/", "http://ftp.gnu.org/", url) - sub("^http://ftp\.gnu\.org/pub/gnu/", "http://ftp.gnu.org/gnu/", url) + sub("^ftp://ftp\\.gnu\\.org/", "http://ftp.gnu.org/", url) + sub("^http://ftp\\.gnu\\.org/pub/gnu/", "http://ftp.gnu.org/gnu/", url) # debian.org - sub("^ftp://ftp\.[^.]+\.debian\.org/", "ftp://ftp.debian.org/", url) - sub("^http://ftp\.[^.]+\.debian\.org/", "ftp://ftp.debian.org/", url) - sub("^ftp://ftp\.debian\.org/pub/debian/", "ftp://ftp.debian.org/debian/", url) + sub("^ftp://ftp\\.[^.]+\\.debian\\.org/", "ftp://ftp.debian.org/", url) + sub("^http://ftp\\.[^.]+\\.debian\\.org/", "ftp://ftp.debian.org/", url) + sub("^ftp://ftp\\.debian\\.org/pub/debian/", "ftp://ftp.debian.org/debian/", url) return url } @@ -1801,6 +1892,13 @@ function demacroize(str) if (subver) { sub("%{subver}", subver, str) } + + if (globals["gh_owner"]) { + sub("%{gh_owner}", globals["gh_owner"], str) + } + if (globals["gh_project"]) { + sub("%{gh_project}", globals["gh_project"], str) + } return str } @@ -1834,7 +1932,7 @@ function get_epoch(pkg, ver, epoch) # freetype = 2.0.0 -> correct # freetype = 2.1.9 -> with epoch 1, as epoch 1 was added in 2.1.7 - shell = "grep -o '^" pkg ":[^:]\+' ../PLD-doc/BuildRequires.txt | awk '{print $NF}'" + shell = "grep -o '^" pkg ":[^:]\\+' ../PLD-doc/BuildRequires.txt | awk '{print $NF}'" shell | getline epoch return epoch } @@ -1878,7 +1976,7 @@ function add_br(br) BR[BR_count++] = br } -# Load rpm macros +# {{{ Load rpm macros # you should update the list also in adapter when making changes here function import_rpm_macros( v) { # File with rpm groups @@ -1890,14 +1988,6 @@ function import_rpm_macros( v) { exit(rc = 1) } - # update this version dep each time some new macro export is added - v = 1.52 - if (!ENVIRON["ADAPTER_REVISION"] || ENVIRON["ADAPTER_REVISION"] < v) { - printf("adapter shell script is outdated: Need %s, got %s. Please update it.\n", v, ENVIRON["ADAPTER_REVISION"]) > "/dev/stderr" - do_not_touch_anything = 1 - exit(rc = 1) - } - prefix = ENVIRON["_prefix"] bindir = ENVIRON["_bindir"] sbindir = ENVIRON["_sbindir"] @@ -1956,8 +2046,9 @@ function import_rpm_macros( v) { systemduserunitdir = ENVIRON["systemduserunitdir"] systemdtmpfilesdir = ENVIRON["systemdtmpfilesdir"] } +# }}} -# replace opam names (caml) +# {{{ replace opam names (caml) function replace_opam_deps(field, name) { name = $2 if (name ~ "^(cryptokit|extlib|xmlm)$") { @@ -1982,8 +2073,9 @@ function replace_opam_deps(field, name) { $2 = name } } +# }}} -# php virtual deps as discussed in devel-en +# {{{ php virtual deps as discussed in devel-en function replace_php_virtual_deps(field) { pkg = $2 # if (pkg == "php-program") { @@ -2010,6 +2102,10 @@ function replace_php_virtual_deps(field) { } } + if (pkg == "php(language)") { + $2 = "php(core)" + } + if (pkg == "php4") { $2 = "webserver(php)" if ($4 ~ /^[0-9]:/) { @@ -2017,6 +2113,7 @@ function replace_php_virtual_deps(field) { } } } +# }}} # {{{ replace_groupnames(group) function replace_groupnames(group) { @@ -2044,6 +2141,7 @@ function replace_groupnames(group) { group = replace(group, "Development/Libraries/Java", "Development/Languages/Java") group = replace(group, "Development/Libraries/Python", "Development/Languages/Python") group = replace(group, "Development/Libraries/TCL", "Development/Languages/Tcl") + group = replace(group, "Development/Libraries/X11", "X11/Development/Libraries") group = replace(group, "Development/Other", "Development") group = replace(group, "Development/Python", "Development/Languages/Python") group = replace(group, "Development/Testing", "Development") @@ -2111,6 +2209,27 @@ function replace_pkgconfig(pkg, cmd, path, n, i, line) { } # }}} +# {{{ replace_perlmod(pkg) +function replace_perlmod(pkg, version, cmd, line) { + # do nothing if version is specified + if (version) { + return + } + cmd = "rpm -q --qf '%{N}\n' --whatprovides 'perl(" pkg ")' " + + # Getline returns 0 on end-of-file, -1 on error, otherwise 1. + if ((cmd | getline line) <= 0) { + return + } + + if (line !~ /no package provides/) { + # @modifies global $2 + $2 = line + return + } +} +# }}} + # {{{ replace_pythonegg(pkg) function replace_pythonegg(pkg, cmd, line) { cmd = "rpm -q --qf '%{N}' --whatprovides 'pythonegg(" pkg ")'" @@ -2127,7 +2246,13 @@ function replace_pythonegg(pkg, cmd, line) { } # }}} -function replace_requires(field, pkg) { +# {{{ replace_requires +function replace_requires(pkg) { # "pkg' is local variable, not an argument + # strip %{?_isa} + if ($2 ~ /_isa/) { + $2 = fixedsub("%{?_isa}", "", $2); + } + # pkg-config -> package names if (match($2, /pkgconfig\(([^)]+)\)/)) { pkg = substr($2, RSTART + 10, RLENGTH - 11) @@ -2140,6 +2265,12 @@ function replace_requires(field, pkg) { replace_pythonegg(pkg) } + # perl() -> package names + if (match($2, /perl\(([^)]+)\)/)) { + pkg = substr($2, RSTART + 5, RLENGTH - 6) + replace_perlmod(pkg, $3) + } + sub(/^python-setuptools-devel$/, "python-distribute", $2) sub(/^gcc-g77/, "gcc-fortran", $2) @@ -2240,6 +2371,7 @@ function replace_requires(field, pkg) { sub(/^PyQwt-devel$/, "python-PyQwt-devel", $2) sub(/^PyYAML$/, "python-PyYAML", $2) sub(/^ccid$/, "pcsc-driver-ccid", $2) + sub(/^cdparanoia-devel$/, "cdparanoia-III-devel", $2) sub(/^chkconfig$/, "/sbin/chkconfig", $2) sub(/^db4-devel$/, "db-devel", $2) sub(/^dbus-python$/, "python-dbus", $2) @@ -2248,6 +2380,7 @@ function replace_requires(field, pkg) { sub(/^django-tagging$/, "python-django_tagging", $2) sub(/^elfutils-libelf-devel$/, "elfutils-devel", $2) sub(/^file-devel$/, "libmagic-devel", $2) + sub(/^firebird-devel$/, "Firebird-devel", $2) sub(/^freetype2-devel$/, "freetype-devel", $2) sub(/^fuse-devel$/, "libfuse-devel", $2) sub(/^gamin-python$/, "python-gamin", $2) @@ -2257,6 +2390,7 @@ function replace_requires(field, pkg) { sub(/^gnome-python2-gconf$/, "python-gnome-gconf", $2) sub(/^gnome-python2-gnomekeyring$/, "python-gnome-desktop-keyring", $2) sub(/^gnome-python2-gtkspell$/, "python-gnome-extras-gtkspell", $2) + sub(/^gstreamer-python$/, "python-gstreamer", $2) sub(/^gtk-sharp2-devel$/, "dotnet-gtk-sharp2-devel", $2) sub(/^gtk2$/, "gtk+2", $2) sub(/^gtk2-devel$/, "gtk+2-devel", $2) @@ -2266,7 +2400,10 @@ function replace_requires(field, pkg) { sub(/^iproute$/, "iproute2", $2) sub(/^iptables-ipv6$/, "iptables", $2) sub(/^iscsi-initiator-utils$/, "open-iscsi", $2) + sub(/^kdelibs4-devel$/, "kde4-kdelibs-devel", $2) sub(/^keyutils-libs-devel$/, "keyutils-devel", $2) + sub(/^lasso-python$/, "python-lasso", $2) + sub(/^libICE-devel$/, "xorg-lib-libICE-devel", $2) sub(/^libSM-devel$/, "xorg-lib-libSM-devel", $2) sub(/^libX11-devel$/, "xorg-lib-libX11-devel", $2) sub(/^libXScrnSaver-devel$/, "xorg-lib-libXScrnSaver-devel", $2) @@ -2276,7 +2413,9 @@ function replace_requires(field, pkg) { sub(/^libXdamage-devel$/, "xorg-lib-libXdamage-devel", $2) sub(/^libXext-devel$/, "xorg-lib-libXext-devel", $2) sub(/^libXft-devel$/, "xorg-lib-libXft-devel", $2) + sub(/^libXi-devel$/, "xorg-lib-libXi-devel", $2) sub(/^libXinerama-devel$/, "xorg-lib-libXinerama-devel", $2) + sub(/^libXmu-devel$/, "xorg-lib-libXmu-devel", $2) sub(/^libXrandr-devel$/, "xorg-lib-libXrandr-devel", $2) sub(/^libXrender-devel$/, "xorg-lib-libXrender-devel", $2) sub(/^libXt-devel$/, "xorg-lib-libXt-devel", $2) @@ -2285,9 +2424,11 @@ function replace_requires(field, pkg) { sub(/^libXxf86misc-devel$/, "xorg-lib-libXxf86misc-devel", $2) sub(/^libXxf86vm-devel$/, "xorg-lib-libXxf86vm-devel", $2) sub(/^libacl-devel$/, "acl-devel", $2) + sub(/^libappstream-glib$/, "appstream-glib", $2) sub(/^libattr-devel$/, "attr-devel", $2) sub(/^libcurl-devel$/, "curl-devel", $2) sub(/^libgudev1-devel$/, "udev-glib-devel", $2) + sub(/^libicns-utils$/, "libicns", $2) sub(/^libmx-devel$/, "mx-devel", $2) sub(/^libselinux-python$/, "python-selinux", $2) sub(/^libsrtp-devel$/, "srtp-devel", $2) @@ -2300,75 +2441,106 @@ function replace_requires(field, pkg) { sub(/^libvirt-python$/, "python-libvirt", $2) sub(/^libxkbfile-devel$/, "xorg-lib-libxkbfile", $2) sub(/^libxml2-python$/, "python-libxml2", $2) + sub(/^m2crypto$/, "python-M2Crypto", $2) sub(/^mod_wsgi$/, "apache-mod_wsgi", $2) sub(/^newt-python$/, "python-snack", $2) sub(/^notify-python$/, "python-pynotify", $2) + sub(/^numpy$/, "python-numpy", $2) + sub(/^opencv-python$/, "python-opencv", $2) + sub(/^oxygen-icon-theme$/, "kde4-icons-oxygen", $2) sub(/^pcsc-lite-ccid$/, "pcsc-driver-ccid", $2) + sub(/^protobuf-python$/, "python-protobuf", $2) sub(/^pulseaudio-libs-devel$/, "pulseaudio-devel", $2) sub(/^pyOpenSSL$/, "python-pyOpenSSL", $2) sub(/^pycairo$/, "python-pycairo", $2) sub(/^pyflakes$/, "python-pyflakes", $2) + sub(/^pygame$/, "python-pygame", $2) sub(/^pygobject2$/, "python-pygobject", $2) sub(/^pygobject3$/, "python-pygobject3", $2) sub(/^pygobject3-devel$/, "python-pygobject3-common-devel", $2) + sub(/^pygpgme$/, "python-pygpgme", $2) sub(/^pygtk2$/, "python-pygtk", $2) sub(/^pygtk2-devel$/, "python-pygtk-devel", $2) sub(/^pygtk2-libglade$/, "python-pygtk-glade", $2) sub(/^pykickstart$/, "python-pykickstart", $2) + sub(/^pyliblzma$/, "python-pygpgme", $2) sub(/^pyparsing$/, "python-pyparsing", $2) sub(/^pyparted$/, "python-parted", $2) + sub(/^pyserial$/, "python-serial", $2) sub(/^pysvn$/, "python-pysvn", $2) sub(/^pytalloc$/, "python-talloc", $2) sub(/^pytalloc-devel$/, "python-talloc-devel", $2) sub(/^pytest$/, "python-pytest", $2) + sub(/^python-PyQt4-devel$/, "sip-PyQt4", $2) sub(/^python-crypto$/, "python-Crypto", $2) sub(/^python-cups$/, "python-pycups", $2) + sub(/^python-docker-py$/, "python-docker", $2) sub(/^python-enchant$/, "python-pyenchant", $2) sub(/^python-imaging$/, "python-PIL", $2) sub(/^python-imaging-tk$/, "python-PIL-tk", $2) + sub(/^python-ndg_httpsclient$/, "python-ndg-httpsclient", $2) sub(/^python-newt$/, "python-snack", $2) sub(/^python-pygtk$/, "python-pygtk-gtk", $2) sub(/^python-recaptcha-client$/, "python-recaptcha", $2) - sub(/^python-sphinx$/, "python-Sphinx", $2) + sub(/^python-sphinx$/, "sphinx-pdg", $2) + sub(/^python-sqlalchemy$/, "python-SQLAlchemy", $2) sub(/^python-twisted$/, "python-TwistedCore", $2) sub(/^python-twisted-core$/, "python-TwistedCore", $2) sub(/^python-twisted-names$/, "python-TwistedNames", $2) + sub(/^python-twisted-web$/, "python-TwistedWeb", $2) sub(/^python-unittest2$/, "python-modules", $2) + sub(/^python-uuid$/, "python-modules", $2) + sub(/^python-xlib$/, "python-Xlib", $2) + sub(/^python-zope-interface$/, "Zope-Interface", $2) + sub(/^python-zope.component$/, "Zope-Component", $2) + sub(/^python-zope.interface$/, "Zope-Interface", $2) + sub(/^python2-certifi$/, "python-certifi", $2) sub(/^python2-devel$/, "python-devel", $2) + sub(/^python3-docker-py$/, "python3-docker", $2) sub(/^pytz$/, "python-pytz", $2) sub(/^pyxdg$/, "python-pyxdg", $2) sub(/^qt4-devel$/, "qt4-build", $2) sub(/^qt4-webkit-devel$/, "QtWebKit-devel", $2) + sub(/^qt5-qtgraphicaleffects$/, "Qt5Quick-graphicaleffects", $2) + sub(/^qt5-qtquickcontrols$/, "Qt5Quick-controls", $2) + sub(/^qt5-qtwebkit-devel$/, "Qt5WebKit-devel", $2) + sub(/^qtiocompressor-devel$/, "QtIOCompressor-devel", $2) sub(/^qtlockedfile-devel$/, "QtLockedFile-devel", $2) sub(/^qtsingleapplication-devel$/, "QtSingleApplication-devel", $2) sub(/^rpm-python$/, "python-rpm", $2) + sub(/^scipy$/, "python-scipy", $2) sub(/^sip-devel$/, "python-sip-devel", $2) sub(/^tftp-server$/, "tftpdaemon", $2) sub(/^tkinter$/, "python-tkinter", $2) sub(/^urw-fonts$/, "fonts-Type1-urw", $2) sub(/^webkitgtk3-devel$/, "gtk-webkit3-devel", $2) + sub(/^webkitgtk4$/, "gtk-webkit4", $2) sub(/^xapian-bindings-python$/, "python-xapian", $2) + sub(/^xorg-x11-proto-devel$/, "xorg-proto-xproto-devel", $2) sub(/^xorg-x11-server-sdk$/, "xorg-xserver-server-devel", $2) + sub(/^xorg-x11-server-utils$/, "xorg-app-iceauth xorg-app-rgb xorg-app-sessreg xorg-app-xgamma xorg-app-xhost xorg-app-xinput xorg-app-xkill xorg-app-xmodmap xorg-app-xrandr xorg-app-xrandr xorg-app-xrefresh xorg-app-xset xorg-app-xsetpointer xorg-app-xsetroot xorg-app-xstdcmap", $2) # }}} # {{{ mandriva + sub(/^gnome-python-gconf$/, "python-gnome-gconf", $2) + sub(/^pygtk2.0$/, "python-pygtk-gtk", $2) + sub(/^python-curl$/, "python-pycurl", $2) sub(/^python-gobject-devel$/, "python-pygobject-devel", $2) sub(/^python-pyrex$/, "python-Pyrex", $2) - sub(/^webkitgtk-devel$/, "gtk-webkit-devel", $2) - sub(/^python-curl$/, "python-pycurl", $2) sub(/^python-webkitgtk$/, "python-pywebkitgtk", $2) - sub(/^pygtk2.0$/, "python-pygtk-gtk", $2) - sub(/^gnome-python-gconf$/, "python-gnome-gconf", $2) + sub(/^webkitgtk-devel$/, "gtk-webkit-devel", $2) # }}} # {{{ debian / ubuntu sub(/^blkid-dev$/, "libblkid-devel", $2) sub(/^ext2fs-dev$/, "e2fsprogs-devel", $2) sub(/^libao-dev$/, "libao-devel", $2) + sub(/^libavahi-client-dev$/, "avahi-devel", $2) sub(/^libboost-filesystem[0-9.]+-dev$/, "boost-devel", $2) sub(/^libboost-program-options[0-9.]+-dev$/, "boost-devel", $2) sub(/^libboost-regex[0-9.]+-dev$/, "boost-devel", $2) sub(/^libboost-thread[0-9.]+-dev$/, "boost-devel", $2) + sub(/^libcups2-dev$/, "cups-devel", $2) sub(/^libcurl4-openssl-dev$/, "curl-devel", $2) sub(/^libdnet-dev$/, "libdnet-devel", $2) sub(/^libesd0-dev$/, "esound-devel", $2) @@ -2390,14 +2562,14 @@ function replace_requires(field, pkg) { sub(/^libsndfile1-dev$/, "libsndfile-devel", $2) sub(/^libspeex-dev$/, "speex-devel", $2) sub(/^libssl-dev$/, "openssl-devel", $2) + sub(/^libudev$/, "udev-libs", $2) sub(/^libvorbis-dev$/, "libvorbis-devel", $2) sub(/^libxslt1-dev$/, "libxslt-devel", $2) sub(/^libxss-dev$/, "xorg-lib-libXScrnSaver-devel", $2) sub(/^mesa-common-dev$/, "OpenGL-devel", $2) - sub(/^libudev$/, "udev-libs", $2) sub(/^tcp_wrappers-devel$/, "libwrap-devel", $2) - sub(/^vala-tools$/, "vala", $2) sub(/^vala-devel$/, "vala", $2) + sub(/^vala-tools$/, "vala", $2) # }}} # {{{ altlinux @@ -2414,7 +2586,10 @@ function replace_requires(field, pkg) { # {{{ suse/opensuse sub(/^alsa-devel$/, "alsa-lib-devel", $2) - sub(/^libqt4-devel$/, "qt4-build, qt4-qmake, QtCore-devel", $2) + sub(/^binutils-gold$/, "binutils", $2) + sub(/^bitstream-vera$/, "fonts-TTF-bitstream-vera", $2) + sub(/^dbus-1-devel$/, "dbus-devel", $2) + sub(/^gconf2-devel$/, "GConf2-devel", $2) sub(/^gtk-sharp2$/, "dotnet-gtk-sharp2", $2) sub(/^gtkmm2-devel$/, "gtkmm-devel", $2) sub(/^libexpat-devel$/, "expat-devel", $2) @@ -2422,8 +2597,16 @@ function replace_requires(field, pkg) { sub(/^libffms2-devel$/, "ffms2-devel", $2) sub(/^libopenssl-devel$/, "openssl-devel", $2) sub(/^libpulse-devel$/, "pulseaudio-devel", $2) + sub(/^libqt4-devel$/, "qt4-build, qt4-qmake, QtCore-devel", $2) + sub(/^llvm-clang$/, "clang", $2) sub(/^monodoc-core$/, "mono-monodoc", $2) + sub(/^mozilla-nss-devel$/, "nss-devel", $2) + sub(/^python-Babel$/, "python-babel", $2) + sub(/^python-Django$/, "python-django", $2) + sub(/^python-Pillow$/, "python-pillow", $2) sub(/^python-cairo$/, "python-pycairo", $2) + sub(/^python-django_compressor$/, "python-django-compressor", $2) + sub(/^python-djangorestframework$/, "python-django-rest-framework", $2) sub(/^python-gobject$/, "python-pygobject", $2) sub(/^python-gstreamer-0_10$/, "python-gstreamer", $2) sub(/^python-gtk$/, "python-pygtk-gtk", $2) @@ -2434,5 +2617,6 @@ function replace_requires(field, pkg) { replace_opam_deps(field) } +# }}} # vim:ts=4:sw=4 fdm=marker