[Intel-gfx] [PATCH] dim: Use mktemp for pull-request mails
Sean Paul
seanpaul at chromium.org
Fri Mar 31 15:27:48 UTC 2017
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 <seanpaul at chromium.org>
---
dim | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/dim b/dim
index 8357d4f..8b61fd8 100755
--- a/dim
+++ b/dim
@@ -1278,9 +1278,11 @@ 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
+ file=$1
+ shift
+ prep_pull_mail_greetings > $file
+ prep_pull_mail_overview "$@" >> $file
+ prep_pull_mail_signature >> $file
}
function dim_create_workdir
@@ -1391,17 +1393,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 "<tag doesn't contain a changelog overview, fix this>" >> ~/tmp/test-request
+ echo "<tag doesn't contain a changelog overview, fix this>" >> $req_file
fi
- cat >> ~/tmp/test-request <<-HERE
+ cat >> $req_file <<-HERE
Happy testing!
@@ -1409,7 +1412,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" \
@@ -1448,6 +1451,7 @@ function dim_pull_request
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 +1465,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 +1479,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 +1487,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" \
--
2.12.2.564.g063fe858b8-goog
More information about the Intel-gfx
mailing list