diff --git a/go-build.patch b/go-build.patch new file mode 100644 index 0000000..9c85206 --- /dev/null +++ b/go-build.patch @@ -0,0 +1,29 @@ +Index: percona-toolkit-3.3.1/src/go/Makefile +=================================================================== +--- percona-toolkit-3.3.1.orig/src/go/Makefile ++++ percona-toolkit-3.3.1/src/go/Makefile +@@ -14,9 +14,9 @@ FILES = $(shell find . -type f -name '*. + + PREFIX=$(shell pwd) + TOP_DIR=$(shell git rev-parse --show-toplevel) +-BIN_DIR=$(shell git rev-parse --show-toplevel)/bin +-SRC_DIR=$(shell git rev-parse --show-toplevel)/src/go +-LDFLAGS="-X main.Version=${VERSION} -X main.Build=${BUILD} -X main.GoVersion=${GOVERSION} -X main.Commit=${COMMIT} -s -w" ++BIN_DIR=$(TOP_DIR)/bin ++SRC_DIR=$(TOP_DIR)/src/go ++LDFLAGS="-X main.Version=${VERSION} -X main.Build=${BUILD} -X main.GoVersion=${GOVERSION} -X main.Commit=${COMMIT} -w" + + TEST_PSMDB_VERSION?=4.0 + TEST_MONGODB_FLAVOR?=percona/percona-server-mongodb +@@ -111,6 +111,11 @@ env-down: env ## Clean-up MongoDB doc + docker-compose down -v + rm .env + ++linux: ## Build Mongo tools for linux-amd64 ++ echo "Building linux binaries in ${BIN_DIR}" ++ $(foreach pkg,$(pkgs),rm -f ${BIN_DIR}/$(pkg) 2> /dev/null;) ++ $(foreach pkg,$(pkgs),go build -mod=vendor -buildmode=pie -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg) ./$(pkg);) ++ + linux-amd64: ## Build Mongo tools for linux-amd64 + @echo "Building linux/amd64 binaries in ${BIN_DIR}" + @cd ${TOP_DIR} && go get ./... diff --git a/percona-toolkit.changes b/percona-toolkit.changes index 4978b73..a63123d 100644 --- a/percona-toolkit.changes +++ b/percona-toolkit.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Oct 5 02:35:34 UTC 2021 - Marcus Rueckert + +- enable golang based tools + 1. package is no longer noarch + 2. added go-build.patch + 3. add BR for golang tools + ------------------------------------------------------------------- Fri Apr 30 06:39:28 UTC 2021 - Denys Kondratenko diff --git a/percona-toolkit.spec b/percona-toolkit.spec index a7011f5..26bcfd2 100644 --- a/percona-toolkit.spec +++ b/percona-toolkit.spec @@ -15,6 +15,7 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # +%define revision 6917c5d Name: percona-toolkit Version: 3.3.1 @@ -24,7 +25,10 @@ License: GPL-2.0-only Group: Productivity/Databases/Tools URL: https://www.percona.com/software/percona-toolkit/ Source: https://www.percona.com/downloads/%{name}/%{version}/source/tarball/%{name}-%{version}.tar.gz +Source1: vendor.tar.xz Source2: %{name}.conf +Source9: series +Patch1: go-build.patch Requires: perl(DBD::mysql) >= 1.0 Requires: perl(DBI) >= 1.13 Requires: perl(IO::Socket::SSL) @@ -32,8 +36,10 @@ Requires: perl(Term::ReadKey) >= 2.10 Requires: perl(Time::HiRes) Provides: maatkit = 7410.%{version} Obsoletes: maatkit < 7410 -BuildArch: noarch +BuildRequires: golang-packaging +BuildRequires: golang(API) %{perl_requires} +%{go_nostrip} %description Percona Toolkit is a collection of advanced command-line tools used by @@ -52,13 +58,21 @@ visit http://www.percona.com/software/. This collection was formerly known as Maatkit. %prep -%autosetup +%autosetup -p1 -a 1 %build perl Makefile.PL INSTALLDIRS=vendor < /dev/null sed -i 's|%{_bindir}/env perl|%{_bindir}/perl|' bin/* sed -i 's|%{_bindir}/env bash|%{_bindir}/bash|' bin/* %make_build +pushd src/go +make linux \ + TOP_DIR=../../ \ + BIN_DIR=../../bingo/ \ + VERSION=%{version} \ + BUILD=$(date -u '+%FT%T%z' -d @${SOURCE_DATE_EPOCH}) \ + COMMIT=%{revision} +popd %install %perl_make_install @@ -70,6 +84,7 @@ rm -rf %{buildroot}%{_localstatedir}/adm/perl-modules/%{name} # a blank configuration file mkdir -p %{buildroot}%{_sysconfdir}/%{name} cp %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/ +cp -a bingo/* %{buildroot}%{_bindir}/ %files %license COPYING diff --git a/series b/series new file mode 100644 index 0000000..3a4ba50 --- /dev/null +++ b/series @@ -0,0 +1 @@ +go-build.patch diff --git a/vendor.tar.xz b/vendor.tar.xz new file mode 100644 index 0000000..82c9bfe --- /dev/null +++ b/vendor.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f517890e013ad0e9c06b8137181a2775e94fe77e6e2b8dca8b76ff60d721629a +size 1860576