* [maintainer-tools PATCH 1/6] dim: refer to the script itself by basename without path
@ 2016-10-11 8:47 Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 2/6] dim: columnize usage output if column(1) is available Jani Nikula
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Jani Nikula @ 2016-10-11 8:47 UTC (permalink / raw)
To: intel-gfx; +Cc: jani.nikula
Add $dim for the basename of the script and use it.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/dim b/dim
index 126d79aea624..5b105743cd65 100755
--- a/dim
+++ b/dim
@@ -87,6 +87,8 @@ DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature}
# Internal configuration.
#
+dim=$(basename $0)
+
today=`date +%Y-%m-%d`
drm_intel_ssh=ssh://git.freedesktop.org/git/drm-intel
@@ -140,7 +142,7 @@ while getopts hdfi opt; do
HELP=1
;;
*)
- echo "See '$0 help' for more information." >&2
+ echo "See '$dim help' for more information." >&2
exit
esac
done
@@ -373,7 +375,7 @@ function dim_nightly_forget
function dim_push_branch
{
if [[ "x$1" = "x" ]]; then
- echo "usage: $0 $subcommand branch"
+ echo "usage: $dim $subcommand branch"
exit 1
fi
@@ -463,7 +465,7 @@ function dim_apply_next_fixes
function dim_cherry_pick
{
if [[ "x$1" = "x" ]]; then
- echo "usage: $0 $subcommand commit-ish"
+ echo "usage: $dim $subcommand commit-ish"
exit 1
fi
sha=`git rev-parse $1`
@@ -583,7 +585,7 @@ function dim_magic_patch
function dim_create_branch
{
if [[ "x$1" = "x" ]]; then
- echo "usage: $0 $subcommand branch [commit-ish]"
+ echo "usage: $dim $subcommand branch [commit-ish]"
exit 1
fi
branch=$1
@@ -607,7 +609,7 @@ function dim_create_branch
function dim_remove_branch
{
if [[ "x$1" = "x" ]]; then
- echo "usage: $0 $subcommand branch"
+ echo "usage: $dim $subcommand branch"
exit 1
fi
branch=$1
@@ -650,7 +652,7 @@ dim_alias_co=checkout
function dim_checkout
{
if [[ "x$1" = "x" ]]; then
- echo "usage: $0 $subcommand branch"
+ echo "usage: $dim $subcommand branch"
exit 1
fi
@@ -791,7 +793,7 @@ function dim_create_workdir
local branches
if [[ "x$1" = "x" ]]; then
- echo "usage: $0 $subcommand branch|all"
+ echo "usage: $dim $subcommand branch|all"
exit 1
elif [[ "$1" = "all" ]] ; then
branches=$dim_branches
@@ -923,7 +925,7 @@ function dim_tag_next
function dim_pull_request
{
if [[ "x$1" = "x" || "x$2" = "x" ]]; then
- echo "usage: $0 $subcommand branch upstream"
+ echo "usage: $dim $subcommand branch upstream"
exit 1
fi
@@ -1236,12 +1238,12 @@ function dim_help
function dim_usage
{
- echo "usage: $0 [OPTIONS] SUBCOMMAND [ARGUMENTS]"
+ echo "usage: $dim [OPTIONS] SUBCOMMAND [ARGUMENTS]"
echo
echo "The available subcommands are:"
dim_list_commands | sed 's/^/\t/'
echo
- echo "See '$0 help' for more information."
+ echo "See '$dim help' for more information."
}
# dim subcommand aliases
@@ -1255,6 +1257,6 @@ subcmd_func=dim_${subcmd//-/_}
if declare -f $subcmd_func >/dev/null; then
$subcmd_func "$@"
else
- echo "$0: '$subcommand' is not a dim command." >&2
+ echo "$dim: '$subcommand' is not a dim command." >&2
dim_usage
fi
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [maintainer-tools PATCH 2/6] dim: columnize usage output if column(1) is available
2016-10-11 8:47 [maintainer-tools PATCH 1/6] dim: refer to the script itself by basename without path Jani Nikula
@ 2016-10-11 8:47 ` Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 3/6] dim: clean up the rm's in dim checker Jani Nikula
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2016-10-11 8:47 UTC (permalink / raw)
To: intel-gfx; +Cc: jani.nikula
The usage has become a bit unwieldy with the command list.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dim b/dim
index 5b105743cd65..79245550b6b2 100755
--- a/dim
+++ b/dim
@@ -1241,7 +1241,11 @@ function dim_usage
echo "usage: $dim [OPTIONS] SUBCOMMAND [ARGUMENTS]"
echo
echo "The available subcommands are:"
- dim_list_commands | sed 's/^/\t/'
+ if hash column 2>/dev/null; then
+ dim_list_commands | column -c 72 | sed 's/^/\t/'
+ else
+ dim_list_commands | sed 's/^/\t/'
+ fi
echo
echo "See '$dim help' for more information."
}
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [maintainer-tools PATCH 3/6] dim: clean up the rm's in dim checker
2016-10-11 8:47 [maintainer-tools PATCH 1/6] dim: refer to the script itself by basename without path Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 2/6] dim: columnize usage output if column(1) is available Jani Nikula
@ 2016-10-11 8:47 ` Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 4/6] dim: add DIM_MAKE_OPTIONS configuration Jani Nikula
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2016-10-11 8:47 UTC (permalink / raw)
To: intel-gfx; +Cc: jani.nikula
The -f option does what the doctor orders.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dim b/dim
index 79245550b6b2..76da7e347a6e 100755
--- a/dim
+++ b/dim
@@ -730,8 +730,7 @@ function dim_checkpatch
function dim_checker
{
- rm drivers/gpu/drm/i915/*.o &> /dev/null || true
- rm drivers/gpu/drm/i915/*.ko &> /dev/null || true
+ rm -f drivers/gpu/drm/i915/*.o drivers/gpu/drm/i915/*.ko
make C=1 drivers/gpu/drm/i915/i915.ko
}
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [maintainer-tools PATCH 4/6] dim: add DIM_MAKE_OPTIONS configuration
2016-10-11 8:47 [maintainer-tools PATCH 1/6] dim: refer to the script itself by basename without path Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 2/6] dim: columnize usage output if column(1) is available Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 3/6] dim: clean up the rm's in dim checker Jani Nikula
@ 2016-10-11 8:47 ` Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 5/6] dim: add dim sparse subcommand to run sparse on a commit range Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 6/6] dim: add command to check for dim updates Jani Nikula
4 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2016-10-11 8:47 UTC (permalink / raw)
To: intel-gfx; +Cc: jani.nikula
Defaults to -j20.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 7 +++++--
dim.rst | 4 ++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dim b/dim
index 76da7e347a6e..e3ef4365e85f 100755
--- a/dim
+++ b/dim
@@ -74,6 +74,9 @@ DIM_DRM_UPSTREAM_REMOTE=${DIM_DRM_UPSTREAM_REMOTE:-airlied}
# usage: $DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...]
DIM_MUA=${DIM_MUA:-mutt}
+# make options (not used for C=1)
+DIM_MAKE_OPTIONS=${DIM_MAKE_OPTIONS:--j20}
+
# command to run after dim apply
DIM_POST_APPLY_ACTION=${DIM_POST_APPLY_ACTION:-}
@@ -539,7 +542,7 @@ function dim_cherry_pick_next_fixes
dim_alias_ar=apply-resolved
function dim_apply_resolved
{
- make -j 20 && git add -u && git am --resolved
+ make $DIM_MAKE_OPTIONS && git add -u && git am --resolved
checkpatch_commit HEAD
git commit --amend &
}
@@ -549,7 +552,7 @@ function dim_magic_rebase_resolve
{
git diff HEAD | patch -p1 -R
cat .git/rebase-merge/patch | dim mp
- make -j 20
+ make $DIM_MAKE_OPTIONS
git add -u
git rebase --continue
}
diff --git a/dim.rst b/dim.rst
index 0b436f212539..58e222a7d590 100644
--- a/dim.rst
+++ b/dim.rst
@@ -348,6 +348,10 @@ DIM_MUA
Mail user agent. Must support the following subset of **mutt(1)** command line
options: \$DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...]
+DIM_MAKE_OPTIONS
+----------------
+Additional options to pass to **make(1)**. Defaults to "-j20".
+
DIM_TEMPLATE_HELLO
------------------
Path to a file containing a greeting template for pull request mails.
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [maintainer-tools PATCH 5/6] dim: add dim sparse subcommand to run sparse on a commit range
2016-10-11 8:47 [maintainer-tools PATCH 1/6] dim: refer to the script itself by basename without path Jani Nikula
` (2 preceding siblings ...)
2016-10-11 8:47 ` [maintainer-tools PATCH 4/6] dim: add DIM_MAKE_OPTIONS configuration Jani Nikula
@ 2016-10-11 8:47 ` Jani Nikula
2016-10-11 12:56 ` Daniel Vetter
2016-10-11 8:47 ` [maintainer-tools PATCH 6/6] dim: add command to check for dim updates Jani Nikula
4 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2016-10-11 8:47 UTC (permalink / raw)
To: intel-gfx; +Cc: jani.nikula
Run sparse only on files that have changed in the range.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 9 +++++++++
dim.rst | 22 +++++++++++++++-------
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/dim b/dim
index e3ef4365e85f..bef7bb6c401b 100755
--- a/dim
+++ b/dim
@@ -731,6 +731,15 @@ function dim_checkpatch
done
}
+function dim_sparse
+{
+ local range=$(rangeish "$1")
+
+ make $DIM_MAKE_OPTIONS
+ touch --no-create `git diff --name-only $range` `git diff --name-only`
+ make C=1
+}
+
function dim_checker
{
rm -f drivers/gpu/drm/i915/*.o drivers/gpu/drm/i915/*.ko
diff --git a/dim.rst b/dim.rst
index 58e222a7d590..7244052dea03 100644
--- a/dim.rst
+++ b/dim.rst
@@ -186,12 +186,6 @@ fixes *commit-ish*
Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel
CodingStyle approved format.
-check-patch|cp [*commit-ish* [.. *commit-ish*]]
------------------------------------------------
-Runs the given commit range commit-ish..commit-ish through the check tools. If
-no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
-instead of a range, the range commit-ish..HEAD is used.
-
cherry-pick *commit-ish* [*git cherry-pick arguments*]
------------------------------------------------------
@@ -259,9 +253,23 @@ remote is up-to-date. Useful if drm-intel-next has been changed since the last
run of the update-next command (e.g. to apply a hotfix before sending out the
pull request).
+checkpatch|check-patch|cp [*commit-ish* [.. *commit-ish*]]
+----------------------------------------------------------
+Runs the given commit range commit-ish..commit-ish through the check tools.
+
+If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
+instead of a range, the range commit-ish..HEAD is used.
+
+sparse [*commit-ish* [.. *commit-ish*]]
+---------------------------------------
+Run sparse on the files changed by the given commit range.
+
+If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
+instead of a range, the range commit-ish..HEAD is used.
+
checker
-------
-Run sparse on the kernel.
+Run sparse on drm/i915.
create-branch *branch* [*commit-ish*]
-------------------------------------
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [maintainer-tools PATCH 6/6] dim: add command to check for dim updates
2016-10-11 8:47 [maintainer-tools PATCH 1/6] dim: refer to the script itself by basename without path Jani Nikula
` (3 preceding siblings ...)
2016-10-11 8:47 ` [maintainer-tools PATCH 5/6] dim: add dim sparse subcommand to run sparse on a commit range Jani Nikula
@ 2016-10-11 8:47 ` Jani Nikula
2016-10-11 13:00 ` Daniel Vetter
4 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2016-10-11 8:47 UTC (permalink / raw)
To: intel-gfx; +Cc: jani.nikula
Add a command to check if the user is running an up-to-date version of
dim.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
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
+}
+
# get message id from file
# $1 = file
message_get_id ()
diff --git a/dim.rst b/dim.rst
index 7244052dea03..85de95796611 100644
--- a/dim.rst
+++ b/dim.rst
@@ -317,6 +317,10 @@ list-upstreams
List of all upstreams commonly used for pull requests. Useful for autocompletion
scripts.
+uptodate
+--------
+Try to check if you're running an up-to-date version of **dim**.
+
help
----
Show this help. Install **rst2man(1)** for best results.
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [maintainer-tools PATCH 5/6] dim: add dim sparse subcommand to run sparse on a commit range
2016-10-11 8:47 ` [maintainer-tools PATCH 5/6] dim: add dim sparse subcommand to run sparse on a commit range Jani Nikula
@ 2016-10-11 12:56 ` Daniel Vetter
0 siblings, 0 replies; 10+ messages in thread
From: Daniel Vetter @ 2016-10-11 12:56 UTC (permalink / raw)
To: Jani Nikula; +Cc: intel-gfx
On Tue, Oct 11, 2016 at 11:47:31AM +0300, Jani Nikula wrote:
> Run sparse only on files that have changed in the range.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> dim | 9 +++++++++
> dim.rst | 22 +++++++++++++++-------
> 2 files changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/dim b/dim
> index e3ef4365e85f..bef7bb6c401b 100755
> --- a/dim
> +++ b/dim
> @@ -731,6 +731,15 @@ function dim_checkpatch
> done
> }
>
> +function dim_sparse
> +{
> + local range=$(rangeish "$1")
> +
> + make $DIM_MAKE_OPTIONS
> + touch --no-create `git diff --name-only $range` `git diff --name-only`
> + make C=1
> +}
> +
> function dim_checker
> {
> rm -f drivers/gpu/drm/i915/*.o drivers/gpu/drm/i915/*.ko
> diff --git a/dim.rst b/dim.rst
> index 58e222a7d590..7244052dea03 100644
> --- a/dim.rst
> +++ b/dim.rst
> @@ -186,12 +186,6 @@ fixes *commit-ish*
> Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel
> CodingStyle approved format.
>
> -check-patch|cp [*commit-ish* [.. *commit-ish*]]
> ------------------------------------------------
> -Runs the given commit range commit-ish..commit-ish through the check tools. If
> -no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
> -instead of a range, the range commit-ish..HEAD is used.
> -
> cherry-pick *commit-ish* [*git cherry-pick arguments*]
> ------------------------------------------------------
>
> @@ -259,9 +253,23 @@ remote is up-to-date. Useful if drm-intel-next has been changed since the last
> run of the update-next command (e.g. to apply a hotfix before sending out the
> pull request).
>
> +checkpatch|check-patch|cp [*commit-ish* [.. *commit-ish*]]
> +----------------------------------------------------------
> +Runs the given commit range commit-ish..commit-ish through the check tools.
> +
> +If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
> +instead of a range, the range commit-ish..HEAD is used.
> +
> +sparse [*commit-ish* [.. *commit-ish*]]
> +---------------------------------------
Since we have this nice rangeish helper, should we change the synopsis to
[rangeish], with a separate section explaining what a dim rangeish is?
Just a drive-by bikeshed really, ok as-is.
-Daniel
> +Run sparse on the files changed by the given commit range.
> +
> +If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed
> +instead of a range, the range commit-ish..HEAD is used.
> +
> checker
> -------
> -Run sparse on the kernel.
> +Run sparse on drm/i915.
>
> create-branch *branch* [*commit-ish*]
> -------------------------------------
> --
> 2.1.4
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [maintainer-tools PATCH 6/6] dim: add command to check for dim updates
2016-10-11 8:47 ` [maintainer-tools PATCH 6/6] dim: add command to check for dim updates Jani Nikula
@ 2016-10-11 13:00 ` Daniel Vetter
2016-10-11 13:07 ` Jani Nikula
0 siblings, 1 reply; 10+ messages in thread
From: Daniel Vetter @ 2016-10-11 13:00 UTC (permalink / raw)
To: Jani Nikula; +Cc: intel-gfx
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@intel.com>
> ---
> 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 ...
With or without these bikesheds Acked-by: me on the entire series.
-Daniel
> +
> # get message id from file
> # $1 = file
> message_get_id ()
> diff --git a/dim.rst b/dim.rst
> index 7244052dea03..85de95796611 100644
> --- a/dim.rst
> +++ b/dim.rst
> @@ -317,6 +317,10 @@ list-upstreams
> List of all upstreams commonly used for pull requests. Useful for autocompletion
> scripts.
>
> +uptodate
> +--------
> +Try to check if you're running an up-to-date version of **dim**.
> +
> help
> ----
> Show this help. Install **rst2man(1)** for best results.
> --
> 2.1.4
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [maintainer-tools PATCH 6/6] dim: add command to check for dim updates
2016-10-11 13:00 ` Daniel Vetter
@ 2016-10-11 13:07 ` Jani Nikula
2016-10-13 14:50 ` Daniel Vetter
0 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2016-10-11 13:07 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx
On Tue, 11 Oct 2016, Daniel Vetter <daniel@ffwll.ch> 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@intel.com>
>> ---
>> 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. ;)
> With or without these bikesheds Acked-by: me on the entire series.
I'll get back to the bikesheds later, pushed as-is now. Thanks.
BR,
Jani.
> -Daniel
>
>> +
>> # get message id from file
>> # $1 = file
>> message_get_id ()
>> diff --git a/dim.rst b/dim.rst
>> index 7244052dea03..85de95796611 100644
>> --- a/dim.rst
>> +++ b/dim.rst
>> @@ -317,6 +317,10 @@ list-upstreams
>> List of all upstreams commonly used for pull requests. Useful for autocompletion
>> scripts.
>>
>> +uptodate
>> +--------
>> +Try to check if you're running an up-to-date version of **dim**.
>> +
>> help
>> ----
>> Show this help. Install **rst2man(1)** for best results.
>> --
>> 2.1.4
>>
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [maintainer-tools PATCH 6/6] dim: add command to check for dim updates
2016-10-11 13:07 ` Jani Nikula
@ 2016-10-13 14:50 ` Daniel Vetter
0 siblings, 0 replies; 10+ messages in thread
From: Daniel Vetter @ 2016-10-13 14:50 UTC (permalink / raw)
To: Jani Nikula; +Cc: intel-gfx
On Tue, Oct 11, 2016 at 04:07:30PM +0300, Jani Nikula wrote:
> On Tue, 11 Oct 2016, Daniel Vetter <daniel@ffwll.ch> 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@intel.com>
> >> ---
> >> 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-10-13 14:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-11 8:47 [maintainer-tools PATCH 1/6] dim: refer to the script itself by basename without path Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 2/6] dim: columnize usage output if column(1) is available Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 3/6] dim: clean up the rm's in dim checker Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 4/6] dim: add DIM_MAKE_OPTIONS configuration Jani Nikula
2016-10-11 8:47 ` [maintainer-tools PATCH 5/6] dim: add dim sparse subcommand to run sparse on a commit range Jani Nikula
2016-10-11 12:56 ` Daniel Vetter
2016-10-11 8:47 ` [maintainer-tools PATCH 6/6] dim: add command to check for dim updates Jani Nikula
2016-10-11 13:00 ` Daniel Vetter
2016-10-11 13:07 ` Jani Nikula
2016-10-13 14:50 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox