redhat-rpm-config/macros.forge

98 lines
4.3 KiB
Plaintext
Raw Normal View History

# Map forge information to rpm metadata. This macro will compute default spec
# variable values.
#
# The following spec variables SHOULD be set before calling the macro:
#
# forgeurl the project url on the forge, strongly recommended;
# Version if applicable, set it with Version: <version>
# tag if applicable
# commit if applicable
# date if applicable (to override the mtime of the Source archive)
#
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
# Use -z for multiple calls to the macro
#
# The macro will attempt to compute and set the following variables if they are
# not already set by the packager:
#
# forgesource an URL that can be used as SourceX: value
# forgesetupargs the correct arguments to pass to %setup for this source
# used by %forgesetup and %forgeautosetup
# archivename the source archive filename, without extentions
# archiveext the source archive filename extensions, without leading dot
# archiveurl the url that can be used to download the source archive,
# without renaming
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
# topdir the source archive top directory (can be empty)
# extractdir the source directory created inside %{_builddir} after using
# %%forgesetup, %forgeautosetup or %{forgesetupargs}
# repo the repository name
# owner the repository owner (if used by another computed variable)
# shortcommit the commit hash clamping used by the forge, if any
# scm the scm type, when packaging code snapshots: commits or tags
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
# distprefix the prefix that needs adding to dist to trace non-release packaging
#
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
# Most of the computed variables are both overridable and optional.
#
# Optional parameters:
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
# -a process all sources in one go, instead of using separate -z calls
# -z <number> suffix all the read and written variable names with <number>
# for example read forgeurl<number>, version<number>…
# and generate forgesetupargs<number>, archiveurl<number>…
# The macro assumes that null or nil suffix is used for the primary
# package source.
# -s Silently ignore problems in forgeurl, use it if it can be parsed,
# ignore it otherwise.
# -v Be verbose and print every spec variable the macro sets.
# -i Print some info about the state of spec variables the macro may use or
# set at the end of the processing.
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
%forgemeta(az:sviu:) %{lua:
local fedora = require "fedora.common"
local forge = require "fedora.srpm.forge"
local verbose = rpm.expand("%{-v}") ~= ""
local informative = rpm.expand("%{-i}") ~= ""
local silent = rpm.expand("%{-s}") ~= ""
local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
if processall then
for _,s in pairs(fedora.getsuffixes("forgeurl")) do
forge.forgemeta(s,verbose,informative,silent)
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
else
forge.forgemeta(rpm.expand("%{-z*}"),verbose,informative,silent)
end
}
# Convenience macro to relay computed arguments to %setup
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
# Optional parameters:
# -a process all sources in one go, instead of using separate -z calls
# -z <number> read %{?forgesetupargs<number>}
# -v be verbose
%forgesetup(az:v) %{lua:
local fedora = require "fedora.common"
if (rpm.expand("%{-z}") == "") and (rpm.expand("%{-a}") ~= "") then
for _,s in pairs(fedora.getsuffixes("forgesetupargs")) do
print(rpm.expand("%setup %{!-v:-q} %{?forgesetupargs" .. s .. "}\\n"))
end
else
print( rpm.expand("%setup %{!-v:-q} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
end
}
# Convenience macro to relay computed arguments to %autosetup
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
# Parameters relayed to %autosetup: -v -N -S -p
# Optional parameters:
# -z <number> read %{?forgesetupargs<number>}
%forgeautosetup(z:vNS:p:q) %{lua:
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
print(rpm.expand("%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
}
# List files matching inclusion globs, excluding files matching exclusion blogs
# Parameters:
# -i "<globs>" include shell globs (also takes all other macro arguments)
# -x "<globs>" exclude shell 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)
}