# obscene macro junk %global ghowner hashicorp %global owner %{ghowner} %global githost github.com %global proj vsphere %global module packer-plugin-%{proj} %global archive v%{version}.tar.gz %global namespace %{githost}/%{owner}/%{module} %global regsite registry.terraform.io %global regorg hashicorp %global regarch amd64 %global regos %{_target_os} Name: golang-github-%{module} Version: 1.2.0 Release: 0.1%{!?dis:%{?dist}} Summary: Packer plugin %{plugin} Group: Applications/System License: MPL2; https://github.com/hashicorp/ URL: https://%{namespace} Source0: https://%{namespace}/archive/v%{version}.tar.gz BuildRequires: golang make golang-golangorg-text-devel git Requires: packer %description A Packer plug-in for %{proj} %prep %setup -q -n %{module}-%{version} #echo v%{version} > version %build %define debug_package %{nil} export GOPATH=$PWD export GOOS=%{_target_os} export GOARCH=%{regarch} export GOFLAGS=-modcacherw mkdir -p src/%{namespace}/ shopt -s extglob dotglob mv !(src) src/%{namespace}/ shopt -u extglob dotglob pushd src/%{namespace}/ go build -o bin/%{module} popd %install [ "%{buildroot}" = "/" ] || [ ! -d %{buildroot} ] || rm -rf %{buildroot} install -d -m 755 %{buildroot}%{_bindir} install -m 0755 \ src/%{namespace}/bin/%{module} \ %{buildroot}%{_bindir} %clean find %{buildroot} -exec chmod 777 \{\} \; # modcacherw is imperfect still rm -rf %{buildroot} %files %license src/%{namespace}/LICENSE %doc src/%{namespace}/README.md src/%{namespace}/CODEOWNERS %doc src/%{namespace}/docs/ src/%{namespace}/docs-partials/ src/%{namespace}/example %{_bindir}/%{module} %changelog