forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
-- Convenience Lua functions that can be used within rpm macros
|
|
|
|
|
|
|
|
|
|
-- Set a spec variable
|
|
|
|
|
-- Echo the result if verbose
|
2018-11-08 18:18:36 +00:00
|
|
|
|
local function explicitset(rpmvar, value, verbose)
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
local value = value
|
|
|
|
|
if (value == nil) or (value == "") then
|
|
|
|
|
value = "%{nil}"
|
|
|
|
|
end
|
|
|
|
|
rpm.define(rpmvar .. " " .. value)
|
|
|
|
|
if verbose then
|
|
|
|
|
rpm.expand("%{echo:Setting %%{" .. rpmvar .. "} = " .. value .. "}")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Unset a spec variable if it is defined
|
|
|
|
|
-- Echo the result if verbose
|
2018-11-08 18:18:36 +00:00
|
|
|
|
local function explicitunset(rpmvar, verbose)
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
if (rpm.expand("%{" .. rpmvar .. "}") ~= "%{" .. rpmvar .. "}") then
|
|
|
|
|
rpm.define(rpmvar .. " %{nil}")
|
|
|
|
|
if verbose then
|
|
|
|
|
rpm.expand("%{echo:Unsetting %%{" .. rpmvar .. "}}")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Set a spec variable, if not already set
|
|
|
|
|
-- Echo the result if verbose
|
2018-11-08 18:18:36 +00:00
|
|
|
|
local function safeset(rpmvar, value, verbose)
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
if (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then
|
|
|
|
|
explicitset(rpmvar,value,verbose)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Alias a list of rpm variables to the same variables suffixed with 0 (and vice versa)
|
|
|
|
|
-- Echo the result if verbose
|
2018-11-08 18:18:36 +00:00
|
|
|
|
local function zalias(rpmvars, verbose)
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
for _, sfx in ipairs({{"","0"},{"0",""}}) do
|
|
|
|
|
for _, rpmvar in ipairs(rpmvars) do
|
|
|
|
|
local toalias = "%{?" .. rpmvar .. sfx[1] .. "}"
|
|
|
|
|
if (rpm.expand(toalias) ~= "") then
|
|
|
|
|
safeset(rpmvar .. sfx[2], toalias, verbose)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2018-11-08 18:18:36 +00:00
|
|
|
|
-- Takes a list of rpm variable roots and a suffix and alias current<root> to
|
|
|
|
|
-- <root><suffix> if it resolves to something not empty
|
|
|
|
|
local function setcurrent(rpmvars, suffix, verbose)
|
|
|
|
|
for _, rpmvar in ipairs(rpmvars) do
|
|
|
|
|
if (rpm.expand("%{?" .. rpmvar .. suffix .. "}") ~= "") then
|
|
|
|
|
explicitset( "current" .. rpmvar, "%{" .. rpmvar .. suffix .. "}", verbose)
|
|
|
|
|
else
|
|
|
|
|
explicitunset("current" .. rpmvar, verbose)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
-- Echo the list of rpm variables, with suffix, if set
|
|
|
|
|
local function echovars(rpmvars, suffix)
|
|
|
|
|
for _, rpmvar in ipairs(rpmvars) do
|
|
|
|
|
rpmvar = rpmvar .. suffix
|
|
|
|
|
local header = string.sub(" " .. rpmvar .. ": ",1,21)
|
|
|
|
|
rpm.expand("%{?" .. rpmvar .. ":%{echo:" .. header .. "%{?" .. rpmvar .. "}}}")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Returns an array, indexed by suffix, containing the non-empy values of
|
|
|
|
|
-- <rpmvar><suffix>, with suffix an integer string or the empty string
|
|
|
|
|
local function getsuffixed(rpmvar)
|
|
|
|
|
local suffixes = {}
|
|
|
|
|
zalias({rpmvar})
|
|
|
|
|
for suffix=0,9999 do
|
|
|
|
|
local value = rpm.expand("%{?" .. rpmvar .. suffix .. "}")
|
|
|
|
|
if (value ~= "") then
|
|
|
|
|
suffixes[tostring(suffix)] = value
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- rpm convention is to alias no suffix to zero suffix
|
|
|
|
|
-- only add no suffix if zero suffix is different
|
|
|
|
|
local value = rpm.expand("%{?" .. rpmvar .. "}")
|
|
|
|
|
if (value ~= "") and (value ~= suffixes["0"]) then
|
|
|
|
|
suffixes[""] = value
|
|
|
|
|
end
|
|
|
|
|
return suffixes
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Returns the list of suffixes, including the empty string, for which
|
|
|
|
|
-- <rpmvar><suffix> is set to a non empty value
|
|
|
|
|
local function getsuffixes(rpmvar)
|
|
|
|
|
suffixes = {}
|
|
|
|
|
for suffix in pairs(getsuffixed(rpmvar)) do
|
|
|
|
|
table.insert(suffixes,suffix)
|
|
|
|
|
end
|
|
|
|
|
table.sort(suffixes,
|
|
|
|
|
function(a,b) return (tonumber(a) or 0) < (tonumber(b) or 0) end)
|
|
|
|
|
return suffixes
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Returns the suffix for which <rpmvar><suffix> has a non-empty value that
|
|
|
|
|
-- matches best the beginning of the value string
|
|
|
|
|
local function getbestsuffix(rpmvar, value)
|
|
|
|
|
local best = nil
|
|
|
|
|
local currentmatch = ""
|
|
|
|
|
for suffix, setvalue in pairs(getsuffixed(rpmvar)) do
|
|
|
|
|
if (string.len(setvalue) > string.len(currentmatch)) and
|
|
|
|
|
(string.find(value, "^" .. setvalue)) then
|
|
|
|
|
currentmatch = setvalue
|
|
|
|
|
best = suffix
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return best
|
|
|
|
|
end
|
|
|
|
|
|
2018-11-08 18:12:25 +00:00
|
|
|
|
-- https://github.com/rpm-software-management/rpm/issues/581
|
|
|
|
|
-- Writes the content of a list of rpm variables to a macro spec file.
|
|
|
|
|
-- The target file must contain the corresponding anchors.
|
|
|
|
|
-- For example writevars("myfile", {"foo","bar"}) will replace:
|
|
|
|
|
-- @@FOO@@ with the rpm evaluation of %{foo} and
|
|
|
|
|
-- @@BAR@@ with the rpm evaluation of %{bar}
|
|
|
|
|
-- in myfile
|
2018-11-08 18:18:36 +00:00
|
|
|
|
local function writevars(macrofile, rpmvars)
|
2018-11-08 18:12:25 +00:00
|
|
|
|
for _, rpmvar in ipairs(rpmvars) do
|
|
|
|
|
print("sed -i 's\029" .. string.upper("@@" .. rpmvar .. "@@") ..
|
|
|
|
|
"\029" .. rpm.expand( "%{" .. rpmvar .. "}" ) ..
|
|
|
|
|
"\029g' " .. macrofile .. "\n")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2018-11-08 18:21:06 +00:00
|
|
|
|
-- 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", " ")
|
2019-11-11 12:15:56 +00:00
|
|
|
|
text = string.gsub(text, "\r", "\n")
|
2018-11-08 18:21:06 +00:00
|
|
|
|
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
|
2019-07-07 22:30:14 +00:00
|
|
|
|
advance, n = string.gsub(word, "^(%s*– ).*", "%1")
|
|
|
|
|
if (n == 0) then
|
|
|
|
|
advance = string.gsub(word, "^(%s*).*", "%1")
|
|
|
|
|
end
|
|
|
|
|
advance = string.gsub(advance, "– ", " ")
|
2018-11-08 18:21:06 +00:00
|
|
|
|
pos = pos + wl
|
2019-11-11 12:15:56 +00:00
|
|
|
|
elseif (pos + wl < 81) or
|
|
|
|
|
((pos + wl == 81) and string.match(word, "\n$")) then
|
2018-11-08 18:21:06 +00:00
|
|
|
|
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
|
|
|
|
|
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
return {
|
|
|
|
|
explicitset = explicitset,
|
|
|
|
|
explicitunset = explicitunset,
|
|
|
|
|
safeset = safeset,
|
|
|
|
|
zalias = zalias,
|
2018-11-08 18:18:36 +00:00
|
|
|
|
setcurrent = setcurrent,
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
echovars = echovars,
|
|
|
|
|
getsuffixed = getsuffixed,
|
|
|
|
|
getsuffixes = getsuffixes,
|
|
|
|
|
getbestsuffix = getbestsuffix,
|
2018-11-08 18:12:25 +00:00
|
|
|
|
writevars = writevars,
|
2018-11-08 18:21:06 +00:00
|
|
|
|
wordwrap = wordwrap,
|
forge: refactor to allow multiple calls
– permit extraction of multiple archives in a single specfile
– %forgemeta, %forgesetup, %forgeautosetup: add a “-z <number>” switch to
select a specific set of rpm variables
(for example forgeurl<number> and version<number>)
– %forgemeta, %forgesetup: add a “-a” switch to process all sets in one go
(makes no sense in forgeautosetup, as you need so select specific patches)
– %forgemeta: deprecate the “-u” switch, use “-z” it’s better
(“-u” was awkward and mainly used by the %gometa macro. %gometa will now
call the lua code directly)
– %forgesetup: use “-v” for verbose processing, be quiet by default, drop “-q”
(align with %forgemeta, %forgeautosetup and %autosetup)
– %forgesetup, %forgeautosetup: only pass flags that make sense to
%setup/%autosetup; reorder to match what works in el7
– factor out complex or common lua code in separate lua modules, to allow:
– code reuse in other macros without cut and pasting
– direct lua routine invocation from other macros without going through a
rpm macro
– rpm syntax errors that point to a line in an actual lua file
– %forgemeta: refactor the logic to drop as much forge-specific code as
possible, use a single logic flow with tables of constants
– %forgemeta: export more computed info in rpm variables, such as the
%{_builddir} subdirectory an archive was extracted to (lifesaver when
processing multiple archives)
– %forgemeta: prepend secondary distprefixes with .S, to make clear they do
not apply to the main archive
– %forgemeta: add versionx to secondary distprefixes, if relevant
– %forgemeta: make tar.bz2 the default archive format
Caveats:
– forge services implement full-release downloads via tags. However the actual
syntax of such tags is not standardised. If the macro does not guess the
correct tag an upstream uses for a specific release, you will need to
set the tag value explicitly.
– GitHub lets upstreams move their projects to new URLs, keeping the old URL
active. It all works transparently *except* the top directory inside
generated archives always matches the new project name (even when accessed
by compatibility URLs, and even for releases that antedate the renaming).
Therefore, if macro processing of a GitHub archive suddenly fails, start by
checking if upstream didn’t rename itself.
Multicall usage example (with “-a”)
– to process a specific bloc in one of the macros use “-z <suffix>”
– suffix 0 and no suffix are synonyms
– therefore, calling the macros without “-a” or “-z” just works for the
general use case when you have a single archive to process
– caveat: forge services implement full-release
%<--
%global forgeurl0 https://gitlab.com/osslugaru/lugaru
Version: 1.2
%global forgeurl1 https://gitlab.com/osslugaru/lugaru
%global tag1 1.1
%global forgeurl2 https://gitlab.com/osslugaru/lugaru
%global commit2 68488b0a11df90dca703c67e5592b93c6a269957
%global forgeurl3 https://gitlab.com/osslugaru/lugaru
%global branch3 v1.1
%global forgeurl4 https://github.com/google/trillian
%global version4 1.0.8
%global forgeurl5 https://github.com/kubernetes/apiextensions-apiserver
%global version5 1.9.6
%global tag5 kubernetes-%{version5}
%global forgeurl6 https://github.com/jdbranham/grafana-diagram
%global version6 1.3
%global commit6 440689793ab6da82019c5ee43b49438dfef976d5
%global forgeurl7 https://github.com/rethinkdb/rethinkdb-go
%global version7 1.4.2
%global branch7 v1
%global forgeurl8 https://code.googlesource.com/gocloud
%global version8 0.20.0
%global forgeurl9 https://code.googlesource.com/gocloud
%global tag9 v0.27.0
%global forgeurl10 https://code.googlesource.com/google-api-go-client
%global commit10 24928b980e6919be4c72647aacd53ebcbb8c4bab
%global version10 0
%global forgeurl11 https://code.googlesource.com/google-api-go-client
%global branch11 dartman
%global forgeurl12 https://bitbucket.org/nielsenb/pdfocr
%global version12 0.3.0
%global commit12 4f5750d202d33267094621630836f1215a5efa66
%global forgeurl13 https://bitbucket.org/nielsenb/pdfocr
%global version13 0.1.4
%global tag13 v0.1.4
%global commit13 c0359843a3420769940e12019ebd68891a053bd8
%global forgeurl14 https://bitbucket.org/creachadair/shell
%global commit14 3dcd505a7ca5845388111724cc2e094581e92cc6
%global forgeurl15 https://bitbucket.org/kirbyvisp/vdjpuzzle2/
%global branch15 js-edits
%global commit15 36a3850eb4a04c05e0f7e29e7d0c196f373eb672
%forgemeta -ia
Name: testing
Release: 1%{?dist}
Summary: A test package
URL: %{forgeurl}
License: Public domain
Source0: %{forgesource0}
Source1: %{forgesource1}
Source2: %{forgesource2}
Source3: %{forgesource3}
Source4: %{forgesource4}
Source5: %{forgesource5}
Source6: %{forgesource6}
Source7: %{forgesource7}
Source8: %{forgesource8}
Source9: %{forgesource9}
Source10: %{forgesource10}
Source11: %{forgesource11}
Source12: %{forgesource12}
Source13: %{forgesource13}
Source14: %{forgesource14}
Source15: %{forgesource15}
%description
A test package
%prep
%forgesetup -a
%build
exit 1
%install
%files
%doc
%<--
Merges: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/35
2018-09-07 17:56:46 +00:00
|
|
|
|
}
|