X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=adapter.awk;h=e84d29ec6df1010f9597af5cf30499c770ee18a3;hb=f109b86611f0be73ab5d8ed5fd8d26618c2ac705;hp=676bedce85eca7e52926eeb679ccc0d2308da1ad;hpb=75571d38f8cb90a116af1959582fc069be5b134d;p=packages%2Fadapter.git diff --git a/adapter.awk b/adapter.awk index 676bedc..e84d29e 100644 --- a/adapter.awk +++ b/adapter.awk @@ -2,7 +2,7 @@ # # Adapter adapts .spec files for PLD Linux. # -# Copyright (C) 1999-2013 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,12 +145,12 @@ function b_makekey(a, b, s) { } } -/^%define/ { - # Remove defining _applnkdir (this macro has been included in rpm-3.0.4) - if ($2 == "_applnkdir") { - next - } +# load globals +/^%global/ { + globals[$2] = $3; +} +/^%define/ { # FIXME: this section will likely never match after cvs->git migration if ($2 == "date") { if (did_files == 0) { @@ -244,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 @@ -257,7 +276,10 @@ function b_makekey(a, b, s) { # %package part /^%package/, (!/^%package/ && $0 ~ SECTIONS) { + # FIXME: this breaks \t indenting in preamble? gsub(/\t/, " ") + + sub(/%{python3_pkgversion}/, "3", $2) } ################ @@ -272,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]*$/) { @@ -354,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) { @@ -418,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) @@ -460,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 @@ -478,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() @@ -509,11 +538,9 @@ function b_makekey(a, b, s) { if ($1 ~ /chmod/ && $2 ~ /644/) next - # atrpms $0 = fixedsub("%perl_makeinstall", "%{__make} pure_install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0) - - # alt linux $0 = fixedsub("%make_install DESTDIR=$RPM_BUILD_ROOT install", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0) + $0 = fixedsub("%make_install", "%{__make} install \\\n\tDESTDIR=$RPM_BUILD_ROOT", $0) } ########## @@ -538,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 \\|\\| :", "") } @@ -572,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/) { @@ -646,6 +673,11 @@ preamble == 1 { $1 = "Requires:" } + # deprecated. such deps are autogenerated in rpm5 + if ($0 == "%{?ruby_mod_ver_requires_eq}") { + next + } + # F<16 had requires(hint) if (/^Requires\(hint\):/) { $1 = "Suggests:" @@ -695,7 +727,7 @@ preamble == 1 { $0 = format_requires($1, value) } - # BR: tar (and others) is to 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" || @@ -718,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() } @@ -741,6 +778,11 @@ preamble == 1 { $1 = "License:" } + if (field == "buildarch:") { + $1 = "BuildArch:" + } + + # ease updating from debian .dsc if (field ~ /homepage:/) { $1 = "URL:" @@ -763,6 +805,7 @@ preamble == 1 { if (l == "Apache License 2.0" || \ l == "Apache 2.0" || \ l == "Apache 2" || \ + l == "Apache-2.0" || \ l == "Apache License (2.0)" || l == "Apache License Version 2.0" || \ l == "Apache License, Version 2.0" || \ @@ -807,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 } @@ -843,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) @@ -966,6 +1030,7 @@ ENVIRON["SKIP_SORTBR"] != 1 && preamble == 1 && $0 ~ PREAMBLE_TAGS ":", $0 ~ PRE if ($1 == "R:" ) { $1 = "Requires:" } + common_macros() format_preamble() # kill_preamble_macros(); # breaks tabbing @@ -1058,6 +1123,23 @@ function replace(s, s1, s2) { } } +# replace common macros +function common_macros() { + gsub(/%name/, "%{name}") + gsub(/%version/, "%{version}") + gsub(/%release/, "%{release}") + gsub(/%epoch/, "%{epoch}") + gsub(/%_sysconfdir/, "%{_sysconfdir}") + gsub(/%_unitdir/, "%{systemdunitdir}") + gsub(/%_initdir/, "/etc/rc.d/init.d") + gsub(/%_man1dir/, "%{_mandir}/man1") + gsub(/%_man2dir/, "%{_mandir}/man2") + gsub(/%_man3dir/, "%{_mandir}/man3") + gsub(/%_man5dir/, "%{_mandir}/man5") + gsub(/%_man8dir/, "%{_mandir}/man8") + +} + # There should be one or two tabs after the colon. function format_preamble() { @@ -1092,10 +1174,20 @@ function use_macros() return } + 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}") @@ -1109,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}") @@ -1136,6 +1231,7 @@ function use_macros() gsub(systemduserunitdir, "%{systemduserunitdir}") gsub(systemdtmpfilesdir, "%{systemdtmpfilesdir}") gsub("%{_tmpfilesdir}", "%{systemdtmpfilesdir}") + gsub("%{_prefix}/lib/tmpfiles.d", "%{systemdtmpfilesdir}") gsub("%{_datadir}/applications", "%{_desktopdir}") gsub("%{_datadir}/pixmaps", "%{_pixmapsdir}") @@ -1248,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) } @@ -1262,7 +1358,12 @@ 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++) { if ($c ~ datadir "/automake") continue @@ -1273,6 +1374,11 @@ function use_macros() gsub(datadir, "%{_datadir}", $c) } + # 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) gsub("%{_prefix}/share", "%{_datadir}") @@ -1358,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") @@ -1373,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) @@ -1401,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}") @@ -1411,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) @@ -1457,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}") @@ -1472,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") @@ -1570,7 +1688,7 @@ function use_files_macros( i, n, t, a, l) } if (/%{_mandir}/) { - gsub("\.gz$", "*") + gsub("\\.gz$", "*") gsub("%ext_man$", "*") } @@ -1623,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 \\|\\| :", "") } } @@ -1673,7 +1791,7 @@ function cflags(var) } if (!/!\?debug/) - sub("\$RPM_OPT_FLAGS", "%{rpmcflags}") + sub("\\$RPM_OPT_FLAGS", "%{rpmcflags}") return 1 } @@ -1690,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) @@ -1720,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 } @@ -1770,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 } @@ -1803,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 } @@ -1847,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 @@ -1859,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"] @@ -1925,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)$") { @@ -1951,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") { @@ -1965,6 +2088,10 @@ function replace_php_virtual_deps(field) { sub(/^php-/, "php(", pkg) sub(/$/, ")", pkg) $2 = pkg + } else if (pkg ~ /^php-pecl-/) { + sub(/^php-pecl-/, "php(", pkg) + sub(/$/, ")", pkg) + $2 = pkg } } @@ -1975,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]:/) { @@ -1982,6 +2113,7 @@ function replace_php_virtual_deps(field) { } } } +# }}} # {{{ replace_groupnames(group) function replace_groupnames(group) { @@ -2009,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") @@ -2032,6 +2165,7 @@ function replace_groupnames(group) { group = replace(group, "System Tools", "Applications/System") group = replace(group, "System", "Base") group = replace(group, "System/Base", "Base") + group = replace(group, "System/Configuration/Networking", "Applications/Networking") group = replace(group, "System/Kernel and hardware", "Base/Kernel") group = replace(group, "System/Libraries", "Libraries") group = replace(group, "System/Servers", "Daemons") @@ -2075,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 ")'" @@ -2091,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) @@ -2104,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) @@ -2113,6 +2280,8 @@ function replace_requires(field, pkg) { # bad package.xml, see http://pear.php.net/bugs/bug.php?id=17779 sub(/^php-php-gtk/, "php-gtk2", $2) + sub(/^rake/, "ruby-rake", $2) + # {{{ jpackages / fedora java packages sub(/^antlr3$/, "java-antlr3", $2) sub(/^aqute-bnd$/, "java-bnd", $2) @@ -2202,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) @@ -2210,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) @@ -2219,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) @@ -2228,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) @@ -2238,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) @@ -2247,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) @@ -2259,75 +2438,109 @@ function replace_requires(field, pkg) { sub(/^libtevent-devel$/, "tevent-devel", $2) sub(/^libusb1-devel$/, "libusb-devel", $2) sub(/^libuser-python$/, "python-libuser", $2) + 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) @@ -2349,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 @@ -2373,14 +2586,27 @@ function replace_requires(field, pkg) { # {{{ suse/opensuse sub(/^alsa-devel$/, "alsa-lib-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) sub(/^libffmpeg-devel$/, "ffmpeg-devel", $2) + 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) @@ -2391,5 +2617,6 @@ function replace_requires(field, pkg) { replace_opam_deps(field) } +# }}} # vim:ts=4:sw=4 fdm=marker