[Intel-gfx] [PATCH] dim: Don't run stuff that needs dim setup
Jani Nikula
jani.nikula at intel.com
Mon Oct 19 06:52:42 PDT 2015
On Mon, 19 Oct 2015, Jani Nikula <jani.nikula at intel.com> wrote:
> Yet another case where something fell off - we can't compute
> dim_branches before setup is done, so handle the commands that don't
> need setup first.
This should've had an explanation saying that I'd prefer this kind of
approach, to reduce the special casing all around.
Other than that, there was really nothing wrong with your patch either.
BR,
Jani.
>
> Reported-by: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>
> ---
>
> this is on top of the man page extraction patch
> ---
> dim | 84 +++++++++++++++++++++++++++++++++++++--------------------------------
> 1 file changed, 45 insertions(+), 39 deletions(-)
>
> diff --git a/dim b/dim
> index 03e2709159d5..530219d73358 100755
> --- a/dim
> +++ b/dim
> @@ -139,26 +139,6 @@ else
> shift
> fi
>
> -#
> -# Sanity checks.
> -#
> -
> -if [ "$subcommand" != "setup" -a "$subcommand" != "help" ]; then
> - for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-intel-rerere $DIM_PREFIX/drm-intel-nightly; do
> - if [ ! -d $d ]; then
> - echo "$d is missing, please check your configuration and/or run dim setup"
> - exit 1
> - fi
> - done
> -fi
> -
> -#
> -# Internal configuration that depends on a sane setup.
> -#
> -
> -dim_branches=`(source $DIM_PREFIX/drm-intel-rerere/nightly.conf ; echo $nightly_branches) | \
> - xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'`
> -
> # get message id from file
> # $1 = file
> message_get_id ()
> @@ -684,10 +664,53 @@ function assert_branch
> fi
> }
>
> +#
> +# Handle subcommands that must work without a sane setup.
> +#
> case "$subcommand" in
> setup)
> setup_dim
> ;;
> + help)
> + manpage=$DIM_PREFIX/maintainer-tools/dim.rst
> + if [ ! -e "$manpage" ]; then
> + manpage=$(dirname $(readlink -f $0))/dim.rst
> + if [ ! -e "$manpage" ]; then
> + echo "Can't find the man page. See http://cgit.freedesktop.org/drm-intel/tree/dim.rst?h=maintainer-tools"
> + exit 1
> + fi
> + fi
> +
> + if hash rst2man 2>/dev/null; then
> + renderer=rst2man
> + pager="man -l -"
> + else
> + renderer=cat
> + pager=${PAGER:-cat}
> + fi
> +
> + $renderer < $manpage | $pager
> + ;;
> +esac
> +
> +#
> +# Sanity checks.
> +#
> +for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-intel-rerere $DIM_PREFIX/drm-intel-nightly; do
> + if [ ! -d $d ]; then
> + echo "$d is missing, please check your configuration and/or run dim setup"
> + exit 1
> + fi
> +done
> +
> +#
> +# Internal configuration that depends on a sane setup.
> +#
> +dim_branches=`(source $DIM_PREFIX/drm-intel-rerere/nightly.conf ; echo $nightly_branches) | \
> + xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'`
> +
> +
> +case "$subcommand" in
> nightly-forget)
> cd $DIM_PREFIX/drm-intel-nightly
> git fetch origin >& /dev/null
> @@ -964,24 +987,7 @@ case "$subcommand" in
> rm drivers/gpu/drm/i915/*.ko &> /dev/null || true
> make C=1 drivers/gpu/drm/i915/i915.ko
> ;;
> - help|*)
> - manpage=$DIM_PREFIX/maintainer-tools/dim.rst
> - if [ ! -e "$manpage" ]; then
> - manpage=$(dirname $(readlink -f $0))/dim.rst
> - if [ ! -e "$manpage" ]; then
> - echo "Can't find the man page. See http://cgit.freedesktop.org/drm-intel/tree/dim.rst?h=maintainer-tools"
> - exit 1
> - fi
> - fi
> -
> - if hash rst2man 2>/dev/null; then
> - renderer=rst2man
> - pager="man -l -"
> - else
> - renderer=cat
> - pager=${PAGER:-cat}
> - fi
> -
> - $renderer < $manpage | $pager
> + *)
> + echo "Unknown command '$subcommand'. Try 'dim help'."
> ;;
> esac
> --
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list