From ebbffa6f2f13a0b97efb8770335f982681612655 Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Jun 02 2019 18:10:16 +0000 Subject: [PATCH 1/2] convert to lua filterdescr use --- diff --git a/rpm/lua/srpm/go.lua b/rpm/lua/srpm/go.lua index 9d65a2f..c4c3446 100644 --- a/rpm/lua/srpm/go.lua +++ b/rpm/lua/srpm/go.lua @@ -234,11 +234,20 @@ end -- Create a single %package section for a known kind of Go subpackage local function singlepkg(kind, suffix, verbose) + local fedora = require "fedora.common" if (kind == "devel") then develenv(suffix, verbose) - print(rpm.expand('%__godevelpkg\n')) + print( + rpm.expand( + "%package -n %{currentgodevelname}\n" .. + "Summary: %{currentgodevelsummary}\n" .. + "BuildRequires: go-rpm-macros\n" .. + "BuildArch: noarch\n" .. + "%{?currentgodevelheader}\n" .. + "%description -n %{currentgodevelname}\n") .. + fedora.filterdescr("%{?currentgodeveldescription}") .. + "\n") elseif (kind == "alt") then - local fedora = require "fedora.common" local ismain = (suffix == "") or (suffix == "0") if ismain then fedora.zalias({"goaltipaths","gocid","goaltcid"}, verbose) @@ -250,7 +259,16 @@ local function singlepkg(kind, suffix, verbose) for rpmname, goaltipaths in pairs(indexedgoipaths("%{goaltipaths" .. suffix .. "}", "%{goaltcid" .. suffix .. "}")) do altenv(suffix, rpmname, goaltipaths, verbose) - print(rpm.expand('%__goaltpkg\n')) + print( + rpm.expand( + "%package -n %{currentgoaltname}\n" .. + "Summary: %{currentgoaltsummary}\n" .. + "BuildRequires: go-rpm-macros\n" .. + "BuildArch: noarch\n" .. + "%{?currentgoaltheader}\n" .. + "%description -n %{currentgoaltname}\n") .. + fedora.filterdescr("%{?currentgoaltdescription}") .. + "\n") end else rpm.expand("%{error:Unknown kind of Go subpackage: " .. kind .. "}") diff --git a/rpm/macros.d/macros.go-srpm.internal b/rpm/macros.d/macros.go-srpm.internal deleted file mode 100644 index 52d6bb9..0000000 --- a/rpm/macros.d/macros.go-srpm.internal +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright © 2018-2019 Nicolas Mailhot -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# SPDX-License-Identifier: GPL-3.0-or-later - -# SRPM macros for Go packages. -# -# Internal utility macros -# Direct use in spec file is not supported - -%__godevelpkg() %{expand: -%package -n %{currentgodevelname} -Summary: %{currentgodevelsummary} -BuildRequires: go-rpm-macros -BuildArch: noarch -%{?currentgodevelheader} -%description -n %{currentgodevelname} -%(%reformatdescriptiontext << EOF_DESCR -%{?currentgodeveldescription} -EOF_DESCR) -} - -%__goaltpkg() %{expand: -%package -n %{currentgoaltname} -Summary: %{currentgoaltsummary} -BuildRequires: go-rpm-macros -BuildArch: noarch -%{?currentgoaltheader} -%description -n %{currentgoaltname} -%(%reformatdescriptiontext << EOF_DESCR -%{?currentgoaltdescription} -EOF_DESCR) -} diff --git a/templates/rpm/spectemplate-go-0-source-minimal.spec b/templates/rpm/spectemplate-go-0-source-minimal.spec index 09b6965..c06a583 100644 --- a/templates/rpm/spectemplate-go-0-source-minimal.spec +++ b/templates/rpm/spectemplate-go-0-source-minimal.spec @@ -61,10 +61,10 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} Source0: %{gosource} %description -%{common_description} +%filterdescr -v common_description # Generate package declarations for all known kinds of Go subpackages. # You can replace if with “godevelpkg” to generate Go devel subpackages only. diff --git a/templates/rpm/spectemplate-go-1-source-full.spec b/templates/rpm/spectemplate-go-1-source-full.spec index 951bceb..ce3f8b9 100644 --- a/templates/rpm/spectemplate-go-1-source-full.spec +++ b/templates/rpm/spectemplate-go-1-source-full.spec @@ -81,10 +81,10 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} Source0: %{gosource} %description -%{common_description} +%filterdescr -v common_description %gopkg diff --git a/templates/rpm/spectemplate-go-2-alternative-import-path-minimal.spec b/templates/rpm/spectemplate-go-2-alternative-import-path-minimal.spec index c933a54..5ca1241 100644 --- a/templates/rpm/spectemplate-go-2-alternative-import-path-minimal.spec +++ b/templates/rpm/spectemplate-go-2-alternative-import-path-minimal.spec @@ -40,10 +40,10 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} Source0: %{gosource} %description -%{common_description} +%filterdescr -v common_description # Generate package declarations for all known kinds of Go subpackages. You can # replace if with separate “goaltpkg” and “godevelpkg” calls. diff --git a/templates/rpm/spectemplate-go-3-alternative-import-path-full.spec b/templates/rpm/spectemplate-go-3-alternative-import-path-full.spec index a0a8c34..93e9e31 100644 --- a/templates/rpm/spectemplate-go-3-alternative-import-path-full.spec +++ b/templates/rpm/spectemplate-go-3-alternative-import-path-full.spec @@ -66,10 +66,10 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} Source0: %{gosource} %description -%{common_description} +%filterdescr -v common_description %gopkg diff --git a/templates/rpm/spectemplate-go-4-binary-minimal.spec b/templates/rpm/spectemplate-go-4-binary-minimal.spec index 7e053ee..24916d9 100644 --- a/templates/rpm/spectemplate-go-4-binary-minimal.spec +++ b/templates/rpm/spectemplate-go-4-binary-minimal.spec @@ -39,10 +39,10 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} Source0: %{gosource} %description -%{common_description} +%filterdescr -v common_description %gopkg diff --git a/templates/rpm/spectemplate-go-5-binary-full.spec b/templates/rpm/spectemplate-go-5-binary-full.spec index 67a7de5..e447a25 100644 --- a/templates/rpm/spectemplate-go-5-binary-full.spec +++ b/templates/rpm/spectemplate-go-5-binary-full.spec @@ -56,10 +56,10 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} Source0: %{gosource} %description -%{common_description} +%filterdescr -v common_description %gopkg diff --git a/templates/rpm/spectemplate-go-6-multi.spec b/templates/rpm/spectemplate-go-6-multi.spec index bb82007..59f6bbb 100644 --- a/templates/rpm/spectemplate-go-6-multi.spec +++ b/templates/rpm/spectemplate-go-6-multi.spec @@ -126,13 +126,13 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} # One for each of the previous goipath blocks Source0: %{gosource0} Source1: %{gosource1} # … %description -%{common_description} +%filterdescr -v common_description # “gopkg” will generate all the subpackages package declarations corresponding # to the elements declared above. diff --git a/templates/rpm/spectemplate-go-7-manual.spec b/templates/rpm/spectemplate-go-7-manual.spec index 4de105e..6b89094 100644 --- a/templates/rpm/spectemplate-go-7-manual.spec +++ b/templates/rpm/spectemplate-go-7-manual.spec @@ -29,10 +29,10 @@ Name: %{goname} Version: Release: 1%{?dist} Summary: -URL: %{gourl} +URL: %{gourl} Source0: %{gosource} %description -%{common_description} +%filterdescr -v common_description %package -n %{goname}-devel Summary: %{summary} From 763d1ff2d7d815d24beae86ba555d61af2aa845f Mon Sep 17 00:00:00 2001 From: Nicolas Mailhot Date: Jun 02 2019 19:15:38 +0000 Subject: [PATCH 2/2] handle empty gosupfiles gracefully --- diff --git a/rpm/macros.d/macros.go-rpm.internal b/rpm/macros.d/macros.go-rpm.internal index a81eb4d..88566b8 100644 --- a/rpm/macros.d/macros.go-rpm.internal +++ b/rpm/macros.d/macros.go-rpm.internal @@ -43,7 +43,7 @@ go-rpm-integration install -i "%{__godevelinstall_ipath}" \\ %{?currentgoipathsex} \\ %{?currentgoextensions} \\ %{?goinstallflags} \\ - %{-v} "${gosupfilesA[@]}" + %{-v} ${gosupfilesA[@]:+"${gosupfilesA[@]}"} ) }