From patchwork Mon Oct 30 21:06:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10033259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D05F46039A for ; Mon, 30 Oct 2017 21:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBA1228965 for ; Mon, 30 Oct 2017 21:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE69628968; Mon, 30 Oct 2017 21:06:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E85D828965 for ; Mon, 30 Oct 2017 21:06:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B3816E1F0; Mon, 30 Oct 2017 21:06:28 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yw0-x22e.google.com (mail-yw0-x22e.google.com [IPv6:2607:f8b0:4002:c05::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A2766E1F0 for ; Mon, 30 Oct 2017 21:06:27 +0000 (UTC) Received: by mail-yw0-x22e.google.com with SMTP id t71so12871438ywc.3 for ; Mon, 30 Oct 2017 14:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=E1jUjsGsAuSToSVHBGvAoD/6a8wfeub8AjfoST/ijaQ=; b=oU0k8w+UuW3nxh5oHPl82nAMYqyS3/3BWA+uXdTfjxbgIuJlhB/7P/A9Zbj6rtR+IX VdYW6fAW3I+L+k2YjzvHeNyyXLvXm5keQcAt4sxZr2ZXTQhNi8J+Edk0Taeey4JXT4Po 1iH5n4XrBQfoYGICNNXfJPsoITOkCn8SNs0V4= 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; bh=E1jUjsGsAuSToSVHBGvAoD/6a8wfeub8AjfoST/ijaQ=; b=R7WtD39Yx3xgFXo5UP5OfmBfxMkZ1yu3jYwMT47zloI8QCmlrZmiOFORgK5otFPiFU 6bNMF8m+1TvV109wVR/oavs/Kp9Cbzen8Tp5FctZbxRL6E1/yc8jQ7IqN5mdeTQH+k8S nT0/kHDmQYAdHvrewWVh5EPXIwgyGuD+r3YoUSLX5gsCPACYizfDzItXtxrNHw3/px08 Lyo7vZyvc4uCjwVn0DY5YtMOrjfY1pHaFT/182tjzI4d3K3qQLx10pF9noa0ny+/sqk9 fTmOTXAg/oWOlo6rofFJRUK5oeEih1iHUrBha1uhFfrKB+hXwYbIyEJDrXWW/4sz9E9Q JWQw== X-Gm-Message-State: AMCzsaURC1ueS9+coEHuFbujfU59ThZq442uXkIYwgfeVdHpSqFLHA3O kocab6jOLmp8bXlPX9H+OWE5t8U+3Ik= X-Google-Smtp-Source: ABhQp+TtfiIOcu2pQ3Ik6aN4jKoU3dEH7q8dvvlj8qAek0zI+84spSMA63OZJwTXlgqnoTVK7CQXrA== X-Received: by 10.129.168.131 with SMTP id f125mr6779820ywh.15.1509397586345; Mon, 30 Oct 2017 14:06:26 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:0:f685:3152:9ba1:429a]) by smtp.gmail.com with ESMTPSA id q7sm7801632ywh.41.2017.10.30.14.06.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 14:06:25 -0700 (PDT) From: Sean Paul To: daniel.vetter@intel.com, jani.nikula@linux.intel.com Date: Mon, 30 Oct 2017 17:06:25 -0400 Message-Id: <20171030210625.36897-1-seanpaul@chromium.org> X-Mailer: git-send-email 2.15.0.rc2.357.g7e34df9404-goog Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [maintainer-tools PATCH] dim: Sign commits in addition to tags X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Expanding on Jani's work to sign tags, this patch adds signing for git commit/am. Signed-off-by: Sean Paul --- This has been lightly tested with dim apply-branch/dim push-branch. Sean dim | 78 +++++++++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 27 deletions(-) diff --git a/dim b/dim index 527989aff9ad..cd5e41f89a3a 100755 --- a/dim +++ b/dim @@ -67,9 +67,6 @@ DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature} # dim pull-request tag summary template DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-$HOME/.dim.template.tagsummary} -# GPG key id for signing tags. If unset, don't sign. -DIM_GPG_KEYID=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID} - # # Internal configuration. # @@ -104,6 +101,20 @@ test_request_recipients=( # integration configuration integration_config=nightly.conf +# GPG key id for signing tags. If unset, don't sign. +function gpg_keyid_for_tag +{ + echo "${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}" + return 0 +} + +# GPG key id for committing (git commit/am). If unset, don't sign. +function gpg_keyid_for_commit +{ + echo "${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}" + return 0 +} + function read_integration_config { # clear everything first to allow configuration reload @@ -473,12 +484,14 @@ EOF # append all arguments as tags at the end of the commit message of HEAD function dim_commit_add_tag { + local gpg_keyid + gpg_keyid=$(gpg_keyid_for_commit) for arg; do # the first sed deletes all trailing blank lines at the end git log -1 --pretty=%B | \ sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' | \ sed "\$a${arg}" | \ - git commit --amend -F- + git commit $gpg_keyid --amend -F- done } @@ -604,7 +617,7 @@ function update_rerere_cache function commit_rerere_cache { - local remote file commit_message + local remote file commit_message gpg_keyid echo -n "Updating rerere cache... " @@ -640,7 +653,8 @@ function commit_rerere_cache $(git --version) EOF - if git commit -F $commit_message >& /dev/null; then + gpg_keyid=$(gpg_keyid_for_commit) + if git commit $gpg_keyid -F $commit_message >& /dev/null; then echo -n "New commit. " else echo -n "Nothing changed. " @@ -653,13 +667,14 @@ function commit_rerere_cache function dim_rebuild_tip { - local integration_branch specfile first rerere repo remote + local integration_branch specfile first rerere repo remote gpg_keyid integration_branch=drm-tip specfile=$(mktemp) first=1 rerere=$DIM_PREFIX/drm-rerere + gpg_keyid=$(gpg_keyid_for_commit) cd $rerere if git status --porcelain | grep -q -v "^[ ?][ ?]"; then @@ -731,7 +746,7 @@ function dim_rebuild_tip # because we filter out fast-forward merges there will # always be something to commit - git commit --no-edit --quiet + git commit $gpg_keyid --no-edit --quiet echo "Done." fi @@ -743,7 +758,7 @@ function dim_rebuild_tip echo -n "Adding integration manifest $integration_branch: $dim_timestamp... " mv $specfile integration-manifest git add integration-manifest - git commit --quiet -m "$integration_branch: $dim_timestamp integration manifest" + git commit $gpg_keyid --quiet -m "$integration_branch: $dim_timestamp integration manifest" echo "Done." remote=$(repo_to_remote drm-tip) @@ -848,7 +863,7 @@ function dim_push function apply_patch #patch_file { - local patch message_id committer_email patch_from sob rv + local patch message_id committer_email patch_from sob rv gpg_keyid patch="$1" shift @@ -860,7 +875,8 @@ function apply_patch #patch_file sob=-s fi - git am --scissors -3 $sob "$@" $patch + gpg_keyid=$(gpg_keyid_for_commit) + git am --scissors -3 $sob $gpg_keyid "$@" $patch if [ -n "$message_id" ]; then dim_commit_add_tag "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id" @@ -911,7 +927,7 @@ function dim_apply_branch function dim_apply_pull { - local branch file message_id pull_branch rv + local branch file message_id pull_branch rv gpg_keyid branch=${1:?$usage} file=$(mktemp) @@ -929,7 +945,8 @@ function dim_apply_pull message_id=$(message_get_id $file) - git commit --amend -s --no-edit + gpg_keyid=$(gpg_keyid_for_commit) + git commit $gpg_keyid --amend -s --no-edit if [ -n "$message_id" ]; then dim_commit_add_tag "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id" else @@ -945,7 +962,7 @@ function dim_apply_pull function dim_backmerge { - local branch upstream patch_file + local branch upstream patch_file gpg_keyid branch=${1:?$usage} upstream=${2:?$usage} @@ -990,8 +1007,9 @@ function dim_backmerge echoerr " git commit -a" fi + gpg_keyid=$(gpg_keyid_for_commit) git add -u - git commit -s + git commit $gpg_keyid -s } function dim_add_link @@ -1227,7 +1245,7 @@ function dim_magic_patch function dim_create_branch { - local branch repo remote + local branch repo remote gpg_keyid branch=${1:?$usage} start=${2:-HEAD} @@ -1250,13 +1268,14 @@ function dim_create_branch cd $DIM_PREFIX/drm-rerere $DRY sed -i "s/^\() # DO NOT CHANGE THIS LINE\)$/\t\"$repo\t\t${branch//\//\\\/}\"\n\1/" $integration_config + gpg_keyid=$(gpg_keyid_for_commit) $DRY git add $integration_config - $DRY git commit --quiet -m "Add $repo $branch to $integration_config" + $DRY git commit $gpg_keyid --quiet -m "Add $repo $branch to $integration_config" } function dim_remove_branch { - local branch repo remote + local branch repo remote gpg_keyid branch=${1:?$usage} @@ -1288,8 +1307,9 @@ function dim_remove_branch cd $DIM_PREFIX/drm-rerere $DRY sed -i "/^[[:space:]]*\"${repo}[[:space:]]\+${branch//\//\\\/}.*$/d" $integration_config + gpg_keyid=$(gpg_keyid_for_commit) $DRY git add $integration_config - $DRY git commit --quiet -m "Remove $repo $branch from $integration_config" + $DRY git commit $gpg_keyid --quiet -m "Remove $repo $branch from $integration_config" dim_rebuild_tip } @@ -1579,7 +1599,7 @@ function dim_for_each_workdir function dim_update_next { - local remote + local remote gpg_keyid assert_branch drm-intel-next-queued @@ -1597,12 +1617,13 @@ function dim_update_next exit 2 fi + gpg_keyid=$(gpg_keyid_for_commit) driver_date=$(date +%Y%m%d) driver_timestamp=$(date +%s) $DRY sed -i -e "s/^#define DRIVER_DATE.*\"[0-9]*\"$/#define DRIVER_DATE\t\t\"$driver_date\"/; s/^#define DRIVER_TIMESTAMP.*/#define DRIVER_TIMESTAMP\t$driver_timestamp/" \ drivers/gpu/drm/i915/i915_drv.h $DRY git add drivers/gpu/drm/i915/i915_drv.h - git commit $DRY_RUN -sm "drm/i915: Update DRIVER_DATE to $driver_date" + git commit $DRY_RUN $gpg_keyid -sm "drm/i915: Update DRIVER_DATE to $driver_date" gitk drm-intel-next-queued ^$(repo_to_remote drm-upstream)/drm-next & @@ -1614,7 +1635,7 @@ function dim_update_next function dim_update_next_continue { - local remote intel_remote req_file suffix tag tag_testing + local remote intel_remote req_file suffix tag tag_testing gpg_keyid assert_branch drm-intel-next-queued @@ -1630,7 +1651,8 @@ function dim_update_next_continue tag_testing="drm-intel-testing-$dim_today-$((++suffix))" done - $DRY git tag -a $DIM_GPG_KEYID $tag $intel_remote/drm-intel-next + gpg_keyid=$(gpg_keyid_for_tag) + $DRY git tag -a $gpg_keyid $tag $intel_remote/drm-intel-next git push $DRY_RUN $intel_remote $tag echo "Updating drm-intel-testing to latest drm-tip" @@ -1655,7 +1677,7 @@ function dim_update_next_continue function dim_tag_next { - local intel_remote tag suffix + local intel_remote tag suffix gpg_keyid cd $DIM_PREFIX/$DIM_REPO @@ -1670,7 +1692,8 @@ function dim_tag_next tag="drm-intel-next-$dim_today-$((++suffix))" done - $DRY git tag -a $DIM_GPG_KEYID $tag $intel_remote/drm-intel-next + gpg_keyid=$(gpg_keyid_for_tag) + $DRY git tag -a $gpg_keyid $tag $intel_remote/drm-intel-next git push $DRY_RUN $intel_remote $tag else echo "drm-intel-next not up-to-date, aborting" @@ -1700,7 +1723,7 @@ function prep_pull_tag_summary # dim_pull_request branch upstream function dim_pull_request { - local branch upstream remote repo req_file url_list git_url suffix tag + local branch upstream remote repo req_file url_list git_url suffix tag gpg_keyid branch=${1:?$usage} upstream=${2:?$usage} @@ -1731,7 +1754,8 @@ function dim_pull_request done gitk "$branch@{upstream}" ^$upstream & prep_pull_tag_summary | $DRY git tag -F- $tag "$branch@{upstream}" - $DRY git tag -a $DIM_GPG_KEYID -f $tag + gpg_keyid=$(gpg_keyid_for_tag) + $DRY git tag -a $gpg_keyid -f $tag $DRY git push $remote $tag prep_pull_mail $req_file $tag