From patchwork Thu Jun 6 19:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Wager X-Patchwork-Id: 1944776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VwFSV3Xt2z20Q6 for ; Fri, 7 Jun 2024 05:55:53 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sFJD5-0002ms-BV; Thu, 06 Jun 2024 19:55:43 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sFJD3-0002mf-TS for kernel-team@lists.ubuntu.com; Thu, 06 Jun 2024 19:55:41 +0000 Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B1FCA3F1A3 for ; Thu, 6 Jun 2024 19:55:41 +0000 (UTC) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-6fc395e8808so1215120b3a.0 for ; Thu, 06 Jun 2024 12:55:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717703740; x=1718308540; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e4hHDbdUNrYvB69MU7iDYdsg7LlPn9l0g8I1NKJ+pqE=; b=kBaeHaFl/Pd8xsyS0Jy+jHMdBvIOuIEgQ/3dt3iYasnbdPDYqMfoMyAa3S9UeEsPeq W2D3vQeA05vUVwHXvOjgILJrGE/nAfWDqFm6dhoi4i6MiEdS1XhHofCBMwhks2NAVjZy B4VnhUorLKduI728BST4csgnbsUbPA3xDpAbbdffvMdLGSR10OP4JFOgkHA5e6bHUuUi 409uHH6dDUXfL2+RpZhe0FQOv0aRD8kZfDmPyBUeUWlf+kBR9ShJU77nOtWtQ+tZ5voS kI0h+Gq8/OZOrr0xebz7E86sJPjmtBK56GaLrbQOHWMUngd3FGsdn0GIVJ3kheSY+yYg CXVA== X-Gm-Message-State: AOJu0YwHtempKBvfoyZn+Bo8V51D4xInzecN1tSjZf6x7CLxyk1FA9o8 QdNjEnO9yAsHpRCZ2Trro68Yl1v8TgZNcpcl1LaaEWhLzPsq/bEOhtGpDuSpdvaMgIRz+TDQy/1 xQYgFl8c/dSNHin9jVrPL01itIC9HumOHN7X1F4dpvmdgr7cKfQo1RMaWNKjCv5w/LbzQiXaNvY YUqVPAOOOJig== X-Received: by 2002:a05:6a00:2d1c:b0:702:2749:608a with SMTP id d2e1a72fcca58-7040c4a9a7cmr611409b3a.0.1717703739898; Thu, 06 Jun 2024 12:55:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5lFdtCDTgXqaQH6b6FgYZgL/9BaKdgVXF+KX76lR8vDfocciZp2KJ0dnlqS4pkV0IoPWVaA== X-Received: by 2002:a05:6a00:2d1c:b0:702:2749:608a with SMTP id d2e1a72fcca58-7040c4a9a7cmr611394b3a.0.1717703739506; Thu, 06 Jun 2024 12:55:39 -0700 (PDT) Received: from localhost ([2604:4080:11ea:8070:168f:ccb1:8c4d:7333]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-703fd37279csm1447880b3a.39.2024.06.06.12.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 12:55:38 -0700 (PDT) From: Noah Wager To: kernel-team@lists.ubuntu.com Subject: [Unstable][PATCH] UBUNTU: [Packaging] dkms-build: Support DEB822 sources Date: Thu, 6 Jun 2024 12:54:09 -0700 Message-ID: <20240606195513.75538-1-noah.wager@canonical.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" When going through pools to download the DKMS debs, support both one-line (*.list) and DEB822 (*.sources) formats when parsing source lists. Signed-off-by: Noah Wager --- debian/scripts/dkms-build | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/debian/scripts/dkms-build b/debian/scripts/dkms-build index de97466d587a..8e9adc56f03d 100755 --- a/debian/scripts/dkms-build +++ b/debian/scripts/dkms-build @@ -60,8 +60,18 @@ do break fi + # Get pools from *.list files. + slist_files="/etc/apt/sources.list $( find /etc/apt/sources.list.d/ -type f -name "*.list" | xargs )" + slist_pools=$( grep -h '^deb ' $slist_files | awk '{print $2}' ) + + # Get pools from *.sources (deb822-style) files. + deb822_files=$( find /etc/apt/sources.list.d/ -type f -name "*.sources" | xargs ) + # Split stanzas on empty lines and only select deb pools, then get the URIs. + # Since RS != \n, regex is not line-by-line so the newline matching is more explicit. + deb822_pools=$( awk -v RS= '/(^|\n)Types:[^\n]* deb($|\s)/' $deb822_files | sed -n 's/^URIs: //p' ) + # Download from the available pools. - for pool in $( grep -h '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | awk '{print $2}' | sort -u ) + for pool in $( echo $slist_pools $deb822_pools | xargs -n1 | sort -u ) do if package_present "$lpackage"; then break