#13 make use of golist 0.10.0 fixes
Merged 9 months ago by nim. Opened 9 months ago by nim.
nim/go-rpm-macros golist-0.10.0  into  master

make use of golist 0.10.0 fixes
Nicolas Mailhot • 9 months ago  
file modified
+15 -21

@@ -403,33 +403,27 @@ 

      done

  }

  

- fullprovides() {

- local fp="${1}(${2})"

- echo "${fp}${metadata[version]:+ = ${metadata[version]}}"

- for m in "${!metadata[@]}" ; do

-   if [[ "${m}" != "version" ]] ; then

-     echo "${fp}(${m}=${metadata[${m}]})${metadata[version]:+ = ${metadata[version]}}"

-   fi

- done

- }

- 

  provides() {

  local goipath="${1}"

- fullprovides golang-ipath "${goipath}"

- GOPATH="${prefix}${gopath}" GO111MODULE=off \

-   golist --provided --package-path "${goipath}" $(expandflags) |\

-     while read -r -d $'\n' prov ; do

-       fullprovides golang "${prov}"

-     done

+ (

+   echo "golang-ipath(${goipath})"

+   GOPATH="${prefix}${gopath}" GO111MODULE=off \

+     golist --provided --package-path "${goipath}" $(expandflags) \

+            --skip-self --template 'golang({{.}})\n'

+ ) | while IFS= read -r prov ; do

+   echo "${prov}${metadata[version]:+ = ${metadata[version]}}"

+   for m in "${!metadata[@]}" ; do

+     if [[ "${m}" != "version" ]] ; then

+       echo "${prov}(${m}=${metadata[${m}]})${metadata[version]:+ = ${metadata[version]}}"

+     fi

+   done

+ done

  }

  

  requires() {

- local goipath="${1}"

  GOPATH="${prefix}${gopath}" GO111MODULE=off \

-   golist --imported --package-path "${goipath}" $(expandflags) --skip-self |\

-     while read -r -d $'\n' req ; do

-       echo "golang($req)"

-     done

+   golist --imported  --package-path "${1}" $(expandflags) \

+          --skip-self --template 'golang({{.}})\n'

  }

  

  # Action-specific preparation

file modified
+13 -16

@@ -120,24 +120,21 @@ 

  echo ${flags_d[@]/#/ -d } ${flags_t[@]/#/ -t } ${flags_r[@]/#/ -r } ${flags_e[@]/#/ -e }

  }

  

- fullprovides() {

- local fp="${1}(${2})"

- echo "${fp}${metadata[version]:+ = ${metadata[version]}}"

- for m in "${!metadata[@]}" ; do

-   if [[ "${m}" != "version" ]] ; then

-     echo "${fp}(${m}=${metadata[${m}]})${metadata[version]:+ = ${metadata[version]}}"

-   fi

- done

- }

- 

  provides() {

  local goipath="${1}"

- fullprovides golang-symlink "${goipath}"

- GOPATH="${prefix}${gopath}" GO111MODULE=off \

-   golist --provided --package-path "${goipath}" $(expandflags) |\

-     while read -r -d $'\n' prov ; do

-       fullprovides golang "${prov}"

-     done

+ (

+   echo "golang-symlink(${goipath})"

+   GOPATH="${prefix}${gopath}" GO111MODULE=off \

+     golist --provided --package-path "${goipath}" $(expandflags) \

+            --skip-self --template 'golang({{.}})\n'

+ ) | while IFS= read -r prov ; do

+   echo "${prov}${metadata[version]:+ = ${metadata[version]}}"

+   for m in "${!metadata[@]}" ; do

+     if [[ "${m}" != "version" ]] ; then

+       echo "${prov}(${m}=${metadata[${m}]})${metadata[version]:+ = ${metadata[version]}}"

+     fi

+   done

+ done

  }

  

  requires() {

file modified
+19 -25

@@ -170,36 +170,30 @@ 

  # -i <go import path> use the specified import path value instead of the one

  #                     found in %{goipath<number>}

  %go_generate_buildrequires(z:ai:) %{lua:

- local      fedora =  require "fedora.common"

- local  myenvflags =  rpm.expand('%{?-i}')

- local  golistargs =  rpm.expand('%{?-i*}%{!-i:"%%{currentgoipath}"} ')

- local  processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")

- -- https://pagure.io/golist/issue/3

- local function process(suffix)

-   local zsuffix = ""

-   if (suffix ~= "") and (suffix ~= nil) then

-     zsuffix = "-z " .. suffix .. " "

-   end

-   print(rpm.expand('%goenv ' .. zsuffix                .. myenvflags .. '\\n'             ..

-                    '%{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" }' ..

-                    'GO111MODULE=off ' ..

-                    "golist --imported --package-path " .. golistargs .. "--skip-self\\n" ..

-                    '%{?gobuilddir:GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" }' ..

-                    'GO111MODULE=off ' ..

-                    "golist --imported --package-path " .. golistargs .. "--skip-self --tests\\n"))

- end

- -- Main loop

- -- https://pagure.io/golist/issue/13

- print('(sort -u | xargs -I{} echo "golang({})") <<< "$(\\n')

+ local        fedora =  require "fedora.common"

+ local    processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")

+ local forcedgoipath =  rpm.expand("%{?-i}")

+ local    golistargs = ""

  if processall then

-   -- https://pagure.io/golist/issue/4

    for _, s in pairs(fedora.getsuffixes("goipath")) do

-     process(s)

+     golistargs = golistargs .. " --package-path %{goipath" .. s .. "}"

    end

+   golistargs   = string.gsub(golistargs, "^ ", "")

+ elseif forcedgoipath ~= "" then

+   golistargs   = "--package-path " .. forcedgoipath

  else

-   process(rpm.expand("%{?-z*}"))

+   golistargs   = "--package-path %{goipath" .. rpm.expand("%{?-z*}") .. "}"

  end

- print(')"\\n')

+ local golistcmd = rpm.expand('GOPATH="%{?gobuilddir:%{gobuilddir}:}${GOPATH:+${GOPATH}:}%{?gopath}" ' ..

+                              'GO111MODULE=off ' ..

+                              "golist --imported " .. golistargs ..

+                                    " --template 'golang({{.}})\\\\n'" ..

+                                    " --skip-self")

+ -- https://pagure.io/golist/issue/3

+ print('(\\n' ..

+       '  ' .. golistcmd .. '\\n' ..

+       '  ' .. golistcmd .. ' --tests\\n' ..

+       ') | sort -u\\n')

  }

  

  # Try to install Go package files in sensible locations, with strict directory

no initial comment

Pull-Request has been merged by nim

9 months ago