From 68a8a3b4026d850948347c8a831f382fc1c136b2 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Thu, 8 Nov 2018 19:18:36 +0100 Subject: [PATCH 01/19] misc: writevars: fix code formatting --- common.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.lua b/common.lua index 1191c1f..3f099bc 100644 --- a/common.lua +++ b/common.lua @@ -120,7 +120,7 @@ end -- @@FOO@@ with the rpm evaluation of %{foo} and -- @@BAR@@ with the rpm evaluation of %{bar} -- in myfile -local function writevars(macrofile,rpmvars) +local function writevars(macrofile, rpmvars) for _, rpmvar in ipairs(rpmvars) do print("sed -i 's\029" .. string.upper("@@" .. rpmvar .. "@@") .. "\029" .. rpm.expand( "%{" .. rpmvar .. "}" ) .. From 61ec2ef5ba8ff9c8f8da70ad89565fd63797da94 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Wed, 10 Apr 2019 23:05:46 +0200 Subject: [PATCH 02/19] forge: add pagure driver --- forge.lua | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/forge.lua b/forge.lua index 950e345..96852f7 100644 --- a/forge.lua +++ b/forge.lua @@ -19,6 +19,18 @@ local function checkforgeurl(url, id, silent) gitlab = { pattern = 'https://[^/]+/[^/]+/[^/#?]+', description = 'https://(…[-.])gitlab[-.]…/owner/repo'}, + pagure = { + pattern = 'https://[^/]+/[^/#?]+', + description = 'https://pagure.io/repo'}, + pagure_ns = { + pattern = 'https://[^/]+/[^/]+/[^/#?]+', + description = 'https://pagure.io/namespace/repo'}, + pagure_fork = { + pattern = 'https://[^/]+/fork/[^/]+/[^/#?]+', + description = 'https://pagure.io/fork/owner/repo'}, + pagure_ns_fork = { + pattern = 'https://[^/]+/fork/[^/]+/[^/]+/[^/#?]+', + description = 'https://pagure.io/fork/owner/namespace/repo'}, github = { pattern = 'https://[^/]+/[^/]+/[^/#?]+', description = 'https://(…[-.])github[-.]…/owner/repo'}, @@ -52,7 +64,17 @@ local function idforge(url, silent) rpm.expand("%{error:URLs must include a protocol such as https:// and a path starting with / !}") end else - if (string.match(forge, "^gitlab[%.-]") or string.match(forge, "[%.-]gitlab[%.]")) then + if (forge == "pagure.io") then + if string.match(url, "[^:]+://pagure.io/fork/[^/]+/[^/]+/[^/]+") then + forge = "pagure_ns_fork" + elseif string.match(url, "[^:]+://pagure.io/fork/[^/]+/[^/]+") then + forge = "pagure_fork" + elseif string.match(url, "[^:]+://pagure.io/[^/]+/[^/]+") then + forge = "pagure_ns" + elseif string.match(url, "[^:]+://pagure.io/[^/]+") then + forge = "pagure" + end + elseif (string.match(forge, "^gitlab[%.-]") or string.match(forge, "[%.-]gitlab[%.]")) then forge = "gitlab" elseif (string.match(forge, "^github[%.-]") or string.match(forge, "[%.-]github[%.]")) then forge = "github" @@ -72,7 +94,7 @@ local function meta(suffix, verbose, informative, silent) if ismain then fedora.zalias({"forgeurl", "forgesource", "forgesetupargs", "archivename", "archiveext", "archiveurl", - "topdir", "extractdir", "repo", "owner", + "topdir", "extractdir", "repo", "owner", "namespace", "scm", "tag", "commit", "shortcommit", "branch", "version", "date", "distprefix"}, verbose) end @@ -80,11 +102,33 @@ local function meta(suffix, verbose, informative, silent) default = { scm = "git", archiveext = "tar.bz2", - repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/[^/]+/([^/]+)"))}', + repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/[^/]+/([^/?#]+)"))}', archivename = "%{repo" .. suffix .. "}-%{ref" .. suffix .. "}", topdir = "%{archivename" .. suffix .. "}" }, gitlab = { archiveurl = "%{forgeurl" .. suffix .. "}/-/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" }, + pagure = { + archiveext = "tar.gz", + repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/?#]+)"))}', + archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" }, + pagure_ns = { + archiveext = "tar.gz", + namespace = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/]+)/[^/?#]+"))}', + repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/[^/]+/([^/?#]+)"))}', + archivename = "%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}", + archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" }, + pagure_fork = { + archiveext = "tar.gz", + owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/([^/]+)/[^/?#]+"))}', + repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/([^/?#]+)"))}', + archivename = "%{owner" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}", + archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" }, + pagure_ns_fork = { + owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/([^/]+)/[^/]+/[^/?#]+"))}', + namespace = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/([^/]+)/[^/?#]+")}', + repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/[^/]+/([^/?#]+)")}', + archivename = "%{owner" .. suffix .. "}-%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}", + archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" }, github = { archiveext = "tar.gz", archivename = "%{repo" .. suffix .. "}-%{fileref" .. suffix .. "}", @@ -96,7 +140,7 @@ local function meta(suffix, verbose, informative, silent) topdir = "" }, ["bitbucket.org"] = { shortcommit = '%{lua:print(string.sub(rpm.expand("%{commit' .. suffix .. '}"), 1, 12))}', - owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/]+)"))}', + owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/?#]+)"))}', archivename = "%{owner" .. suffix .. "}-%{repo" .. suffix .. "}-%{shortcommit" .. suffix .. "}", archiveurl = "%{forgeurl" .. suffix .. "}/get/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}" } } -- Packaging a moving branch is quite a bad idea, but since at least Gitlab @@ -233,7 +277,7 @@ local function meta(suffix, verbose, informative, silent) if ismain then fedora.zalias({"forgeurl", "forgesource", "forgesetupargs", "archivename", "archiveext", "archiveurl", - "topdir", "extractdir", "repo", "owner", + "topdir", "extractdir", "repo", "owner", "namespace", "scm", "shortcommit", "distprefix"}, verbose) end -- Final spec variable summary if the macro was called with -i @@ -241,7 +285,7 @@ local function meta(suffix, verbose, informative, silent) rpm.expand("%{echo:Packaging variables read or set by %%forgemeta}") fedora.echovars({"forgeurl", "forgesource", "forgesetupargs", "archivename", "archiveext", "archiveurl", - "topdir", "extractdir", "repo", "owner", + "topdir", "extractdir", "repo", "owner", "namespace", "scm", "tag", "commit", "shortcommit", "branch", "version", "date", "distprefix"}, suffix) fedora.echovars({"dist"},"") From c6773c14ed68e3ea7fc243f903d1a4657c45596f Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Thu, 8 Nov 2018 19:21:06 +0100 Subject: [PATCH 03/19] misc: listfiles: improve argument passing, simplify it and make it more robust --- macros.fedora-misc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index ca54197..f91f55c 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -1,15 +1,21 @@ # Some miscellaneous Fedora-related macros # List files matching inclusion globs, excluding files matching exclusion blogs -# Parameters: -# -i "" include shell globs (also takes all other macro arguments) -# -x "" exclude shell globs +# Optional parameters: +# – -i "" inclusion globs +# – -x "" exclusion globs +# Globs are space-separated lists of shell globs. Such lists require %{quote:} +# use for safe rpm argument passing. +# Alternatively, set the following rpm variables before calling the macro: +# – “listfiles_include” inclusion globs +# — “listfiles_exclude” exclusion globs +# Arguments passed to the macro without flags will be interpreted as inclusion +# globs. %listfiles(i:x:) %{expand: -while IFS= read -r -d $'\\n' finc ; do - printf "%s\\n" %{?-x*} \\ - | xargs -i realpath --relative-base=. '{}' \\ - | grep "${finc}" >/dev/null || echo "${finc}" -done <<< $(printf "%s\\n" %{?-i*} %* | xargs -i realpath --relative-base=. '{}' | sort -u) +while IFS= read -r finc ; do + realpath -qe --relative-base=. "" %{?-x*} %{?listfiles_exclude} \\ + | sort -u | grep -q "${finc}" || echo "${finc}" +done <<< $(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) } # https://github.com/rpm-software-management/rpm/issues/581 From 3da0ad5da84b8b99c1c3ccbc08edc7027e5902d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Persson?= Date: Fri, 7 Dec 2018 18:34:38 +0100 Subject: [PATCH 04/19] Added gpgverify. --- gpgverify | 111 +++++++++++++++++++++++++++++++++++++++++ macros.fedora-misc | 3 ++ redhat-rpm-config.spec | 8 ++- 3 files changed, 121 insertions(+), 1 deletion(-) create mode 100755 gpgverify diff --git a/gpgverify b/gpgverify new file mode 100755 index 0000000..524a396 --- /dev/null +++ b/gpgverify @@ -0,0 +1,111 @@ +#!/bin/bash + +# Copyright 2018 B. Persson, Bjorn@Rombobeorn.se +# +# This material is provided as is, with absolutely no warranty expressed +# or implied. Any use is at your own risk. +# +# Permission is hereby granted to use or copy this shellscript +# for any purpose, provided the above notices are retained on all copies. +# Permission to modify the code and to distribute modified code is granted, +# provided the above notices are retained, and a notice that the code was +# modified is included with the above copyright notice. + + +function print_help { + cat <<'EOF' +Usage: gpgverify --keyring= --signature= --data= + +gpgverify is a wrapper around gpgv designed for easy and safe scripting. It +verifies a file against a detached OpenPGP signature and a keyring. The keyring +shall contain all the keys that are trusted to certify the authenticity of the +file, and must not contain any untrusted keys. + +The differences, compared to invoking gpgv directly, are that gpgverify accepts +the keyring in either ASCII-armored or unarmored form, and that it will not +accidentally use a default keyring in addition to the specified one. + +Parameters: + --keyring= keyring with all the trusted keys and no others + --signature= detached signature to verify + --data= file to verify against the signature +EOF +} + + +fatal_error() { + message="$1" # an error message + status=$2 # a number to use as the exit code + echo "gpgverify: $message" >&2 + exit $status +} + + +require_parameter() { + term="$1" # a term for a required parameter + value="$2" # Complain and terminate if this value is empty. + if test -z "${value}" ; then + fatal_error "No ${term} was provided." 2 + fi +} + + +check_status() { + action="$1" # a string that describes the action that was attempted + status=$2 # the exit code of the command + if test $status -ne 0 ; then + fatal_error "$action failed." $status + fi +} + + +# Parse the command line. +keyring= +signature= +data= +for parameter in "$@" ; do + case "${parameter}" in + (--help) + print_help + exit + ;; + (--keyring=*) + keyring="${parameter#*=}" + ;; + (--signature=*) + signature="${parameter#*=}" + ;; + (--data=*) + data="${parameter#*=}" + ;; + (*) + fatal_error "Unknown parameter: \"${parameter}\"" 2 + ;; + esac +done +require_parameter 'keyring' "${keyring}" +require_parameter 'signature' "${signature}" +require_parameter 'data file' "${data}" + +# Make a temporary working directory. +workdir="$(mktemp --directory)" +check_status 'Making a temporary directory' $? +workring="${workdir}/keyring.gpg" + +# Decode any ASCII armor on the keyring. This is harmless if the keyring isn't +# ASCII-armored. +gpg2 --homedir="${workdir}" --yes --output="${workring}" --dearmor "${keyring}" +check_status 'Decoding the keyring' $? + +# Verify the signature using the decoded keyring. +gpgv2 --homedir="${workdir}" --keyring="${workring}" "${signature}" "${data}" +check_status 'Signature verification' $? + +# (--homedir isn't actually necessary. --dearmor processes only the input file, +# and if --keyring is used and contains a slash, then gpgv2 uses only that +# keyring. Thus neither command will look for a default keyring, but --homedir +# makes extra double sure that no default keyring will be touched in case +# another version of GPG works differently.) + +# Clean up. (This is not done in case of an error that may need inspection.) +rm --recursive --force ${workdir} diff --git a/macros.fedora-misc b/macros.fedora-misc index f91f55c..9d4a3ac 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -34,3 +34,6 @@ for i = 1, rpm.expand("%#") do end fedora.writevars(macrofile,rpmvars) } + +# gpgverify verifies signed sources. There is documentation in the script. +%gpgverify %{_rpmconfigdir}/redhat/gpgverify diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 8685873..622cc57 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 128 +Version: 129 Release: 1%{?dist} # No version specified. License: GPL+ @@ -61,6 +61,7 @@ Source400: dist.sh Source401: rpmsort Source402: symset-table Source403: kmodtool +Source404: gpgverify # 2016-10-02 snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git Source500: config.guess @@ -140,6 +141,7 @@ install -p -m 444 -t %{buildroot}%{rrcdir} redhat-hardened-* install -p -m 444 -t %{buildroot}%{rrcdir} redhat-annobin-* install -p -m 755 -t %{buildroot}%{rrcdir} config.* install -p -m 755 -t %{buildroot}%{rrcdir} dist.sh rpmsort symset-table kmodtool +install -p -m 755 -t %{buildroot}%{rrcdir} gpgverify install -p -m 755 -t %{buildroot}%{rrcdir} brp-* install -p -m 755 -t %{buildroot}%{rrcdir} find-* @@ -165,6 +167,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{rrcdir}/rpmrc %{rrcdir}/brp-* %{rrcdir}/dist.sh +%{rrcdir}/gpgverify %{rrcdir}/redhat-hardened-* %{rrcdir}/redhat-annobin-* %{rrcdir}/config.* @@ -199,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Thu May 30 2019 Björn Persson - 129-1 +- Added gpgverify. + * Tue Jan 15 2019 Panu Matilainen - 128-1 - Drop redundant _smp_mflag re-definition, use the one from rpm instead From 8394d3cf12e5e47379b8930609682c3d4dd84ef0 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Thu, 8 Nov 2018 19:21:06 +0100 Subject: [PATCH 05/19] misc: add a wordwrap helper --- common.lua | 49 +++++++++++++++++++++++++++++++++++++++++ macros.fedora-misc-srpm | 11 +++++++++ 2 files changed, 60 insertions(+) diff --git a/common.lua b/common.lua index 3f099bc..0f28a8d 100644 --- a/common.lua +++ b/common.lua @@ -128,6 +128,54 @@ local function writevars(macrofile, rpmvars) end end +-- https://github.com/rpm-software-management/rpm/issues/566 +-- Reformat a text intended to be used used in a package description, removing +-- rpm macro generation artefacts. +-- – remove leading and ending empty lines +-- – trim intermediary empty lines to a single line +-- – fold on spaces +-- Should really be a %%{wordwrap:…} verb +local function wordwrap(text) + text = rpm.expand(text .. "\n") + text = string.gsub(text, "\t", " ") + text = string.gsub(text, " +\n", "\n") + text = string.gsub(text, "\n+\n", "\n\n") + text = string.gsub(text, "^\n", "") + text = string.gsub(text, "\n( *)[-*—][  ]+", "\n%1– ") + output = "" + for line in string.gmatch(text, "[^\n]*\n") do + local pos = 0 + local advance = "" + for word in string.gmatch(line, "%s*[^%s]*\n?") do + local wl, bad = utf8.len(word) + if not wl then + print("%{warn: Invalid UTF-8 sequence detected in:\n" .. + word .. "\nIt may produce unexpected results.\n}") + wl = bad + end + if (pos == 0) then + advance = string.gsub(word, "^(%s*).*", "%1") + pos = pos + wl + elseif (pos + wl < 81) then + pos = pos + wl + else + word = advance .. string.gsub(word, "^%s*", "") + output = output .. "\n" + pos = utf8.len(word) + end + output = output .. word + if pos > 80 then + pos = 0 + if not string.match(word, "\n$") then + output = output .. "\n" + end + end + end + end + output = string.gsub(output, "\n*$", "\n") + return output +end + return { explicitset = explicitset, explicitunset = explicitunset, @@ -139,4 +187,5 @@ return { getsuffixes = getsuffixes, getbestsuffix = getbestsuffix, writevars = writevars, + wordwrap = wordwrap, } diff --git a/macros.fedora-misc-srpm b/macros.fedora-misc-srpm index 98aa6c2..3431190 100644 --- a/macros.fedora-misc-srpm +++ b/macros.fedora-misc-srpm @@ -9,3 +9,14 @@ # A directory for SWID tag files describing the installation %_swidtagdir %{_prefix}/lib/swidtag/fedoraproject.org + +# A helper to apply the fedora.wordwrap filter to the content of an rpm +# variable, and print the result. Optional parameter: +# – -v (default value: _description) +# Putting multiple lines of UTF-8 text inside a variable is usually +# accomplished with a %%{expand: some_text}. +%wordwrap(v:) %{lua: +local fedora = require "fedora.common" +local variable = "%{" .. rpm.expand("%{-v*}%{!-v:_description}") .. "}" +print(fedora.wordwrap(variable)) +} From 02f4a20583a595f9b9ff184d18c4b0753bcf118f Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Mon, 3 Jun 2019 00:38:59 +0200 Subject: [PATCH 06/19] misc: protect listfiles against empty input, to avoid harmless but annoying messages in build logs --- macros.fedora-misc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index 9d4a3ac..3bd1498 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -12,10 +12,17 @@ # Arguments passed to the macro without flags will be interpreted as inclusion # globs. %listfiles(i:x:) %{expand: -while IFS= read -r finc ; do - realpath -qe --relative-base=. "" %{?-x*} %{?listfiles_exclude} \\ - | sort -u | grep -q "${finc}" || echo "${finc}" -done <<< $(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) +%if "%{?-i*}%{?listfiles_include}%*" != "" + listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) + %if "%{?-x*}%{?listfiles_exclude}" != "" + while IFS= read -r finc ; do + realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\ + | sort -u | grep -q "${finc}" || echo "${finc}" + done <<< "${listfiles_include}" + %else + echo "${listfiles_include}" + %endif +%endif } # https://github.com/rpm-software-management/rpm/issues/581 From 5878df46c0420e73982c60afe776338d50cd8377 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 4 Jun 2019 08:25:50 +0200 Subject: [PATCH 07/19] Bump release Signed-off-by: Igor Gnatenko --- redhat-rpm-config.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 622cc57..aabc3cf 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 129 +Version: 130 Release: 1%{?dist} # No version specified. License: GPL+ @@ -202,6 +202,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Tue Jun 04 2019 Igor Gnatenko - 130-1 +- New macro for wrapping text — %%wordwrap +- Smal fix for %%listfiles with no arguments + * Thu May 30 2019 Björn Persson - 129-1 - Added gpgverify. From bab65715b220a5c95d886ed1d01822203558f946 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 10 Jun 2019 14:12:21 +0300 Subject: [PATCH 08/19] Provide temporary shelter for rpm 4.15 perl macro refugees Rpm 4.15 removes various language-specific macros. Python side is already covered by the versioned python macros but this is not the case with Perl, macros. Add them here temporarily to avoid breaking the world, but these really belong to perl-macros or such. --- macros | 11 +++++++++++ redhat-rpm-config.spec | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/macros b/macros index 3fe9244..156ee66 100644 --- a/macros +++ b/macros @@ -263,3 +263,14 @@ print(result) %global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \ %global __find_requires /bin/sh -c "%{?__filter_req_cmd} %{__deploop R} %{?__filter_from_req}" \ } + +# Temporary shelter for rpm 4.15 refugees +%__perl %{_bindir}/perl +%requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") +%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) +%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) +%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) +%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) +%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) +%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) + diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index aabc3cf..44257ad 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 130 +Version: 131 Release: 1%{?dist} # No version specified. License: GPL+ @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Mon Jun 10 2019 Panu Matilainen - 131-1 +- Provide temporary shelter for rpm 4.15 perl macro refugees + * Tue Jun 04 2019 Igor Gnatenko - 130-1 - New macro for wrapping text — %%wordwrap - Smal fix for %%listfiles with no arguments From c68c6bd353b331270afbdb93e6b07884e3369a75 Mon Sep 17 00:00:00 2001 From: Jitka Plesnikova Date: Wed, 12 Jun 2019 12:54:26 +0200 Subject: [PATCH 09/19] Remove perl macro refugees --- macros | 8 -------- redhat-rpm-config.spec | 5 ++++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/macros b/macros index 156ee66..1e29038 100644 --- a/macros +++ b/macros @@ -265,12 +265,4 @@ print(result) } # Temporary shelter for rpm 4.15 refugees -%__perl %{_bindir}/perl %requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") -%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) -%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) -%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) -%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) -%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) -%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) - diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 44257ad..afeafde 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 131 +Version: 132 Release: 1%{?dist} # No version specified. License: GPL+ @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Tue Jun 11 2019 Jitka Plesnikova - 132-1 +- Remove perl macro refugees + * Mon Jun 10 2019 Panu Matilainen - 131-1 - Provide temporary shelter for rpm 4.15 perl macro refugees From 29b504fa55c31bb3f438037e5b83e1b64697b4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Mon, 24 Jun 2019 22:47:59 +0000 Subject: [PATCH 10/19] Expand listfiles_include and listfiles_exclude in condition listfiles_include and listfiles_exclude can contain multiline data that should be expanded, otherwise it breaks the if condition on newlines. --- macros.fedora-misc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index 3bd1498..a73b7c5 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -12,9 +12,9 @@ # Arguments passed to the macro without flags will be interpreted as inclusion # globs. %listfiles(i:x:) %{expand: -%if "%{?-i*}%{?listfiles_include}%*" != "" +%if "%{?-i*}%{expand:?listfiles_include}%*" != "" listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) - %if "%{?-x*}%{?listfiles_exclude}" != "" + %if "%{?-x*}%{expand:?listfiles_exclude}" != "" while IFS= read -r finc ; do realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\ | sort -u | grep -q "${finc}" || echo "${finc}" From 6708d7876e06315b70d7fc469e73e4fbff3b81ee Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 25 Jun 2019 08:14:09 +0200 Subject: [PATCH 11/19] Bump release Signed-off-by: Igor Gnatenko --- redhat-rpm-config.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index afeafde..22b6b85 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 132 +Version: 133 Release: 1%{?dist} # No version specified. License: GPL+ @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Tue Jun 25 08:13:50 CEST 2019 Igor Gnatenko - 133-1 +- Expand listfiles_exclude/listfiles/include + * Tue Jun 11 2019 Jitka Plesnikova - 132-1 - Remove perl macro refugees From 86aae600e62fadc18760d95d1fddd323cf9e9a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Thu, 20 Jun 2019 07:29:07 +0200 Subject: [PATCH 12/19] Enable RPM to set SOURCE_DATE_EPOCH environment variable. If %source_date_epoch_from_changelog is true, RPM can set the SOURCE_DATE_EPOCH environment variable to the timestamp of the topmost changelog entry. The SOURCE_DATE_EPOCH can be in turn used by various projects to override otherwise dynamically generated timestamps. E.g. this might help to have stable timestamps in generated documentation etc. --- macros | 2 ++ redhat-rpm-config.spec | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/macros b/macros index 1e29038..ca94d8e 100644 --- a/macros +++ b/macros @@ -18,6 +18,8 @@ %_fmoddir %{_libdir}/gfortran/modules +%source_date_epoch_from_changelog 1 + %_enable_debug_packages 1 %_include_minidebuginfo 1 %_include_gdb_index 1 diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 22b6b85..7c7fede 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -7,7 +7,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config Version: 133 -Release: 1%{?dist} +Release: 2%{?dist} # No version specified. License: GPL+ URL: https://src.fedoraproject.org/rpms/redhat-rpm-config @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Thu Jun 27 2019 Vít Ondruch - 133-2 +- Enable RPM to set SOURCE_DATE_EPOCH environment variable. + * Tue Jun 25 08:13:50 CEST 2019 Igor Gnatenko - 133-1 - Expand listfiles_exclude/listfiles/include From 38d0d92d5c6e265056ecc50f1cc2af8de6175629 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Mon, 1 Jul 2019 14:19:40 +0000 Subject: [PATCH 13/19] Switch binary payload compression to Zstandard level 19 Fedora Change: https://fedoraproject.org/w/index.php?title=Changes/Switch_RPMs_to_zstd_compression Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1720729 Fesco ticket: https://pagure.io/fesco/issue/2144 Rel-eng ticket: https://pagure.io/releng/issue/8395 --- macros | 4 ++-- redhat-rpm-config.spec | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/macros b/macros index ca94d8e..4b6674e 100644 --- a/macros +++ b/macros @@ -195,8 +195,8 @@ print(result) %_source_filedigest_algorithm 8 %_binary_filedigest_algorithm 8 -# Use XZ compression for binary payloads -%_binary_payload w2.xzdio +# Use Zstandard compression for binary payloads +%_binary_payload w19.zstdio %_hardening_cflags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 # we don't escape symbols '~', '"', etc. so be careful when changing this diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 7c7fede..22103ea 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,8 +6,8 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 133 -Release: 2%{?dist} +Version: 134 +Release: 1%{?dist} # No version specified. License: GPL+ URL: https://src.fedoraproject.org/rpms/redhat-rpm-config From 6b139317d533ceece81eb16432759babd7781756 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Mon, 1 Jul 2019 17:12:12 +0200 Subject: [PATCH 14/19] Add changelog entry for previous change --- redhat-rpm-config.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 22103ea..ed2d550 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Mon Jul 01 2019 Florian Festi - 134-1 +- Switch binary payload compression to Zstandard level 19 + * Thu Jun 27 2019 Vít Ondruch - 133-2 - Enable RPM to set SOURCE_DATE_EPOCH environment variable. From 9deb0680eb7f4b757f12f5798afb3c1c49a4d7e1 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Sun, 7 Jul 2019 16:19:40 +0200 Subject: [PATCH 15/19] listfiles: fix expansion of listfiles_exclude/listfiles_include --- macros.fedora-misc | 4 ++-- redhat-rpm-config.spec | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index a73b7c5..9ce85cf 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -12,9 +12,9 @@ # Arguments passed to the macro without flags will be interpreted as inclusion # globs. %listfiles(i:x:) %{expand: -%if "%{?-i*}%{expand:?listfiles_include}%*" != "" +%if "%{?-i*}%{expand:%{?listfiles_include}}%*" != "" listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) - %if "%{?-x*}%{expand:?listfiles_exclude}" != "" + %if "%{?-x*}%{expand:%{?listfiles_exclude}}" != "" while IFS= read -r finc ; do realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\ | sort -u | grep -q "${finc}" || echo "${finc}" diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index ed2d550..30399fc 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 134 +Version: 135 Release: 1%{?dist} # No version specified. License: GPL+ @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Mon Jul 08 2019 Nicolas Mailhot - 135-1 +- Fix expansion in listfiles_exclude/listfiles_include + * Mon Jul 01 2019 Florian Festi - 134-1 - Switch binary payload compression to Zstandard level 19 @@ -209,7 +212,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua - Enable RPM to set SOURCE_DATE_EPOCH environment variable. * Tue Jun 25 08:13:50 CEST 2019 Igor Gnatenko - 133-1 -- Expand listfiles_exclude/listfiles/include +- Expand listfiles_exclude/listfiles_include * Tue Jun 11 2019 Jitka Plesnikova - 132-1 - Remove perl macro refugees From 1e9cb0e9707727bbc76edb6b2bdf2326ea540fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Mon, 8 Jul 2019 17:10:01 +0200 Subject: [PATCH 16/19] Revert "listfiles: fix expansion of listfiles_exclude/listfiles_include" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9deb0680eb7f4b757f12f5798afb3c1c49a4d7e1. Signed-off-by: Robert-André Mauchin --- macros.fedora-misc | 4 ++-- redhat-rpm-config.spec | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index 9ce85cf..a73b7c5 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -12,9 +12,9 @@ # Arguments passed to the macro without flags will be interpreted as inclusion # globs. %listfiles(i:x:) %{expand: -%if "%{?-i*}%{expand:%{?listfiles_include}}%*" != "" +%if "%{?-i*}%{expand:?listfiles_include}%*" != "" listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) - %if "%{?-x*}%{expand:%{?listfiles_exclude}}" != "" + %if "%{?-x*}%{expand:?listfiles_exclude}" != "" while IFS= read -r finc ; do realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\ | sort -u | grep -q "${finc}" || echo "${finc}" diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 30399fc..e95837d 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 135 +Version: 136 Release: 1%{?dist} # No version specified. License: GPL+ @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Mon Jul 08 2019 Robert-André Mauchin - 136-1 +- Revert "Fix expansion in listfiles_exclude/listfiles_include" + * Mon Jul 08 2019 Nicolas Mailhot - 135-1 - Fix expansion in listfiles_exclude/listfiles_include From 1f7310110e6d16ae187c11107779000e7a6dcaed Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Mon, 8 Jul 2019 00:30:14 +0200 Subject: [PATCH 17/19] wordwrap: make list indenting smarter, to produce something with enough structure that it can be converted into AppStream metadata --- common.lua | 6 +++++- redhat-rpm-config.spec | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common.lua b/common.lua index 0f28a8d..e087a1c 100644 --- a/common.lua +++ b/common.lua @@ -154,7 +154,11 @@ local function wordwrap(text) wl = bad end if (pos == 0) then - advance = string.gsub(word, "^(%s*).*", "%1") + advance, n = string.gsub(word, "^(%s*– ).*", "%1") + if (n == 0) then + advance = string.gsub(word, "^(%s*).*", "%1") + end + advance = string.gsub(advance, "– ", " ") pos = pos + wl elseif (pos + wl < 81) then pos = pos + wl diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index e95837d..13d4662 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -202,6 +202,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +- wordwrap: make list indenting smarter, to produce something with enough + structure that it can be converted into AppStream metadata + * Mon Jul 08 2019 Robert-André Mauchin - 136-1 - Revert "Fix expansion in listfiles_exclude/listfiles_include" From b8797dcd025c34ee9495c30ad86c193445b63df9 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Mon, 8 Jul 2019 23:28:50 +0200 Subject: [PATCH 18/19] =?UTF-8?q?listfiles:=20make=20it=20robust=20against?= =?UTF-8?q?=20all=20kinds=20of=20=E2=80=9Cinteresting=E2=80=9D=20input=20?= =?UTF-8?q?=20=E2=80=93=C2=A0restore=20protection=20against=20empty=20inpu?= =?UTF-8?q?t=20=20=E2=80=93=C2=A0handle=20non-empty=20inputs,=20with=20whi?= =?UTF-8?q?tespace,=20quotes,=20linebreaks,=20etc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- macros.fedora-misc | 4 ++-- redhat-rpm-config.spec | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/macros.fedora-misc b/macros.fedora-misc index a73b7c5..83e455a 100644 --- a/macros.fedora-misc +++ b/macros.fedora-misc @@ -12,9 +12,9 @@ # Arguments passed to the macro without flags will be interpreted as inclusion # globs. %listfiles(i:x:) %{expand: -%if "%{?-i*}%{expand:?listfiles_include}%*" != "" +%if %{lua: print(string.len(rpm.expand("%{?-i*}%{?listfiles_include}%*")))} listfiles_include=$(realpath -e --relative-base=. %{?-i*} %{?listfiles_include} %* | sort -u) - %if "%{?-x*}%{expand:?listfiles_exclude}" != "" + %if %{lua: print(string.len(rpm.expand("%{?-x*}%{?listfiles_exclude}")))} while IFS= read -r finc ; do realpath -qe --relative-base=. %{?-x*} %{?listfiles_exclude} \\ | sort -u | grep -q "${finc}" || echo "${finc}" diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 13d4662..9acd12b 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -202,6 +202,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +- listfiles: make it robust against all kinds of “interesting” inputs - wordwrap: make list indenting smarter, to produce something with enough structure that it can be converted into AppStream metadata From faef29eb93a056c8537d93012dd6f2336c5093a9 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Mon, 8 Jul 2019 23:32:20 +0200 Subject: [PATCH 19/19] bump release --- redhat-rpm-config.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 9acd12b..1b8da5e 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 136 +Version: 137 Release: 1%{?dist} # No version specified. License: GPL+ @@ -202,6 +202,7 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Mon Jul 08 2019 Nicolas Mailhot - 137-1 - listfiles: make it robust against all kinds of “interesting” inputs - wordwrap: make list indenting smarter, to produce something with enough structure that it can be converted into AppStream metadata