Skip to content

Commit 317d0cc

Browse files
committed
cagent: BuildTime var removed and align other ldflags
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent e8dcf48 commit 317d0cc

File tree

5 files changed

+5
-35
lines changed

5 files changed

+5
-35
lines changed

pkg/cagent/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ ARG PKG_DEB_REVISION
109109
ARG PKG_DEB_EPOCH
110110
ARG SOURCE_DATE_EPOCH
111111
RUN --mount=type=bind,source=scripts/pkg-deb-build.sh,target=/usr/local/bin/pkg-deb-build \
112-
--mount=type=bind,source=scripts/gen-ldflags.sh,target=/usr/local/bin/gen-ldflags \
113112
--mount=type=bind,from=scripts,source=gen-ver.sh,target=/usr/local/bin/gen-ver \
114113
--mount=type=bind,from=scripts,source=gen-deb-changelog.sh,target=/usr/local/bin/gen-deb-changelog \
115114
--mount=type=bind,from=scripts,source=fix-cc.sh,target=/usr/local/bin/fix-cc \
@@ -147,7 +146,6 @@ ARG PKG_RPM_BUILDFLAGS
147146
ARG PKG_RPM_RELEASE
148147
ARG SOURCE_DATE_EPOCH
149148
RUN --mount=type=bind,source=scripts/pkg-rpm-build.sh,target=/usr/local/bin/pkg-rpm-build \
150-
--mount=type=bind,source=scripts/gen-ldflags.sh,target=/usr/local/bin/gen-ldflags \
151149
--mount=type=bind,from=scripts,source=gen-ver.sh,target=/usr/local/bin/gen-ver \
152150
--mount=type=bind,from=scripts,source=fix-cc.sh,target=/usr/local/bin/fix-cc \
153151
--mount=type=bind,from=src-tgz,source=/out/cagent.tgz,target=/root/rpmbuild/SOURCES/cagent.tgz \

pkg/cagent/deb/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ override_dh_builddeb:
1515
override_dh_auto_build:
1616
set -x; \
1717
cd $(CURDIR)/cagent && \
18-
go build -trimpath -ldflags="$$(gen-ldflags)" -o /usr/bin/cagent main.go
18+
go build -trimpath -ldflags="-w -X 'github.com/docker/cagent/pkg/version.Version=$(VERSION)' -X 'github.com/docker/cagent/pkg/version.Commit=$(REVISION)'" -o /usr/bin/cagent .
1919

2020
override_dh_auto_test:
2121
ver="$$(/usr/bin/cagent version | grep 'cagent version' | awk '{print $$3}')"; \

pkg/cagent/rpm/cagent.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Epoch: 0
77
Source0: cagent.tgz
88
Summary: TODO
99
Group: Tools/Docker
10-
License: ASL 2.0
10+
License: Apache-2.0
1111
URL: https://github.com/docker/cagent
1212
Vendor: Docker
1313
Packager: Docker <support@docker.com>
@@ -23,7 +23,7 @@ TODO
2323
%build
2424
pushd ${RPM_BUILD_DIR}/src/cagent
2525
mkdir bin && \
26-
go build -trimpath -ldflags="$(VERSION="%{_origversion}" COMMIT="%{_commit}" gen-ldflags)" -o bin/cagent main.go
26+
go build -trimpath -ldflags="-w -X github.com/docker/cagent/pkg/version.Version=%{_origversion} -X github.com/docker/cagent/pkg/version.Commit=%{_commit}" -o bin/cagent .
2727
popd
2828

2929
%check

pkg/cagent/scripts/gen-ldflags.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.

pkg/cagent/scripts/pkg-static-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ mkdir -p ${BUILDDIR}/${PKG_NAME}
4949
(
5050
set -x
5151
pushd ${SRCDIR}
52-
go build -trimpath -ldflags "-s -w -X 'github.com/docker/cagent/pkg/version.Version=${GENVER_VERSION}' -X 'github.com/docker/cagent/pkg/version.Commit=${GENVER_COMMIT}'" -o "${BUILDDIR}/${PKG_NAME}/docker-cagent${binext}" .
52+
go build -trimpath -ldflags "-w -X 'github.com/docker/cagent/pkg/version.Version=${GENVER_VERSION}' -X 'github.com/docker/cagent/pkg/version.Commit=${GENVER_COMMIT}'" -o "${BUILDDIR}/${PKG_NAME}/cagent${binext}" .
5353
popd
54-
xx-verify --static "${BUILDDIR}/${PKG_NAME}/docker-cagent${binext}"
54+
xx-verify --static "${BUILDDIR}/${PKG_NAME}/cagent${binext}"
5555
)
5656

5757
pkgoutput="$OUTDIR/static/$(xx-info os)/$(xx-info arch)"

0 commit comments

Comments
 (0)