From patchwork Wed Sep 1 12:51:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1523144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=SLZHD9tc; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H03qF23Msz9vJZ; Wed, 1 Sep 2021 22:52:09 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mLPif-0002q3-2Z; Wed, 01 Sep 2021 12:51:57 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mLPiW-0002pB-Pd for kernel-team@lists.ubuntu.com; Wed, 01 Sep 2021 12:51:48 +0000 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (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 A231B4018C for ; Wed, 1 Sep 2021 12:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1630500708; bh=dr9QRGeHgTO321YPastHJZXWybDLfGQKTgD8zqr8ANc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SLZHD9tc/6sbN36mOJqTTn+eLNr/RY8MY/JjEg3FXpphECwgnmPkZezMuZtuZg3Ab 52zaeCfXnwauSDxAX1enE1LHd7PA8gIN4m7FX6ffZh43yxqTpObz0MoIH87fxLP1zY GW3b3IWU2/ghoCY+1VZl1nkl8Qc7bEeTvIrteYCPKDY9Ekxmzbm+KpzVtPKPnVDXek z4RlUYIsunbvE+0/i8lAm/gdOW7KBmsTWQdmABuoKOzAz8j3+Hsl9RU2VwcfGq+ANf 9p2eARuSO+2gi0jCC5p6JvP2U7iSQaB/9o/DVeMimZ+KmmmCT+2coUzvgcJ+Gsh5eC NjTKzymeWyS4g== Received: by mail-wm1-f69.google.com with SMTP id j145-20020a1c2397000000b002ea321114f7so957479wmj.7 for ; Wed, 01 Sep 2021 05:51:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dr9QRGeHgTO321YPastHJZXWybDLfGQKTgD8zqr8ANc=; b=Sphbh5W7RfMHnZ1aKIPQvFpKwa85CIQCqFVRerj5pTN8JcATE9m9qINoAJ8JuHT+uR Id9MMRER4g1bAdPeYL3m/4rlxnds/NzQDgjtzg2SUaOYvg3IdI34y4Q8YCw06nq5VjGq IHj4lSP/OtTcLaD8LFjD7IjsHKB1jPfD6RSR38M67FwCZ5mxncVut6PdZuMXIjsSGu+F Z+kGb9i/+e2oj9X0S9W5bK/WFk/oh5bCNY9jChFV4pPGL18n8PU1MgXowsS8PjH5rvH5 p7Ff0NUf27IyqxjbgVNBVjRVDfkoX8szx9xUDHH3ifCIYEhLJGjhk3m7I9pRfNHUxp7h Aeig== X-Gm-Message-State: AOAM531au9RHEN8jAwD2Q4Wd+r1sVMs/JAneEs9iaVolOGbjZlThv+xF MISBNqODmCMMuUo0w9nhjoIZzSZXwAWXidzRnauKWNDfC4RpmWae1VkEoRb6H0kGntczGRB02wL UhzXr/7Zgbo5yidTpT8JNZB3ShfsupmzZNp3zJylstw== X-Received: by 2002:adf:d193:: with SMTP id v19mr19775161wrc.377.1630500707882; Wed, 01 Sep 2021 05:51:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3fYCSacj3vENEKi2QcT2vWD2Mpk067ANby250+oEKtzbuGM5yyzK/eAW7DFG6q8tcd6Okkg== X-Received: by 2002:adf:d193:: with SMTP id v19mr19775137wrc.377.1630500707464; Wed, 01 Sep 2021 05:51:47 -0700 (PDT) Received: from localhost ([2001:470:6973:2:efa8:c9bf:6f0b:bc99]) by smtp.gmail.com with ESMTPSA id n14sm20849760wrx.10.2021.09.01.05.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Sep 2021 05:51:47 -0700 (PDT) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [hirsute/master-next 1/1] UBUNTU: [Packaging] switch to kernel-versions Date: Wed, 1 Sep 2021 13:51:44 +0100 Message-Id: <20210901125144.1539387-2-apw@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901125144.1539387-1-apw@canonical.com> References: <20210901125144.1539387-1-apw@canonical.com> 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: , Cc: Andy Whitcroft Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1928921 Signed-off-by: Andy Whitcroft Acked-by: Stefan Bader Acked-by: Kleber Sacilotto de Souza --- update-dkms-versions | 162 +++++++++++++++++++++++++++++++++++++++++++ update-version-dkms | 58 +--------------- 2 files changed, 164 insertions(+), 56 deletions(-) create mode 100755 update-dkms-versions diff --git a/update-dkms-versions b/update-dkms-versions new file mode 100755 index 000000000000..11d9db31cd4d --- /dev/null +++ b/update-dkms-versions @@ -0,0 +1,162 @@ +#!/bin/bash + +remote_repo='' +sru_cycle= +while : +do + if [ "$1" = "--remote-repo" ]; then + remote_repo="$2" + shift 2 + + elif [ "$1" = "--sru-cycle" ]; then + sru_cycle="$2" + shift 2 + + else + break + fi +done +if [ "$#" -ne 0 ]; then + { + echo "Usage: $0 []" + echo " --remote-repo " + echo " --sru-cycle " + } 1>&2 + exit 1 +fi + +default_sru_cycle() +{ + local tracking_bug + local version + + # Pick out the cycle from the tracking bug file. + if [ -f "$DEBIAN/tracking-bug" ]; then + read tracking_bug sru_cycle X <"$DEBIAN/tracking-bug" + fi + + if [ -z "$sru_cycle" ]; then + echo "$0: sru-cycle not found via debian/tracking-bug; specify --sru-cycle" 1>&2 + exit 1 + fi + + sru_cycle=$(echo "$sru_cycle" | sed -e 's/-[0-9][0-9]*$//' -e 's/^kernel-sru-cycle-//') + + #echo "default_sru_cycle: version<$version> sru_cycle<$sru_cycle>" +} + +# Determine where our changelog is. +DEBIAN=debian +[ -f 'debian/debian.env' ] && . 'debian/debian.env' + +[ -z "$sru_cycle" ] && default_sru_cycle +if [ -z "$remote_repo" ]; then + case "$sru_cycle" in + s[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]) + remote_repo='security' ;; + *) + remote_repo='main' ;; + esac +fi +case "$remote_repo" in +security) + remote_repo='ssh+git://git.launchpad.net/~canonical-kernel-security-team/canonical-kernel-private/+git/kernel-versions' + remote_name='security' + ;; +main) + remote_repo='git://git.launchpad.net/~canonical-kernel/+git/kernel-versions' + remote_name='main' + ;; +*) + remote_name='adhoc' + ;; +esac + +# +# kernel-versoins repository dkms-version mapping see below for details: +# https://git.launchpad.net/~canonical-kernel/+git/kernel-versions/plain/README +# +kv_repo="$HOME/.cache/kernel-versions-bare" +git_base="$remote_name/$sru_cycle" + +# Now we know where our repo is and what it called update it. +# We maintain "persistent" remotes for main and security, but assume +# any manually supplied entries are transient. +( + [ ! -d "$kv_repo" ] && mkdir -p "$kv_repo" + cd "$kv_repo" || exit 1 + [ ! -f config ] && git init -q --bare + current_url=$(git config "remote.$remote_name.url") + if [ -z "$current_url" ]; then + git remote add "$remote_name" "$remote_repo" + elif [ "$current_url" != "$remote_repo" ]; then + git config "remote.$remote_name.url" "$remote_repo" + fi + git fetch -q -p "$remote_name" +) || exit 1 + +cat_file() +{ + (cd "$kv_repo" && git cat-file "$@") || exit 1 +} + +# Determine if we have this cycle. +present=$(cat_file -t "$git_base" 2>/dev/null) +if [ "$present" = "" ]; then + # If we don't have the cycle in the development cycle then + # fall back to master. + case "$sru_cycle" in + d*) git_base="$remote_name/master" ;; + *) echo "$sru_cycle: cycle not found in $remote_repo" 2>&1 + exit 1 + ;; + esac +fi + +# Determine our series and mainline version from our own changelog. +our_series=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -SDistribution) +if [ "$series" = "UNRELEASED" ]; then + our_series=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -c1 -SDistribution) +fi +our_mainline=$(LC_ALL=C dpkg-parsechangelog -l"$DEBIAN/changelog" -SVersion | sed -e 's/-.*//') + +# Update rules are complex. We update development series kernels to the +# versions in development. For stable series we update versions against +# the series in which our prime kernel was built. This is expressed +# via the map/dkms-versions namespace. Attempt to map via our series +# and then our mainline-version. + +# Attempt to map via our series, if that works assume we are development. +versions_path=$(cat_file -p "$git_base:map/dkms-versions/$our_series" 2>/dev/null) + +# If we do not yet have a mapping re-map using our mainline version. +if [ -z "$versions_path" ]; then + versions_path=$(cat_file -p "$git_base:map/dkms-versions/$our_mainline") +fi + +echo "git_base<$git_base> versions_path<$versions_path>" +echo "II: grabbing dkms-versions from $sru_cycle $versions_path" + +cat_file -p "$git_base:$versions_path" >"debian/dkms-versions.new" +rc="$?" +if [ "$rc" -ne 0 ]; then + echo "$0: unable to download an updated dkms-versions file" 1>&2 + exit 1 + +elif [ "$rc" -eq 0 ]; then + mv "debian/dkms-versions.new" "debian/dkms-versions" + +else + rm -f "debian/dkms-versions.new" +fi + +thing="debian/dkms-versions" +if ! git diff --exit-code -- "$thing" >/dev/null; then + git commit -m "UBUNTU: $thing -- update from kernel-versions ($git_base)" \ + -m "BugLink: https://bugs.launchpad.net/bugs/1786013" \ + -s -- "$thing" +else + echo "$thing: no changes from kernel-versions" +fi + +exit "$rc" diff --git a/update-version-dkms b/update-version-dkms index d90ce2c85f65..a266fecc06f8 100755 --- a/update-version-dkms +++ b/update-version-dkms @@ -1,58 +1,4 @@ #!/bin/bash -if [ "$#" -ne 1 ]; then - echo "Usage: $0 " 1>&2 - exit 1 -fi -pocket="$1" - -case "$pocket" in -proposed) pocket_list="-$pocket -updates -release" ;; -updates|security) pocket_list="-$pocket -release" ;; -release) pocket_list="-release" ;; -*) - echo "$0: $pocket: unknown archive pocket" 1>&2 - exit 1 - ;; -esac - -# find our changelog. -debian=$(awk -F= '($1 == "DEBIAN") { print $2 }' "debian/dkms-versions.new" -while read package version remainder -do - for pocket_raw in $pocket_list - do - pocket="${pocket_raw#-release}" - read x x pocket_version x <&2 - exit 1 - else - echo "$package: $pocket_version found in $pocket_raw" - fi - if [ "$version" != "$pocket_version" ]; then - echo "$package: updated to $pocket_version" - fi - echo "$package $pocket_version $remainder" | sed -e 's/ *$//' >>"debian/dkms-versions.new" -done <"debian/dkms-versions" -if ! cmp -s "debian/dkms-versions.new" "debian/dkms-versions"; then - mv -f "debian/dkms-versions.new" "debian/dkms-versions" - git commit -s -m "UBUNTU: update dkms package versions" \ - -m "BugLink: https://bugs.launchpad.net/bugs/1786013" \ - "debian/dkms-versions" -else - rm -f "debian/dkms-versions.new" -fi +echo "EE: run update-dkms-versions after link-to-tracker" 1>&2 +exit 1