Source: firmware-nonfree
Followup-For: Bug #1064620
Hello.
Most suggestions are now obsolete.
Here are the remaining trivial style changes,
rebased on top of debian/20260110-1.
>From 438ddf66577cd6f6e0437898112e0267dfccdd50 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 23 Feb 2024 17:10:17 +0100
Subject: [PATCH 1/5] d/README.Debian: typo
---
debian/README.source | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/README.source b/debian/README.source
index ae7ae1c..e1fa269 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -91,7 +91,7 @@ Optional per-file metadata:
[<filename>_base] desc: One-line description for this file, used in
package description
-[<filename>_base] version: Verson number for this file, used in package
+[<filename>_base] version: Version number for this file, used in package
description
To re-generate debian/control (and other files) based on these
--
2.47.3
>From 48c4e05ac5263d3641003adbb1cff9debcab869d Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 23 Feb 2024 17:28:04 +0100
Subject: [PATCH 2/5] d/rules: include /usr/share/dpkg/pkg-info.mk
Also compute VERSION_SOURCE on demand with one rewriting.
---
debian/rules | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/debian/rules b/debian/rules
index a96e9d8..c264841 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,10 +1,8 @@
#!/usr/bin/make -f
SHELL := sh -e
-SOURCE := $(shell dpkg-parsechangelog -SSource)
-VERSION := $(shell dpkg-parsechangelog -SVersion)
-VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,')
-VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -rne 's,.*\+b([0-9]+)$$,\1,p')
-VERSION_SOURCE := $(patsubst %+b$(VERSION_BINNMU),%,$(VERSION))
+
+include /usr/share/dpkg/pkg-info.mk
+VERSION_SOURCE = $(shell echo "$(DEB_VERSION)" | sed -r 's,\+b([0-9]+)$$,,')
GENCONTROL = debian/bin/gencontrol.py
@@ -46,7 +44,7 @@ CONTROL_FILES += debian/bin/gencontrol.py debian/config/defines $(wildcard debia
# in the checksum.
debian/build/version-info: debian/changelog
mkdir -p $(@D)
- printf >$@ 'Source: %s\nVersion: %s\n' $(SOURCE) $(VERSION_SOURCE)
+ printf >$@ 'Source: %s\nVersion: %s\n' $(DEB_SOURCE) $(VERSION_SOURCE)
debian/control: $(GENCONTROL) $(CONTROL_FILES)
ifeq ($(wildcard debian/control.md5sum),)
@@ -71,8 +69,8 @@ debian/control-real: $(GENCONTROL) $(CONTROL_FILES)
@echo
exit 1
-DIR_ORIG = ../orig/$(SOURCE)-$(VERSION_UPSTREAM)
-TAR_ORIG_NAME = $(SOURCE)_$(VERSION_UPSTREAM).orig.tar.xz
+DIR_ORIG = ../orig/$(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)
+TAR_ORIG_NAME = $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz
TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))
orig: $(DIR_ORIG)
--
2.47.3
>From 5637fdd797adb1dd0f2b3075d13f0f5281bd18dc Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sun, 25 Feb 2024 01:16:09 +0100
Subject: [PATCH 3/5] gencontrol.py: remove unused process_template methods
---
debian/bin/gencontrol.py | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py
index 1248438..d1feac7 100755
--- a/debian/bin/gencontrol.py
+++ b/debian/bin/gencontrol.py
@@ -273,22 +273,6 @@ You must agree to the terms of this license before it is installed."""
print(package_metainfo_filename, '/usr/share/metainfo',
file=install_fh)
- def process_template(self, in_entry, vars):
- e = Template()
- for key, value in in_entry.items():
- if isinstance(value, PackageDescription):
- e[key] = self.process_description(value, vars)
- elif key[:2] == 'X-':
- pass
- else:
- e[key] = self.substitute(value, vars)
- return e
-
- def process_templates(self, in_entries, vars):
- entries = []
- for i in in_entries:
- entries.append(self.process_template(i, vars))
- return entries
if __name__ == '__main__':
GenControl()()
--
2.47.3
>From 275dc01e41282bbde9cd96079a6c558f10a86f43 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Fri, 23 Feb 2024 17:22:19 +0100
Subject: [PATCH 4/5] gencontrol.py: open files with context managers
---
debian/bin/gencontrol.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py
index d1feac7..7a140db 100755
--- a/debian/bin/gencontrol.py
+++ b/debian/bin/gencontrol.py
@@ -221,14 +221,16 @@ class GenControl(debian_linux.gencontrol.Gencontrol):
self.templates.get('postinst.initramfs-tools', vars))
if 'license_accept' in config_entry:
- license = open("%s/LICENSE.install" % package_dir, 'r').read()
+ with open("%s/LICENSE.install" % package_dir, 'r') as license_fh:
+ license = license_fh.read()
scripts.setdefault("preinst", []).append(
self.templates.get('preinst.license', vars))
templates = list(self.templates.get_templates_control('templates.license', vars))
templates[0].description.append(re.sub('\n\n', '\n.\n', license))
templates_filename = "debian/firmware-%s.templates" % package
- write_deb822(templates, open(templates_filename, 'w'))
+ with open(templates_filename, 'w') as templates_fh:
+ write_deb822(templates, templates_fh)
desc = packages_binary[0].description
desc.append(
@@ -248,7 +250,8 @@ You must agree to the terms of this license before it is installed."""
for script, script_contents in scripts.items():
script_contents.insert(0, "#!/bin/sh\n\nset -e\n")
script_contents.append("#DEBHELPER#\n\nexit 0\n")
- open("debian/firmware-%s.%s" % (package, script), "w").write("\n".join(script_contents))
+ with open("debian/firmware-%s.%s" % (package, script), "w") as script_fh:
+ script_fh.write("\n".join(script_contents))
self.bundle.add_packages(packages_binary, (package,), MakeFlags())
@@ -259,8 +262,8 @@ You must agree to the terms of this license before it is installed."""
package_metainfo_filename = \
f'debian/org.debian.firmware_{package_metainfo}.metainfo.xml'
# XXX Might need to escape some characters
- open(package_metainfo_filename, 'w') \
- .write(self.templates.get("metainfo.xml", vars))
+ with open(package_metainfo_filename, 'w') as metainfo_fh:
+ metainfo_fh.write(self.templates.get("metainfo.xml", vars))
def dh_install_escape(name):
return name.replace('$', '${}').replace(' ', '${Space}')
--
2.47.3
>From efd58296b36681f621d0226d5bd0a0b50e28ce18 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Thu, 19 Feb 2026 17:18:18 +0100
Subject: [PATCH 5/5] d/rules: remove gencontrol.py from GENCONTROL
GENCONTROL is expanded before each expansion of CONTROL_FILES.
---
debian/rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/rules b/debian/rules
index c264841..2e1becf 100755
--- a/debian/rules
+++ b/debian/rules
@@ -36,7 +36,7 @@ execute_after_dh_install:
| grep -Ev '^debian/firmware-qcom-soc/usr/lib/firmware/qcom/.*/w(lanmdsp|pss)\.mbn$$'
CONTROL_FILES = debian/build/version-info $(wildcard debian/templates/*.in)
-CONTROL_FILES += debian/bin/gencontrol.py debian/config/defines $(wildcard debian/config/*/defines) debian/modinfo.json
+CONTROL_FILES += debian/config/defines $(wildcard debian/config/*/defines) debian/modinfo.json
# debian/bin/gencontrol.py uses debian/changelog as input, but the
# output only depends on the source name and version. To avoid
--
2.47.3