From patchwork Mon Apr 3 19:42:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9660461 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 184B96032D for ; Mon, 3 Apr 2017 19:43:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 085EA284D9 for ; Mon, 3 Apr 2017 19:43:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F14D1284EE; Mon, 3 Apr 2017 19:43:07 +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 C961F284EC for ; Mon, 3 Apr 2017 19:43:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 56A7A6E3F7; Mon, 3 Apr 2017 19:43:05 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qt0-x22a.google.com (mail-qt0-x22a.google.com [IPv6:2607:f8b0:400d:c0d::22a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D8FA6E3F7 for ; Mon, 3 Apr 2017 19:43:03 +0000 (UTC) Received: by mail-qt0-x22a.google.com with SMTP id n21so121902437qta.1 for ; Mon, 03 Apr 2017 12:43:03 -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=GSj6ltA3ZZxUU9UPbiuQNqzGJ/jWhbI3w9JquOJj4jg=; b=jb8mPdjkF1EazGxabJsBau5cEugF+XqvMX1DMfBjBePOCkQHYWFw32Zw7ieD0IGO9i cgPwRUBzNIhj5m06mkXW/LyJMXDN2nchIQByjJmWNLbthxj7ENJJD+DbF0fULh7+zEjn bPVOHXLXsfLNObY9mn2iy/kdvFh7bj7RI9WcU= 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=GSj6ltA3ZZxUU9UPbiuQNqzGJ/jWhbI3w9JquOJj4jg=; b=hVK0xjAgF/L9QWoC52Pl1JvgFXzCJqd1AXIKhr/ImlhW4QIbubgps0p6yYkBKLyKnK D6sO5hmjiAY3xOc3MYZYe7BOUl+t9ZklPfpUQmO0NpD8hxxuhLLr7BxAH0gcqub02aWI ySwUOFt9o5+PoPgOP89AZJA5tvgY3cKY0ZVjB39ooW4SgrZSPG5Cd8EyKyzlO9Vauy9W W1PRPgTUlgXY2HcC7h79V5pniUMSeMdbAOA56xdOML4hwKx6ajq5pHm+LduG2mqzlNTI DmglNJJiU1hu1whLoZ/o5UllKwU1Ti/PhzXuEmR6raTEyiPboajMPdjtNlbuokgv1VmS qgAg== X-Gm-Message-State: AFeK/H0vFDdvjK7MEG4hdfvPLfQdpHI1F//tPe26UHkv9qwhnz5S1V8C6qVc+NVOG8KT7iCq X-Received: by 10.200.3.214 with SMTP id z22mr20462608qtg.3.1491248582491; Mon, 03 Apr 2017 12:43:02 -0700 (PDT) Received: from boxwood.roam.corp.google.com (cpe-75-189-128-87.nc.res.rr.com. [75.189.128.87]) by smtp.gmail.com with ESMTPSA id b126sm10213141qka.26.2017.04.03.12.43.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Apr 2017 12:43:01 -0700 (PDT) From: Sean Paul To: intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com Date: Mon, 3 Apr 2017 15:42:50 -0400 Message-Id: <20170403194300.9891-1-seanpaul@chromium.org> X-Mailer: git-send-email 2.12.2.564.g063fe858b8-goog Cc: daniel.vetter@intel.com Subject: [Intel-gfx] [maintainer-tools PATCH v2] dim: Use mktemp for pull-request mails 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 Instead of hardcoding ~/tmp in dim (and failing when it doesn't exist), use mktemp to create the pull-request mail file. Signed-off-by: Sean Paul --- dim | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/dim b/dim index 8357d4f..d51be6b 100755 --- a/dim +++ b/dim @@ -1278,9 +1278,12 @@ function prep_pull_mail_overview # $@: tags, if any, to extract into the pull request overview function prep_pull_mail { - prep_pull_mail_greetings > ~/tmp/dim-pull-request - prep_pull_mail_overview "$@" >> ~/tmp/dim-pull-request - prep_pull_mail_signature >> ~/tmp/dim-pull-request + local file + file=$1 + shift + prep_pull_mail_greetings > $file + prep_pull_mail_overview "$@" >> $file + prep_pull_mail_signature >> $file } function dim_create_workdir @@ -1368,7 +1371,7 @@ function dim_update_next function dim_update_next_continue { - local remote suffix tag tag_testing + local remote req_file suffix tag tag_testing assert_branch drm-intel-next-queued @@ -1391,17 +1394,18 @@ function dim_update_next_continue $DRY git tag $tag_testing $DIM_DRM_INTEL_REMOTE/drm-intel-testing $DRY git push $DIM_DRM_INTEL_REMOTE $tag_testing - cat > ~/tmp/test-request <<-HERE + req_file=$(mktemp) + cat > $req_file <<-HERE Hi all, HERE obj=$(git rev-parse $tag) if [[ "$(git cat-file -t $obj)" == "tag" ]] ; then - git cat-file -p $obj | tail -n+6 >> ~/tmp/test-request + git cat-file -p $obj | tail -n+6 >> $req_file else - echo "" >> ~/tmp/test-request + echo "" >> $req_file fi - cat >> ~/tmp/test-request <<-HERE + cat >> $req_file <<-HERE Happy testing! @@ -1409,7 +1413,7 @@ function dim_update_next_continue HERE $DRY $DIM_MUA -s "Updated drm-intel-testing" \ - -i ~/tmp/test-request \ + -i $req_file \ -c "$addr_intel_gfx" \ -c "$addr_intel_gfx_maintainer1" \ -c "$addr_intel_gfx_maintainer2" \ @@ -1443,11 +1447,12 @@ function dim_tag_next # dim_pull_request branch upstream function dim_pull_request { - local branch upstream remote repo url git_url suffix tag + local branch upstream remote repo req_file url git_url suffix tag branch=${1:?$usage} upstream=${2:?$usage} remote=$(branch_to_remote $branch) + req_file=$(mktemp) if [ "$branch" != "drm-intel-next" ]; then assert_branch $branch @@ -1461,7 +1466,7 @@ function dim_pull_request if [ "$branch" = "drm-intel-next" ]; then # drm-intel-next pulls have been tagged using dim update-next drm_intel_next_tags=$(git log "$branch@{upstream}" ^$upstream --decorate | grep "(.*tag: drm-intel-next-" | sed -e "s/^.*(.*tag: \(drm-intel-next-[^ ,]*\).*)$/\1/") - prep_pull_mail $drm_intel_next_tags + prep_pull_mail $req_file $drm_intel_next_tags tag=$(git describe --all --exact "$branch@{upstream}") repo="drm-intel" @@ -1475,7 +1480,7 @@ function dim_pull_request gitk "$branch@{upstream}" ^$upstream & $DRY git tag -a $tag "$branch@{upstream}" $DRY git push $remote $tag - prep_pull_mail $tag + prep_pull_mail $req_file $tag repo=$(branch_to_repo $branch) fi @@ -1483,9 +1488,9 @@ function dim_pull_request url=${drm_tip_repos[$repo]} git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/') - git request-pull $upstream $git_url $tag >> ~/tmp/dim-pull-request + git request-pull $upstream $git_url $tag >> $req_file $DRY $DIM_MUA -s "[PULL] $branch" \ - -i ~/tmp/dim-pull-request \ + -i $req_file \ -c "$addr_intel_gfx" \ -c "$addr_dri_devel" \ -c "$addr_intel_gfx_maintainer1" \