Re: [maintainer-tools PATCH 6/6] dim: add command to check for dim updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 11, 2016 at 04:07:30PM +0300, Jani Nikula wrote:
> On Tue, 11 Oct 2016, Daniel Vetter <daniel@xxxxxxxx> wrote:
> > On Tue, Oct 11, 2016 at 11:47:32AM +0300, Jani Nikula wrote:
> >> Add a command to check if the user is running an up-to-date version of
> >> dim.
> >> 
> >> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> >> ---
> >>  dim     | 21 +++++++++++++++++++++
> >>  dim.rst |  4 ++++
> >>  2 files changed, 25 insertions(+)
> >> 
> >> diff --git a/dim b/dim
> >> index bef7bb6c401b..5fb3a0fee7ff 100755
> >> --- a/dim
> >> +++ b/dim
> >> @@ -179,6 +179,27 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us
> >>  		xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'`
> >>  fi
> >>  
> >> +function dim_uptodate
> >> +{
> >> +	local using="${BASH_SOURCE[0]}"
> >> +
> >> +	if [[ ! -e "$using" ]]; then
> >> +		echo "$dim: could not figure out the version being used ($using)." >&2
> >> +		exit 1
> >> +	fi
> >> +
> >> +	if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; then
> >> +		echo "$dim: could not find the upstream repo for $dim." >&2
> >> +		exit 1
> >> +	fi
> >> +
> >> +	if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show origin/maintainer-tools:dim |\
> >> +			diff "$using" - >& /dev/null; then
> >> +		echo "$dim: not running upstream version of the script." >&2
> >> +		exit 1
> >> +	fi
> >> +}
> >
> > Should we run this at startup every once in a while? Something like
> >
> > if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
> > 	dim_uptodate
> > fi
> >
> > at the top? date-based rng tested, otherwise not ...
> 
> I had something like that in mind at first, but decided to be less
> obnoxious for starters. ;)

Oh, the real obnoxious version would auto-update dim if it's not
up-to-date ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux