#15 small fixes
Merged 8 months ago by nim. Opened 8 months ago by nim.
nim/go-rpm-macros lua-filterdescr  into  master

handle empty gosupfiles gracefully
Nicolas Mailhot • 8 months ago  
convert to lua filterdescr use
Nicolas Mailhot • 8 months ago  
file modified
+21 -3

@@ -234,11 +234,20 @@ 

  

  -- 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 @@ 

      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 .. "}")

@@ -43,7 +43,7 @@ 

                             %{?currentgoipathsex}                     \\

                             %{?currentgoextensions}                   \\

                             %{?goinstallflags}                        \\

-                            %{-v} "${gosupfilesA[@]}"

+                            %{-v} ${gosupfilesA[@]:+"${gosupfilesA[@]}"}

  )

  }

  

@@ -1,45 +0,0 @@ 

- # Copyright © 2018-2019 Nicolas Mailhot <nim@fedoraproject.org>

- #

- # 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 <https://www.gnu.org/licenses/>.

- #

- # 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)

- }

@@ -61,10 +61,10 @@ 

  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.

@@ -81,10 +81,10 @@ 

  Version: 

  Release: 1%{?dist}

  Summary: 

- URL:	   %{gourl}

+ URL:     %{gourl}

  Source0: %{gosource}

  %description

- %{common_description}

+ %filterdescr -v common_description

  

  %gopkg

  

@@ -40,10 +40,10 @@ 

  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.

@@ -66,10 +66,10 @@ 

  Version: 

  Release: 1%{?dist}

  Summary: 

- URL:	 %{gourl}

+ URL:     %{gourl}

  Source0: %{gosource}

  %description

- %{common_description}

+ %filterdescr -v common_description

  

  %gopkg

  

@@ -39,10 +39,10 @@ 

  Version: 

  Release: 1%{?dist}

  Summary: 

- URL:	 %{gourl}

+ URL:     %{gourl}

  Source0: %{gosource}

  %description

- %{common_description}

+ %filterdescr -v common_description

  

  %gopkg

  

@@ -56,10 +56,10 @@ 

  Version: 

  Release: 1%{?dist}

  Summary: 

- URL:	 %{gourl}

+ URL:     %{gourl}

  Source0: %{gosource}

  %description

- %{common_description}

+ %filterdescr -v common_description

  

  %gopkg

  

@@ -126,13 +126,13 @@ 

  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.

@@ -29,10 +29,10 @@ 

  Version: 

  Release: 1%{?dist}

  Summary: 

- URL:	 %{gourl}

+ URL:     %{gourl}

  Source0: %{gosource}

  %description

- %{common_description}

+ %filterdescr -v common_description

  

  %package -n %{goname}-devel

  Summary: %{summary}