diff --git a/demus-packaging-utils.spec b/demus-packaging-utils.spec index 360438c..33de576 100644 --- a/demus-packaging-utils.spec +++ b/demus-packaging-utils.spec @@ -1,6 +1,6 @@ %global major 0 %global minor 1 -%global release 1 +%global release 2 Name: demus-packaging-utils Version: %{major}.%{minor}.%{release} @@ -8,7 +8,7 @@ Release: %autorelease Summary: Aliases and scripts to assist in rpm packaging workflows License: GPL3 -Source: go-vendor-update.sh +Source: go2rpm-vendor-update.sh Source: regenerate-from-spec.sh Source: macros.demus-packaging Source: LICENSE @@ -21,31 +21,27 @@ BuildArch: noarch %description * Alias to regenerate vendor archive in a go2rpm spec generated with the vendor profile -%global regen_basename %(basename "%{S:1}" .sh) - %prep %if %{exists:%{S:2}} %{load:%{S:2}} - %verify_source_checksum %endif +%?verify_source_checksum %build %install -%{__install} -m 0755 -d %{buildroot}%{_sysconfdir}/profile.d %{__install} -m 0755 -d %{buildroot}%{_bindir} %{__install} -m 0755 -d %{buildroot}%{_rpmmacrodir} -%{__install} -p -m 644 -t %{buildroot}%{_sysconfdir}/profile.d %{S:0} -%{__install} -p -m 755 %{S:1} %{buildroot}%{_bindir}/%regen_basename +%{__install} -p -m 755 %{S:0} %{buildroot}%{_bindir}/%{binshellname:%{S:0}} +%{__install} -p -m 755 %{S:1} %{buildroot}%{_bindir}/%{binshellname:%{S:1}} %{__install} -p -m 755 %{S:2} %{buildroot}%{_rpmmacrodir}/ %{__install} -p -m 644 %{S:3} %{S:4} %{_builddir} %files %doc README.md %license LICENSE -%{_sysconfdir}/profile.d/* -%{_bindir}/%regen_basename +%{_bindir}/* %{_rpmmacrodir}/* %changelog diff --git a/go-vendor-update.sh b/go-vendor-update.sh deleted file mode 100644 index 405359f..0000000 --- a/go-vendor-update.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Update go vendor archive and config emulating the way go2rpm does it -alias go-vendor-update='go_vendor_archive create --config go-vendor-tools.toml --write-config ' diff --git a/go2rpm-vendor-update.sh b/go2rpm-vendor-update.sh new file mode 100644 index 0000000..a96945d --- /dev/null +++ b/go2rpm-vendor-update.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Update go vendor archive and config emulating the way go2rpm does it +if [ $# -ne 1 ] || ! [[ "$1" =~ .*.\.spec$ ]] || [ ! -f "$1" ]; then + echo "Required spec parameter missing" + echo "Usage: go2rpm-vendor-update .spec" + exit 1 +fi +go_vendor_archive create --config go-vendor-tools.toml --write-config "$1" diff --git a/macros.demus-packaging b/macros.demus-packaging index 228627f..ca3717e 100644 --- a/macros.demus-packaging +++ b/macros.demus-packaging @@ -9,3 +9,9 @@ %define checksumresult %{expand:%(cksum --check --quiet "%{-s:%{-s*}}%{!-s:sources}" 2>/dev/null)} %[ %{len:%checksumresult} > 0 ? "echo -e 'ERROR: Checksums do not match\\n%{checksumresult}'; exit 1" : "%{nil}" ] } + +# Macro wrapping basename , so the extension can stripped +%stripped_basename() %{expand:%(basename "%1" %2)} + +# Strip the path and .sh extension from the given string +%binshellname() %{expand:%stripped_basename "%1" .sh} diff --git a/regenerate-from-spec.sh b/regenerate-from-spec.sh index 5b31800..34c3237 100644 --- a/regenerate-from-spec.sh +++ b/regenerate-from-spec.sh @@ -13,7 +13,7 @@ fi if grep -q go-vendor-tools.toml "$1"; then echo Updating go vendor archive - go-vendor-update "$1" + go2rpm-vendor-update "$1" fi # Update the sources checksums diff --git a/sources b/sources index 2f44eab..ded6923 100644 --- a/sources +++ b/sources @@ -1,5 +1,5 @@ -SHA512 (go-vendor-update.sh) = 4ba1a21e84d91d37e66a7ade8eea09bb278ac87d8ea731420c0f56064424cbcc43e1d1f3d80b727472c6a6adeaefb22c909e949b7009c0f6e6bb7c3ace9268dc -SHA512 (macros.demus-packaging) = d0ebab10d2dace6b0a70428d49771a191a91ebe6cdc8b00322b23a2284c8d8413df433c7098ec1f5aaacf7376a191b2bc00c74ac5d8e38e4570565894a93cfc4 -SHA512 (regenerate-from-spec.sh) = a420e572ad92c0cdd140f98fae7b7e96f94c383a83b86bdfb69e6b7d968305391f6d20720df584ca3adb624b5e01d9fa2e4e07b754c176a9f4811b3326d49363 +SHA512 (go2rpm-vendor-update.sh) = 914e447930a50c1a77d2950c4f9a132a40e91f17919c03640e94068ca6a76e9fbc43b8022482c7c0e4d8242faf15cb745a7af5f313c079676b06990f45b2ea22 +SHA512 (macros.demus-packaging) = 8c1218425b20da00e6e67c15d1cf09a5913f74f5b2c14a9fda90d28db228ebc87c85bc2e73018638f94a272c71d310a025dc6893f0c69481126602db5e64ff53 +SHA512 (regenerate-from-spec.sh) = e863113564d8e67eadbbd8d5d3640a61a2dca53caee2f3b7f17008835e803ab06030f97ec5079f0310e576480db8485271d3a7394dd3eb12d5e79f73c29bc0cd SHA512 (README.md) = 72a6f0085fea6d2b5736c4fa98f31db8fb42462db6fe65d44de7e99405982cc2330e270f6fb042d598d4136bd2a933e226ae85fb99828e07af6ab2b74a5c89f2 SHA512 (LICENSE) = ccb0f3b838dff6254510f19c2bd6f5c48e38b8c40a5bf93d38482f4fb31015823741d3f160b6836ec99bd8f4e6c5fa9a5c9196ecdd7775b793f3ada50467aabd