From f63f2e947e6842216ef759dc3e8367ec902d4e52 Mon Sep 17 00:00:00 2001 From: Qiao Ma Date: Tue, 22 Aug 2023 20:49:46 +0800 Subject: [PATCH] anolis: spec: extends DIST_OFFICIAL_BUILD to DIST_BUILD_MODE ANBZ: #6189 Nightly build requires generate source rpm, but there are no way to control generating source rpm without setting DIST_OFFICIAL_BUILD. The old way to let srpm appear is using `sed -i 's/-bb/-ba/g'` to modify build.sh script in the ck-build(https://gitee.com/src-anolis-sig/ck-build) repo, but it is not elegant. This commit extends DIST_OFFICIAL_BUILD to DIST_BUILD_MODE, to explicitly let nightly build generate source rpm. Fixes: c17dfe45b035 ("anolis: spec: add function to build rpm package") Signed-off-by: Qiao Ma Acked-by: Xunlei Pang --- anolis/Makefile | 7 +++++-- anolis/Makefile.variables | 14 ++++++++++---- anolis/buildpkg.sh | 14 ++++++++++---- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/anolis/Makefile b/anolis/Makefile index af080047b5a3..5346c50c9636 100644 --- a/anolis/Makefile +++ b/anolis/Makefile @@ -36,8 +36,11 @@ help: @echo ' DIST - the distribution suffix, eg: .an7, .an8, .an23' @echo ' DIST_DO_SIGNMODULES - should sign kernel modules. optional: 0/1, default: 0' @echo ' DIST_OUTPUT - the output directory, default: $(DIST_SHORT_OUTPUT)' - @echo ' DIST_OFFICIAL_BUILD - if offical build, the kernel version looks like: 5.10.134-15.1_rc1,' - @echo ' else it looks like: 5.10.134-1.git.6235a991a61d' + @echo ' DIST_BUILD_MODE - the build mode. optional: official/nightly/devel' + @echo ' !!! NOTE: BE CAUTIOUS ABOUT USING official BUILD !!!' + @echo ' - official build. kernel version: $(DIST_KERNELVERSION)-$(DIST_OFFICIAL_PKGRELEASEVERION), with srpm' + @echo ' - nightly build. kernel version: $(DIST_KERNELVERSION)-$(DIST_UNOFFICIAL_PKGRELEASEVERION), with srpm' + @echo ' - devel build. kernel version: $(DIST_KERNELVERSION)-$(DIST_UNOFFICIAL_PKGRELEASEVERION), without srpm' @echo ' DIST_BUILD_NUMBER - the build number for unofficial build, eg: 1/2' @echo ' DIST_BUILD_VARIANT & DIST_BUILD_EXTRA - see comments in buildpkg.sh' diff --git a/anolis/Makefile.variables b/anolis/Makefile.variables index 277493e51fa7..318df6a83df6 100644 --- a/anolis/Makefile.variables +++ b/anolis/Makefile.variables @@ -4,9 +4,11 @@ # the dist suffix, eg: an7, an8, an23 DIST ?= .an8 -# if offical build, the kernel version looks like: 5.10.134-15.1_rc1 -# else it looks like: 5.10.134-1.git.6235a991a61d -DIST_OFFICIAL_BUILD ?= +# build mode: +# - official build, the kernel version looks like: 5.10.134-15.1_rc1, and also generate source rpm +# - nightly build, the kernel version looks like: 5.10.134-1.git.6235a991a61d, and also generate source rpm +# - devel build, same as nightly build, without source rpm +DIST_BUILD_MODE ?= devel # the package release version. # eg: for ANCK 5.10-015.1, the major version is 15, the minor version is 1 @@ -62,7 +64,11 @@ DIST_GIT_HEAD_FULL_COMMIT_ID = $(shell git rev-parse HEAD) DIST_UNOFFICIAL_PKGRELEASEVERION = ${DIST_BUILD_NUMBER}.git.$(DIST_GIT_HEAD_SHORT_COMMIT_ID) # final kernel version -DIST_PKGRELEASEVERION = $(if $(DIST_OFFICIAL_BUILD),$(DIST_OFFICIAL_PKGRELEASEVERION),$(DIST_UNOFFICIAL_PKGRELEASEVERION)) +ifeq ("${DIST_BUILD_MODE}", "official") +DIST_PKGRELEASEVERION = $(DIST_OFFICIAL_PKGRELEASEVERION) +else +DIST_PKGRELEASEVERION = $(DIST_UNOFFICIAL_PKGRELEASEVERION) +endif DIST_ANOLIS_VERSION = $(DIST_KERNELVERSION)-$(DIST_PKGRELEASEVERION) # the package id used for compress kernel tarball: diff --git a/anolis/buildpkg.sh b/anolis/buildpkg.sh index a0fb28a895f5..5a42161521e4 100644 --- a/anolis/buildpkg.sh +++ b/anolis/buildpkg.sh @@ -1,20 +1,26 @@ set -xe function do_rpmbuild() { - if [ -z "$DIST_OFFICIAL_BUILD" ]; then - CMD="-bb" - else + if [ "$DIST_BUILD_MODE" == "official" ] || [ "$DIST_BUILD_MODE" == "nightly" ]; then CMD="-ba" + else + CMD="-bb" fi # Now we have: # + variants: default, only-debug, with-debug # + extras: base, with-debuginfo, full - # + modes: nightly, dev, pre-release + # + modes: official, nightly, dev #TODO: add with-gcov # # Matrix # + # | BuildMode | KernelName | GenerateSrpm | + # |-----------|-----------------|--------------| + # | official | without sha id | Yes | + # | nightly | with git sha id | Yes | + # | devel | with git sha id | No | + # # | Extra\Var | Default | Only-debug | With-debug | # |-----------|----------|------------|------------| # | Base | +default | -default | +default | -- Gitee