public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dim: Don't run stuff that needs dim setup
@ 2015-10-19 13:12 Daniel Vetter
  2015-10-19 13:12 ` [PATCH 2/2] dim: Add success notice to setup Daniel Vetter
  2015-10-19 13:41 ` [PATCH] dim: Don't run stuff that needs dim setup Jani Nikula
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-10-19 13:12 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

Yet another case where something fell off - we can't compute
dim_branches before setup is done, so shovel it somewhere where that's
not the case.

v2: Also fixup bash completion.

Reported-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 bash_completion |  9 +++++++--
 dim             | 12 ++++++------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/bash_completion b/bash_completion
index 2905abb5de49..0ad0ec4c88fe 100644
--- a/bash_completion
+++ b/bash_completion
@@ -12,8 +12,13 @@ dim ()
 _dim ()
 {
 	local cur cmds opts i
-	local nightly_branches=`(source ~/linux/drm-intel-rerere/nightly.conf ; echo $nightly_branches) | \
-		xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'`
+
+	if [ -f ~/linux/drm-intel-rerere/nightly.conf ] ; then
+		local nightly_branches=`(source ~/linux/drm-intel-rerere/nightly.conf ; echo $nightly_branches) | \
+			xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'`
+	else
+		local nightly_branches=""
+	fi
 	local upstream_branches="origin/master airlied/drm-next airlied/drm-fixes"
 
 	cmds="setup nightly-forget update-branches"
diff --git a/dim b/dim
index 4b08291e487d..298874355c84 100755
--- a/dim
+++ b/dim
@@ -150,14 +150,14 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" ]; then
 			exit 1
 		fi
 	done
-fi
 
-#
-# Internal configuration that depends on a sane setup.
-#
+	#
+	# 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\///'`
+	dim_branches=`(source $DIM_PREFIX/drm-intel-rerere/nightly.conf ; echo $nightly_branches) | \
+		xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'`
+fi
 
 # get message id from file
 # $1 = file
-- 
2.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] dim: Add success notice to setup
  2015-10-19 13:12 [PATCH 1/2] dim: Don't run stuff that needs dim setup Daniel Vetter
@ 2015-10-19 13:12 ` Daniel Vetter
  2015-10-19 13:41 ` [PATCH] dim: Don't run stuff that needs dim setup Jani Nikula
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-10-19 13:12 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter

Also add a few output lines in between for progress.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dim b/dim
index 298874355c84..5f0039c41fc6 100755
--- a/dim
+++ b/dim
@@ -618,6 +618,7 @@ function setup_dim
 	fi
 	cd ..
 
+	echo "Setting up maintainer-tools ..."
 	if [ ! -d maintainer-tools ]; then
 		git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $drm_intel_ssh maintainer-tools
 	fi
@@ -630,6 +631,7 @@ function setup_dim
 	fi
 	cd ..
 
+	echo "Setting up drm-intel-rerere ..."
 	if [ ! -d drm-intel-rerere ]; then
 		git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $drm_intel_ssh drm-intel-rerere
 	fi
@@ -642,6 +644,7 @@ function setup_dim
 	fi
 	cd ..
 
+	echo "Setting up drm-intel-nightly ..."
 	if [ ! -d drm-intel-nightly ]; then
 		git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $drm_intel_ssh drm-intel-nightly
 	fi
@@ -668,6 +671,8 @@ function setup_dim
 	else
 		git remote add driver-core-upstream $driver_core_upstream_git
 	fi
+
+	echo "dim setup successfully completed!"
 }
 
 function assert_branch
-- 
2.5.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] dim: Don't run stuff that needs dim setup
  2015-10-19 13:12 [PATCH 1/2] dim: Don't run stuff that needs dim setup Daniel Vetter
  2015-10-19 13:12 ` [PATCH 2/2] dim: Add success notice to setup Daniel Vetter
@ 2015-10-19 13:41 ` Jani Nikula
  2015-10-19 13:52   ` Jani Nikula
  1 sibling, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2015-10-19 13:41 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics Development; +Cc: Daniel Vetter

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.

Reported-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dim: Don't run stuff that needs dim setup
  2015-10-19 13:41 ` [PATCH] dim: Don't run stuff that needs dim setup Jani Nikula
@ 2015-10-19 13:52   ` Jani Nikula
  0 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2015-10-19 13:52 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics Development; +Cc: Daniel Vetter

On Mon, 19 Oct 2015, Jani Nikula <jani.nikula@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@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-19 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19 13:12 [PATCH 1/2] dim: Don't run stuff that needs dim setup Daniel Vetter
2015-10-19 13:12 ` [PATCH 2/2] dim: Add success notice to setup Daniel Vetter
2015-10-19 13:41 ` [PATCH] dim: Don't run stuff that needs dim setup Jani Nikula
2015-10-19 13:52   ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox