From 9d795599a04309dbec6325a86a1687bb8d7f96f1 Mon Sep 17 00:00:00 2001
From: Ark74 <ark@switnet.org>
Date: Wed, 28 Jun 2023 11:54:19 -0600
Subject: [PATCH 1/2] linux-hwe-5.19: replace script with dctrl-tools

---
 helpers/DATA/linux-hwe-5.19/d-i.patch         |  2 +-
 .../DATA/linux-hwe-5.19/kernel-wedge-arch.pl  | 26 -------------------
 helpers/make-linux-hwe-5.19                   | 10 ++++---
 3 files changed, 7 insertions(+), 31 deletions(-)
 delete mode 100755 helpers/DATA/linux-hwe-5.19/kernel-wedge-arch.pl

diff --git a/helpers/DATA/linux-hwe-5.19/d-i.patch b/helpers/DATA/linux-hwe-5.19/d-i.patch
index ec4defa1..ca1d04c7 100644
--- a/helpers/DATA/linux-hwe-5.19/d-i.patch
+++ b/helpers/DATA/linux-hwe-5.19/d-i.patch
@@ -40,7 +40,7 @@ index fe52711..b2d1921 100755
 +	export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \
 +	export KW_CONFIG_DIR=$(DEBIAN)/d-i && \
 +	LANG=C kernel-wedge gen-control $(release)-$(abinum) | \
-+		perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \
++		grep-dctrl -FArchitecture $(arch) \
 +		>>$(CURDIR)/debian/control
  
  debian/canonical-certs.pem: $(wildcard $(DROOT)/certs/*-all.pem) $(wildcard $(DROOT)/certs/*-$(arch).pem) $(wildcard $(DEBIAN)/certs/*-all.pem) $(wildcard $(DEBIAN)/certs/*-$(arch).pem)
diff --git a/helpers/DATA/linux-hwe-5.19/kernel-wedge-arch.pl b/helpers/DATA/linux-hwe-5.19/kernel-wedge-arch.pl
deleted file mode 100755
index 4b4fefe6..00000000
--- a/helpers/DATA/linux-hwe-5.19/kernel-wedge-arch.pl
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/perl
-#
-# kernel-wedge-arch.pl -- select only specifiers for the supplied arch.
-#
-use strict;
-
-require Dpkg::Control;
-require Dpkg::Deps;
-
-my $fh = \*STDIN;
-
-my @entries;
-
-my $wanted = $ARGV[0];
-
-my $entry;
-while (!eof($fh)) {
-	$entry = Dpkg::Control->new();
-	$entry->parse($fh, '???');
-
-	if ($entry->{'Architecture'} eq $wanted) {
-		print("\n" . $entry);
-	}
-}
-
-close($fh);
diff --git a/helpers/make-linux-hwe-5.19 b/helpers/make-linux-hwe-5.19
index 9794be7b..6b6b43a0 100644
--- a/helpers/make-linux-hwe-5.19
+++ b/helpers/make-linux-hwe-5.19
@@ -82,7 +82,6 @@ do
     cp -a $DATA/d-i $i
 done
 /bin/sed 's/\.ko//' -i debian.master/d-i/modules/*-modules
-cp $DATA/kernel-wedge-arch.pl debian/scripts/misc/
 
 cat << EOF >> debian/control
 Package: linux-hwe-$HWEKR-udebs-generic
@@ -133,9 +132,12 @@ done
 
 sed '/include.*2-binary-arch.mk/a\\n# Rules for building the udebs ($(DEBIAN)-installer)\ninclude $(DROOT)/rules.d/5-udebs.mk' -i debian/rules
 sed 's/+= binary-debs/+= binary-udebs/' -i debian/rules.d/2-binary-arch.mk
-sed '/Build-Depends:/a\ kernel-wedge <!stage1>,' -i 	debian/control \
-							debian.master/control.stub.in \
-							debian.hwe-$HWEKR/control.stub.in
+for i in dctrl-tools kernel-wedge
+do
+    sed "/Build-Depends:/a\ $i <\!stage1> <\!noudeb> <\!cross> <\!autopkgtest>," -i	debian/control \
+											debian.master/control.stub.in \
+											debian.hwe-$HWEKR/control.stub.in
+done
 
 # Wipe dkms-versions
 # lists zfs / v4l2loopback versions
-- 
GitLab


From 21d1af0de9e4f1bfad19be65c4f0806e2e552e7b Mon Sep 17 00:00:00 2001
From: Ark74 <ark@switnet.org>
Date: Thu, 29 Jun 2023 00:18:47 -0600
Subject: [PATCH 2/2] linux-hwe-5.19: remove misssing line

---
 helpers/make-linux-hwe-5.19 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/helpers/make-linux-hwe-5.19 b/helpers/make-linux-hwe-5.19
index 9e9086f4..7f499fad 100644
--- a/helpers/make-linux-hwe-5.19
+++ b/helpers/make-linux-hwe-5.19
@@ -78,7 +78,6 @@ done
 # Re-enable udebs
 cp $DATA/5-udebs.mk debian/rules.d
 cp -a $DATA/d-i debian.hwe-$HWEKR
-cp $DATA/kernel-wedge-arch.pl debian/scripts/misc/
 
 cat << EOF >> debian/control
 Package: linux-hwe-$HWEKR-udebs-generic
-- 
GitLab