Blame SOURCES/macros.forge

396caf
# Computes forge-related variables for use in the rest of the spec file
396caf
# Control variables, flags and arguments:
396caf
#   %{forgeurl<number>}  the project url on the target forge
396caf
#   %{tag<number>}       the packaged tag, OR
396caf
#   %{commit<number>}    the packaged commit, OR
396caf
#   %{version<number>}   the packaged version
396caf
#                          – %{version}/%{version0} are set via:
396caf
#                              Version:
396caf
#                          – because git is lacking a built-in version
396caf
#                            reference, %{version<number>} will be translated
396caf
#                            into %{tag<number>} using unreliable heuristics;
396caf
#                            set %{tag<number>} directly if those fail
396caf
#   %{date<number>}      the packaged timestamp
396caf
#   …                    %forgemeta will compute a huge number of variables:
396caf
#                          — the packager can override it by setting some of
396caf
#                            those before the %forgemeta call
396caf
#                          – use the -i flag to list those variables
396caf
#   -z <number>          only process the zth block of definitions
396caf
#                        "" for the no-suffix block
396caf
#   -i                   list the resulting variable values
396caf
#   -s                   silently ignore problems in %{forgeurl<number>}
396caf
#   -v                   be verbose
396caf
#   -a                   process all sources in one go, instead of using
396caf
#                        separate -z calls
396caf
%forgemeta(z:isva) %{lua:
396caf
local      fedora = require "fedora.common"
396caf
local       forge = require "fedora.srpm.forge"
396caf
local     verbose =  rpm.expand("%{-v}") ~= ""
396caf
local informative =  rpm.expand("%{-i}") ~= ""
396caf
local      silent =  rpm.expand("%{-s}") ~= ""
396caf
local  processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
396caf
if processall then
396caf
  for _,s in pairs(fedora.getsuffixes("forgeurl")) do
396caf
    forge.meta(s,verbose,informative,silent)
396caf
  end
396caf
else
396caf
  forge.meta(rpm.expand("%{-z*}"),verbose,informative,silent)
396caf
end
396caf
}
396caf
396caf
# Unpacks sources computed by %forgemeta
396caf
# Control variables, flags and arguments:
396caf
#   %{forgesource<number>}       the source archive that will be processed
396caf
#   %{forgesetupargs<number>}    %setup arguments
396caf
396caf
#   -z <number>                  only process the zth block of definitions
396caf
#                                "" for the no-suffix block
396caf
#   -v                           be verbose
396caf
#   -a                   process all sources in one go, instead of using
396caf
#                        separate -z calls
396caf
%forgesetup(z:va) %{lua:
396caf
local fedora = require "fedora.common"
396caf
if (rpm.expand("%{-z}") == "") and (rpm.expand("%{-a}") ~= "") then
396caf
  for _,s in pairs(fedora.getsuffixes("forgesetupargs")) do
396caf
    print(rpm.expand("%setup %{!-v:-q} %{?forgesetupargs" .. s                     .. "}\\n"))
396caf
  end
396caf
else
396caf
  print(  rpm.expand("%setup %{!-v:-q} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
396caf
end
396caf
}
396caf
396caf
# Calls %autosetup using %forgemeta results
396caf
#   – this will probably be removed since it is unsafe in presence of multiple
396caf
#     sources
396caf
# Control variables, flags and arguments:
396caf
#   -z <number>  process the zth block of definitions
396caf
#   -v -N -S -p  relayed to %autosetup
396caf
%forgeautosetup(z:vNS:p:q) %{lua:
396caf
print(rpm.expand("%autosetup %{-v} %{-N} %{?-S} %{?-p} %{?forgesetupargs" .. rpm.expand("%{-z*}") .. "}\\n"))
396caf
}