All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Sean Paul <seanpaul@chromium.org>, intel-gfx@lists.freedesktop.org
Cc: daniel.vetter@intel.com
Subject: Re: [PATCH] dim: Use mktemp for pull-request mails
Date: Mon, 03 Apr 2017 20:10:33 +0300	[thread overview]
Message-ID: <87efx9pgc6.fsf@intel.com> (raw)
In-Reply-To: <20170331152754.33695-1-seanpaul@chromium.org>

On Fri, 31 Mar 2017, Sean Paul <seanpaul@chromium.org> wrote:
> Instead of hardcoding ~/tmp in dim (and failing when it doesn't
> exist), use mktemp to create the pull-request mail file.

A few nitpicks below, otherwise lgtm.

BR,
Jani.


>
> Signed-off-by: Sean Paul <seanpaul@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
>  {

Please add "local file" here.

> -	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)

Please add "local req_file" at the top of the function.

> +	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)

Please add "local req_file" at the top of the function.

>  
>  	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" \

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2017-04-03 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 15:27 [PATCH] dim: Use mktemp for pull-request mails Sean Paul
2017-04-03 17:10 ` Jani Nikula [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efx9pgc6.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.