Cleaning up odo rpm spec and scripts (#3904)

* Fixing rpm spec Provides and Obsoletes to be more specific

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Fixing local build script to use dist/rpmbuild and topdir for build

 - This prevents polluting users main rpmbuild

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Setting goflags during `make test` and turning off missing buildid

 - without goflags, unit tests take a while as they dont use vendor
 - providing -mod=vendor does not seem to help
 - missing gnu build ids in go binaries can cause warnings

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing GOFLAGS from spec and adding build_flags to test target

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Unsetting any goflags for make test in openshift ci

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing the set +x from local build script

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding rpm tests

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing last rm -rf

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Reverting to explicitly setting GOFLAGS for make test

 - It appears that while `-mod=vendor` flag is available for `go test`
   it is sometimes not respected
 - It is therefore, better to just set GOFLAGS only for make test
 - More investigation is needed to find better solution, but we should
   not break stuff relation to testing and release, where we should not
   be pulling from outside world

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Cleaning up rpm-prepare

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Removing unnessasary newline

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>

* Adding version file to spec for any future automation to have easier time

Signed-off-by: Mohammed Zeeshan Ahmed <mohammed.zee1000@gmail.com>
This commit is contained in:
Mohammed Ahmed
2020-09-10 21:25:19 +05:30
committed by GitHub
parent 8c9fbdb13d
commit 4305079156
5 changed files with 50 additions and 31 deletions

View File

@@ -12,6 +12,7 @@
%global source_dir openshift-odo-%{odo_version}-%{odo_release}
%global source_tar %{source_dir}.tar.gz
%global gopath %{_builddir}/gocode
%global _missing_build_ids_terminate_build 0
Name: %{package_name}
Version: %{odo_version}
@@ -23,8 +24,8 @@ URL: https://github.com/openshift/odo/tree/%{odo_cli_version}
Source0: %{source_tar}
BuildRequires: gcc
BuildRequires: golang >= %{golang_version}
Provides: %{package_name}
Obsoletes: %{package_name}
Provides: %{package_name} = %{odo_version}
Obsoletes: %{package_name} <= %{odo_version}
%description
odo is a fast, iterative, and straightforward CLI tool for developers who write, build, and deploy applications on OpenShift.
@@ -40,11 +41,11 @@ export GOPATH=%{gopath}
cd %{gopath}/src/github.com/openshift/odo
%ifarch x86_64
# go test -race is not supported on all arches
make test
GOFLAGS='-mod=vendor' make test
%endif
make prepare-release
echo "%{odo_version}" > dist/release/VERSION
unlink %{gopath}/src/github.com/openshift/odo
rm -rf %{gopath}
%install
mkdir -p %{buildroot}/%{_bindir}
@@ -59,7 +60,7 @@ install -p -m 755 dist/release/odo-darwin-amd64 %{buildroot}%{_datadir}/%{name}-
install -p -m 755 dist/release/odo-windows-amd64.exe %{buildroot}%{_datadir}/%{name}-redistributable/odo-windows-amd64.exe
cp -avrf dist/release/odo*.tar.gz %{buildroot}%{_datadir}/%{name}-redistributable
cp -avrf dist/release/SHA256_SUM %{buildroot}%{_datadir}/%{name}-redistributable
cp -avrf dist/release/VERSION %{buildroot}%{_datadir}/%{name}-redistributable
%files
%license LICENSE
@@ -69,8 +70,8 @@ cp -avrf dist/release/SHA256_SUM %{buildroot}%{_datadir}/%{name}-redistributable
Summary: %{product_name} client CLI binaries for Linux, macOS and Windows
BuildRequires: gcc
BuildRequires: golang >= %{golang_version}
Provides: %{package_name}-redistributable
Obsoletes: %{package_name}-redistributable
Provides: %{package_name}-redistributable = %{odo_version}
Obsoletes: %{package_name}-redistributable <= %{odo_version}
%description redistributable
%{product_name} client odo cross platform binaries for Linux, macOS and Windows.
@@ -91,3 +92,4 @@ Obsoletes: %{package_name}-redistributable
%{_datadir}/%{name}-redistributable/odo-windows-amd64.exe
%{_datadir}/%{name}-redistributable/odo-windows-amd64.exe.tar.gz
%{_datadir}/%{name}-redistributable/SHA256_SUM
%{_datadir}/%{name}-redistributable/VERSION