Skip to content

Commit 6a24508

Browse files
author
Evan Lezar
committed
Merge branch 'set-version-in-cl' into 'main'
Allow package versions to be specified externally See merge request nvidia/container-toolkit/libnvidia-container!227
2 parents 194d84c + 576dce2 commit 6a24508

14 files changed

+418
-332
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/dist
2+
/.git/objects

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# NVIDIA Container Toolkit Library and CLI Changelog
2+
3+
## 1.14.0~rc.3
4+
* Generate debian and RPM changelogs automatically.
5+
6+
## 1.14.0~rc.2
7+
* Include Shared Compiler Library (`libnvidia-gpucomp.so``) in the list of compute libaries.
8+
9+
## 1.14.0~rc.1
10+
* Remove `linvidia-container0`` dependency on Ubuntu-based arm64 platforms
11+
* Support OpenSSL 3 with the Encrypt/Decrypt library

Makefile

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ BIN_SCRIPT = $(SRCS_DIR)/cli/$(BIN_NAME).lds
101101
##### Target definitions #####
102102

103103
ARCH ?= $(call getarch)
104-
MAJOR := $(call getdef,NVC_MAJOR,$(LIB_INCS))
105-
MINOR := $(call getdef,NVC_MINOR,$(LIB_INCS))
106-
PATCH := $(call getdef,NVC_PATCH,$(LIB_INCS))
107-
# Extract the VERSION and TAG from the version header file. We strip quotes.
108-
VERSION_STRING := $(subst ",,$(call getdef,NVC_VERSION,$(LIB_INCS)))
109-
TAG := $(subst ",,$(call getdef,NVC_TAG,$(LIB_INCS)))
110-
VERSION := $(MAJOR).$(MINOR).$(PATCH)
111104

112105
ifeq ($(MAJOR),)
113106
$(error Invalid major version)
@@ -123,6 +116,14 @@ ifneq ($(VERSION_STRING),$(VERSION)$(if $(TAG),-$(TAG),))
123116
$(error Version not updated correctly: $(VERSION_STRING) != $(VERSION)$(if $(TAG),-$(TAG),))
124117
endif
125118

119+
$(SRCS_DIR)/nvc.h: $(SRCS_DIR)/nvc.h.template
120+
cat $< | \
121+
sed -e 's/{{NVC_MAJOR}}/$(MAJOR)/g' | \
122+
sed -e 's/{{NVC_MINOR}}/$(MINOR)/g' | \
123+
sed -e 's/{{NVC_PATCH}}/$(PATCH)/g' | \
124+
sed -e 's/{{NVC_TAG}}/$(if $(TAG),"$(TAG)",)/g' | \
125+
sed -e 's/{{NVC_VERSION}}/"$(VERSION_STRING)"/g' > $@
126+
126127
BIN_NAME := nvidia-container-cli
127128
LIB_NAME := libnvidia-container
128129
LIB_STATIC := $(LIB_NAME).a
@@ -213,7 +214,7 @@ $(LIB_RPC_SRCS): $(LIB_RPC_SPEC)
213214
$(RM) $@
214215
cd $(dir $@) && $(RPCGEN) $(RPCGENFLAGS) -C -M -N -o $(notdir $@) $(LIB_RPC_SPEC)
215216

216-
$(LIB_OBJS): %.lo: %.c | deps
217+
$(LIB_OBJS): %.lo: %.c | deps $(SRCS_DIR)/nvc.h
217218
$(CC) $(LIB_CFLAGS) $(LIB_CPPFLAGS) -MMD -MF $*.d -c $(OUTPUT_OPTION) $<
218219

219220
$(BIN_OBJS): %.o: %.c | shared
@@ -335,12 +336,21 @@ clean: mostlyclean depsclean
335336
distclean: clean
336337
$(RM) -r $(DEPS_DIR) $(DIST_DIR) $(DEBUG_DIR)
337338
$(RM) $(LIB_RPC_SRCS) $(LIB_STATIC) $(LIB_SHARED) $(BIN_NAME)
339+
$(RM) -f $(SRCS_DIR)/nvc.h
338340

339341
deb: DESTDIR:=$(DIST_DIR)/$(LIB_NAME)_$(VERSION)_$(ARCH)
340342
deb: prefix:=/usr
341343
deb: libdir:=/usr/lib/@DEB_HOST_MULTIARCH@
344+
345+
346+
PKG_VERS := $(VERSION)$(if $(TAG),~$(TAG),)
347+
PKG_REV := 1
342348
deb: install
343349
$(CP) -T $(PKG_DIR)/deb $(DESTDIR)/debian
350+
cd $(DESTDIR) && dch --create --package="$(PKG_NAME)" \
351+
--newversion "$(PKG_VERS)-$(PKG_REV)" \
352+
"See https://gitlab.com/nvidia/container-toolkit/libnvidia-container/-/blob/$(REVISION)/CHANGELOG.md for the changelog" && \
353+
dch --controlmaint --release ""
344354
cd $(DESTDIR) && debuild -eDISTRIB -eSECTION --dpkg-buildpackage-hook='debian/prepare %v' -a$(ARCH) -us -uc -B
345355
cd $(DESTDIR) && (yes | debuild clean || yes | debuild -- clean)
346356

@@ -350,5 +360,13 @@ rpm: all
350360
$(CP) -T $(PKG_DIR)/rpm $(DESTDIR)
351361
$(LN) -nsf $(CURDIR) $(DESTDIR)/BUILD
352362
$(MKDIR) -p $(DESTDIR)/RPMS && $(LN) -nsf $(DIST_DIR) $(DESTDIR)/RPMS/$(ARCH)
353-
cd $(DESTDIR) && rpmbuild --clean --target=$(ARCH) -bb -D"_topdir $(DESTDIR)" -D"_version $(VERSION)" $(and $(TAG),-D"_tag $(TAG)") -D"_major $(MAJOR)" SPECS/*
363+
cd $(DESTDIR) && \
364+
rpmbuild --clean --target=$(ARCH) -bb \
365+
-D"_topdir $(DESTDIR)" \
366+
-D "release_date $(shell date +'%a %b %d %Y')" \
367+
-D"version $(PKG_VERS)" \
368+
-D"release $(PKG_REV)" \
369+
-D"_major $(MAJOR)" \
370+
-D "git_commit ${REVISION}" \
371+
SPECS/*.spec
354372
-cd $(DESTDIR) && rpmlint RPMS/*

mk/Dockerfile.amazonlinux

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ COPY . .
5353

5454
ARG REVISION
5555
ENV REVISION=${REVISION}
56+
ARG LIB_VERSION
57+
ENV LIB_VERSION=${LIB_VERSION}
58+
ARG LIB_TAG
59+
ENV LIB_TAG=${LIB_TAG}
60+
5661
RUN make distclean && make -j"$(nproc)"
5762

5863
# Use the revision as the package version for the time being

mk/Dockerfile.centos

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ ENV LDLIBS=${LDLIBS}
6767

6868
ARG REVISION
6969
ENV REVISION=${REVISION}
70+
ARG LIB_VERSION
71+
ENV LIB_VERSION=${LIB_VERSION}
72+
ARG LIB_TAG
73+
ENV LIB_TAG=${LIB_TAG}
74+
7075
RUN make distclean && make -j"$(nproc)"
7176

7277
# Use the revision as the package version for the time being

mk/Dockerfile.debian

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ ENV WITH_SECCOMP=${WITH_SECCOMP}
5151

5252
ARG REVISION
5353
ENV REVISION=${REVISION}
54+
ARG LIB_VERSION
55+
ENV LIB_VERSION=${LIB_VERSION}
56+
ARG LIB_TAG
57+
ENV LIB_TAG=${LIB_TAG}
58+
5459
RUN make distclean && make -j"$(nproc)"
5560

5661
# Use the revision as the package version for the time being

mk/Dockerfile.opensuse-leap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ COPY . .
4646

4747
ARG REVISION
4848
ENV REVISION=${REVISION}
49+
ARG LIB_VERSION
50+
ENV LIB_VERSION=${LIB_VERSION}
51+
ARG LIB_TAG
52+
ENV LIB_TAG=${LIB_TAG}
53+
4954
# META_NOECHO=echo is required to work around a bug in Leap 15's version of bmake,
5055
# see also https://github.com/ptt/pttbbs/issues/30
5156
RUN export META_NOECHO=echo && \

mk/Dockerfile.ubuntu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ ENV WITH_SECCOMP=${WITH_SECCOMP}
5050

5151
ARG REVISION
5252
ENV REVISION=${REVISION}
53+
ARG LIB_VERSION
54+
ENV LIB_VERSION=${LIB_VERSION}
55+
ARG LIB_TAG
56+
ENV LIB_TAG=${LIB_TAG}
5357

5458
RUN make distclean && make -j"$(nproc)"
5559

mk/docker.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ DIST_DIR ?= $(CURDIR)/dist
3131
MAKE_DIR ?= $(CURDIR)/mk
3232
REVISION ?= $(shell git rev-parse HEAD)
3333

34+
include $(CURDIR)/versions.mk
35+
3436
# Supported OSs by architecture
3537
AMD64_TARGETS := ubuntu20.04 ubuntu18.04 ubuntu16.04 debian10 debian9
3638
X86_64_TARGETS := centos7 centos8 rhel7 rhel8 amazonlinux2 opensuse-leap15.1
@@ -161,11 +163,14 @@ docker-build-%: $(ARTIFACTS_DIR)
161163
--build-arg CFLAGS="$(CFLAGS)" \
162164
--build-arg LDLIBS="$(LDLIBS)" \
163165
--build-arg REVISION="$(REVISION)" \
166+
--build-arg LIB_VERSION="$(LIB_VERSION)" \
167+
--build-arg LIB_TAG="$(LIB_TAG)" \
164168
$(EXTRA_BUILD_ARGS) \
165169
--tag $(BUILDIMAGE) \
166170
--file $(DOCKERFILE) .
167171
$(DOCKER) run \
168172
--platform=linux/$(ARCH) \
173+
--rm \
169174
-e TAG \
170175
-v $(ARTIFACTS_DIR):/dist \
171176
$(BUILDIMAGE)

pkg/deb/changelog renamed to pkg/deb/changelog.old

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
libnvidia-container (1.14.0~rc.3-1) experimental; urgency=medium
2-
3-
* Bump version to 1.14.0~rc.3
4-
5-
-- NVIDIA CORPORATION <[email protected]> Fri, 04 Aug 2023 15:14:19 +0200
1+
# Note: as of 1.14.0~rc.3-1 this file is no longer updated, with a changelog
2+
# entry for a given release generated as part of the packaging step.
63

74
libnvidia-container (1.14.0~rc.2-1) experimental; urgency=medium
85

0 commit comments

Comments
 (0)