[Pkg-samba-maint] [Git][samba-team/samba][mjt-4.16] 4 commits: switch from including /usr/share/dpkg/architecture.mk back to inline definitions

Michael Tokarev (@mjt) gitlab at salsa.debian.org
Wed Mar 30 16:33:57 BST 2022



Michael Tokarev pushed to branch mjt-4.16 at Debian Samba Team / samba


Commits:
25fdd845 by Michael Tokarev at 2022-03-30T17:34:33+03:00
switch from including /usr/share/dpkg/architecture.mk back to inline definitions

This effectively reverts commit f676a3b11fa61eb6e2d5546fc5d47972f37d93cf
"d/rules: do not explicitly set DEB_HOST_*, include architecture.mk instead", -
while including architecture.mk made _startup_ time faster, it also
made time before the first external command make(1) invokes significantly
slower, because architecture.mk defines lots of variables ane make(1)
exports _all_ of them before it invokes commands to make the first target.

It'd be nice if architecture.mk were defining all vars in one invocation
of dpkg-architecture (which it allows) instead of invoking it for every
variable. For this, I guess, make(1) needs to support reading makefile
fragments from external commands, which it does not.

This all is not very important in the buildd environment since dpkg/dh
already exports all these variables before invoking d/rules, so we
actually never call dpkg-architecture. But it makes a lot of sense
when debugging build.

- - - - -
ed353ab9 by Michael Tokarev at 2022-03-30T17:50:29+03:00
internal-ldb: cache ldb-version-related vars in d/ldb-version.mk

This significantly reduces the startup cost of make and sub-makes.

We store two variables (${LDB_DEB_VERSION} and ${LDB_DEPENDS})
in debian/ldb-version.mk, defining them once in a simple shell
fragment, from lib/ldb/wscript, and include this make fragment
in d/rules. The variables in there needs complex (from the
makefile PoV) commands to set, and they're repeated in each
submake too (think dh sequence). The idea is to generate it
once so it can be directly read by all submakes and need not
be regenerated each time while one debug the build procedure.

There's no need to keep d/ldb-version.mk in git or in the
.debian.tar.gz file, but by keeping it we will avoid removing
this file so it is regenerated on every ./d/rules clean.

- - - - -
819e5d37 by Michael Tokarev at 2022-03-30T18:03:19+03:00
d/rules: only invoke dh sequence for known targets

- - - - -
c752aa1a by Michael Tokarev at 2022-03-30T18:15:46+03:00
d/rules: another startup time optimization: cache dh_listpackages output, run it once not 8 times in a row

- - - - -


2 changed files:

- + debian/ldb-version.mk
- debian/rules


Changes:

=====================================
debian/ldb-version.mk
=====================================
@@ -0,0 +1,3 @@
+# autogenerated from lib/ldb/wscript
+LDB_DEB_VERSION := ${LDB_EPOCH}2.5.0+samba${DEB_VERSION_UPSTREAM_REVISION}
+LDB_DEPENDS := libldb2 (>> ${LDB_EPOCH}2.5.0~), libldb (<< ${LDB_EPOCH}2.5.1~)


=====================================
debian/rules
=====================================
@@ -5,24 +5,34 @@ DESTDIR = $(CURDIR)/debian/tmp
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/buildflags.mk
 include /usr/share/dpkg/pkg-info.mk
 include /usr/share/dpkg/vendor.mk
+# faste version of dpkg/architecture.mk defining only vars we actually need
+$(foreach var,DEB_HOST_ARCH DEB_HOST_ARCH_OS DEB_HOST_MULTIARCH,\
+	$(eval export ${var} ?= $(shell dpkg-architecture -q${var})))
 
 export PYSHORT=python3
 export PYTHON=$(shell which $(PYSHORT))
 export PYTHON_CONFIG=$(PYTHON)-config
 PYTHON_SUFFIX = $(call dpkg_late_eval,PYTHON_SUFFIX,\
 	${PYTHON_CONFIG} --extension-suffix | sed 's/\.so$$//')
+dh_packagelist := $(shell dh_listpackages)
 
-LDB_EPOCH = 2
-LDB_VERSION = $(shell sed -nr "s/^VERSION *= *'(.*)'/${LDB_EPOCH}:\\1/p; t q; b; : q; q" lib/ldb/wscript)
-LDB_DEB_VERSION = ${LDB_VERSION}+samba${DEB_VERSION_UPSTREAM_REVISION}
-LDB_NEXT_VERSION = $(shell ${PYSHORT} -c "x = '$(LDB_VERSION)'.split('.'); x[-1] = str(int(x[-1])+1); print('.'.join(x))")
+LDB_EPOCH := 2:
+debian/ldb-version.mk: lib/ldb/wscript
+# define two variables based on local version of ldb
 # samba ships ldb modules, which are specific to the ldb version,
 # so we need a strict dependency on the upstream ldb version
-LDB_DEPENDS = libldb2 (<< ${LDB_NEXT_VERSION}~), libldb2 (>> ${LDB_VERSION}~)
+	set -e; \
+	v=$$(grep ^VERSION $< | cut -d\' -f2); \
+	[ -n "$$v" ] || { echo "E: unable to get LDB version from $<" >&2; exit 1; }; \
+	v="\$${LDB_EPOCH}$$v"; n="$${v%.*}.$$(($${v##*.}+1))"; exec 3>$@.tmp; \
+	echo "# autogenerated from $<" >&3; \
+	echo "LDB_DEB_VERSION := $$v+samba\$${DEB_VERSION_UPSTREAM_REVISION}" >&3; \
+	echo "LDB_DEPENDS := libldb2 (>> $$v~), libldb (<< $$n~)" >&3; \
+	exec 3>&-; mv -f $@.tmp $@
+include debian/ldb-version.mk
 
 V = 1
 WAF := PYTHONHASHSEED=1 $(PYTHON) ./buildtools/bin/waf $(if ${V},-v)
@@ -121,7 +131,8 @@ ifeq ($(DEB_VENDOR) $(DEB_HOST_ARCH), Ubuntu i386)
 		-Nsamba-testsuite
 endif
 
-%:
+binary binary-arch binary-indep build build-arch build-indep \
+clean install install-arch install-indep: %:
 	dh $* --with python3 $(BUILD_PACKAGES)
 
 override_dh_auto_configure:
@@ -225,15 +236,15 @@ override_dh_installchangelogs:
 	dh_installchangelogs
 
 override_dh_installinit:
-ifneq (,$(filter samba, $(shell dh_listpackages)))
+ifneq (,$(filter samba, ${dh_packagelist}))
 	dh_installinit -psamba --name smbd
 	dh_installinit -psamba --name nmbd --error-handler nmbd_error_handler
 	dh_installinit -psamba --name samba-ad-dc
 endif
-ifneq (,$(filter winbind, $(shell dh_listpackages)))
+ifneq (,$(filter winbind, ${dh_packagelist}))
 	dh_installinit -pwinbind
 endif
-ifneq (,$(filter ctdb, $(shell dh_listpackages)))
+ifneq (,$(filter ctdb, ${dh_packagelist}))
 	# Install /etc/init.d/ctdb
 	mkdir -p $(CURDIR)/debian/ctdb/etc/init.d
 	install -m755 ctdb/config/ctdb.init $(CURDIR)/debian/ctdb/etc/init.d/ctdb
@@ -242,13 +253,13 @@ ifneq (,$(filter ctdb, $(shell dh_listpackages)))
 endif
 
 override_dh_installsystemd:
-ifneq (,$(filter samba, $(shell dh_listpackages)))
+ifneq (,$(filter samba, ${dh_packagelist}))
 	dh_installsystemd -psamba
 endif
-ifneq (,$(filter winbind, $(shell dh_listpackages)))
+ifneq (,$(filter winbind, ${dh_packagelist}))
 	dh_installsystemd -pwinbind
 endif
-ifneq (,$(filter ctdb, $(shell dh_listpackages)))
+ifneq (,$(filter ctdb, ${dh_packagelist}))
 	dh_installsystemd -pctdb --no-start --no-stop-on-upgrade
 endif
 
@@ -263,13 +274,13 @@ override_dh_installpam:
 
 override_dh_fixperms:
 	dh_fixperms
-ifneq (,$(filter samba-common, $(shell dh_listpackages)))
+ifneq (,$(filter samba-common, ${dh_packagelist}))
 	chmod a+x debian/samba-common/usr/share/samba/panic-action
 endif
-ifneq (,$(filter samba, $(shell dh_listpackages)))
+ifneq (,$(filter samba, ${dh_packagelist}))
 	chmod 1777 debian/samba/var/spool/samba/
 endif
-ifneq (,$(filter smbclient, $(shell dh_listpackages)))
+ifneq (,$(filter smbclient, ${dh_packagelist}))
 	chmod 0700 debian/smbclient/usr/lib/*/samba/smbspool_krb5_wrapper
 endif
 



View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/de9705dd2a102c634675abb5d9b816bb71ee6b63...c752aa1a9cb714dffb90324e513f05450e326841

-- 
View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/de9705dd2a102c634675abb5d9b816bb71ee6b63...c752aa1a9cb714dffb90324e513f05450e326841
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-samba-maint/attachments/20220330/0598a608/attachment-0001.htm>


More information about the Pkg-samba-maint mailing list