[P/U] [PATCH v2 2/7] UBUNTU: [packaging] avoid piping control-create for error detection
Masahiro Yamada
masahiro.yamada at canonical.com
Thu Feb 20 06:33:36 UTC 2025
Currently, it is impossible to detect any error in the control-create
script because its output is piped to the sed command.
To address this, separate control-create and sed into distinct commands,
and enable the -e option in the control-create.
With this change, we can prevent situations where we proceed with
invalid debian/control without noticing potential issues in the
control-create.
Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
---
debian/rules | 20 ++++++++------------
debian/scripts/control-create | 2 ++
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/debian/rules b/debian/rules
index b70559afa0c4..948bb5ccee08 100755
--- a/debian/rules
+++ b/debian/rules
@@ -186,24 +186,20 @@ $(DEBIAN)/control.stub: \
for i in $(control_files); do \
cat $$i; \
echo ""; \
- done | sed -e 's/PKGVER/$(DEB_VERSION_UPSTREAM)/g' \
+ done > $(DEBIAN)/control.stub;
+ flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.*))";\
+ for i in $$flavours; do \
+ $(SHELL) debian/scripts/control-create $$i "$(any_signed)" \
+ >> $(DEBIAN)/control.stub; \
+ done
+ sed -i -e 's/PKGVER/$(DEB_VERSION_UPSTREAM)/g' \
-e 's/ABINUM/$(abinum)/g' \
-e 's/SRCPKGNAME/$(DEB_SOURCE)/g' \
-e 's/=HUMAN=/$(human_arch)/g' \
-e 's/=SERIES=/$(DEB_DISTRIBUTION)/g' \
-e 's|\(^Maintainer:.*\)|\1\nXSC-Ubuntu-Compatible-Signing: $(UBUNTU_COMPATIBLE_SIGNING)|g' \
-e 's/\(^Build-Depends:$$\)/\1\n$(GCC_BUILD_DEPENDS)/g' \
- > $(DEBIAN)/control.stub;
- flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.*))";\
- for i in $$flavours; do \
- $(SHELL) debian/scripts/control-create $$i "$(any_signed)" | \
- sed -e 's/PKGVER/$(DEB_VERSION_UPSTREAM)/g' \
- -e 's/ABINUM/$(abinum)/g' \
- -e 's/SRCPKGNAME/$(DEB_SOURCE)/g' \
- -e 's/=HUMAN=/$(human_arch)/g' \
- -e 's/=SERIES=/$(DEB_DISTRIBUTION)/g' \
- >> $(DEBIAN)/control.stub; \
- done
+ $(DEBIAN)/control.stub
.PHONY: debian/control
debian/control: $(DEBIAN)/control.stub
diff --git a/debian/scripts/control-create b/debian/scripts/control-create
index f2af8b9bb2f4..234573911414 100755
--- a/debian/scripts/control-create
+++ b/debian/scripts/control-create
@@ -1,5 +1,7 @@
#!/bin/bash
+set -e
+
. debian/debian.env
vars=$1
--
2.43.0
More information about the kernel-team
mailing list