From patchwork Wed Jul 21 22:13:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1508477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) 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=MoMGdPXI; dkim-atps=neutral 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 4GVVGk3ktXz9sX5; Thu, 22 Jul 2021 08:13:49 +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 1m6KTH-0007Iu-Sk; Wed, 21 Jul 2021 22:13:43 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1m6KTG-0007IY-8J for kernel-team@lists.ubuntu.com; Wed, 21 Jul 2021 22:13:42 +0000 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (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-canonical-1.canonical.com (Postfix) with ESMTPS id 1C8B63F328 for ; Wed, 21 Jul 2021 22:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1626905622; bh=n65g05Dbp7p1yQGRsFc14+50z2nhMsGFGOypHdte6VU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MoMGdPXIft+4Ny9uQQL3WdgGoR+1n779mgZTnZbefSx/dxHrmZHPi3BKaL6mpqLBz 3QH3GkcJ3Z5TPELlsiyCQ2RiMAS2rsCIa3bs3lVZdFnsNXrxWdqwbNpn73KVBO62yC wYYC3jIOx71/rw+NSSVfD+bdc+LWbHvXVXhWBJadTjJcfzEivi07ViU5eL1flvbQnb DbXw2h7a75PQtg0/ts+vLDRMqf3GkieZ/J7EcLSm9Dz9FG3R80Sxqx5Su+Me7tg3Wm jF8b5o8IyWAGUUgq2nzwMiB9coVukAjE6HF5p4/NkWIbk3hloFRkG9FQFmBFs+PbZQ PbAxlF6n1bPfA== Received: by mail-wm1-f71.google.com with SMTP id y5-20020a1c4b050000b02901d849b41038so251067wma.7 for ; Wed, 21 Jul 2021 15:13:42 -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=n65g05Dbp7p1yQGRsFc14+50z2nhMsGFGOypHdte6VU=; b=CEOVV6k5DPqVR9+ilUDFAAWhd1Nz9Oj8xL+T/iiOzeNmEJymaw/YVP9WYJAY3NpnjF 7X0eLjZ1ZqH1jbL0/v3KhnKX6H4XKelFiNV3m6yYA/VN8tMVOX6VbQyVi051tfjlwV94 q1H2GzSxbOFuBb7eUujIWGIsN1wwn/wzNR+eiIXK4GBI/S8m7qmhlOW7Z/0O2OYz80Gg K66Scvq9I2AUY+bPG7fNQmW9UnX0A1k9dSbVspC1C4vq1ykiZWB/eSoCTZ394UYu7eIh bYMVae158u+lAlMGff6k6OUSwQ+KUrSpl3lVr4wCzVZ5WPZNeCtwm2GnwQOW4QzSRvT3 Khrg== X-Gm-Message-State: AOAM531qvxrm4WfpfBZJIWI3MK0PHJ6pPV8LXaYV0syjlXQDmLj1lryY XnyyTDXpnGtU6lyckcfEa9QIsomxMk9/FueA0+DSjJLO0SVpj61zfY6Y/+73iQwjyZPGif3mO2F V/jWvXLlKHkVrW8c06MG+3+Lw6s+Ry1ozT5SkYBTNZg== X-Received: by 2002:a7b:cd15:: with SMTP id f21mr40422120wmj.148.1626905621577; Wed, 21 Jul 2021 15:13:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYKIP7HYUlfWjEnuc9/c29d9qf5zjFZLFa2DIlrsH9DblKnIT44iclhMIFS5AIWCspvKgA7g== X-Received: by 2002:a7b:cd15:: with SMTP id f21mr40422103wmj.148.1626905621341; Wed, 21 Jul 2021 15:13:41 -0700 (PDT) Received: from localhost ([2001:470:6973:2:4cac:2286:3b31:9ac5]) by smtp.gmail.com with ESMTPSA id l23sm13839983wme.22.2021.07.21.15.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 15:13:40 -0700 (PDT) From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/4] UBUNTU: [Packaging] update-dkms-versions -- update from kernel-versions Date: Wed, 21 Jul 2021 23:13:35 +0100 Message-Id: <20210721221338.159114-2-apw@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210721221338.159114-1-apw@canonical.com> References: <20210721221338.159114-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" Update our internal debian/dkms-versions files from the common kernel-versions dataset. BugLink: https://bugs.launchpad.net/bugs/1928921 Signed-off-by: Andy Whitcroft --- update-dkms-versions | 150 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100755 update-dkms-versions diff --git a/update-dkms-versions b/update-dkms-versions new file mode 100755 index 0000000..ea807a6 --- /dev/null +++ b/update-dkms-versions @@ -0,0 +1,150 @@ +#!/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]*$//') + + #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 + +kv_repo="$HOME/.kernel-versions" +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 --initial-branch master + 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 + echo "$sru_cycle: cycle not found in $remote_repo" 2>&1 + exit 1 +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)" -s -- "$thing" +else + echo "$thing: no changes from kernel-versions" +fi + +exit "$rc"