[Intel-gfx] [PATCH 6/8] dim: autodetect branches in rebuild-nightly

Daniel Vetter daniel.vetter at ffwll.ch
Sun Oct 16 18:48:08 UTC 2016


Needs new url-mapping information in nightly.conf to work properly.

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim | 48 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/dim b/dim
index 3bd5416327a8..7e3708599943 100755
--- a/dim
+++ b/dim
@@ -230,20 +230,30 @@ function dim_commit_add_tag
 	done
 }
 
+function map_nightly_remote
+{
+	local nightly_remote=$1
+	local remote_url=`eval echo "\\\$nightly_remote_url_${nightly_remote/-/_}"`
+
+	get_remote_name $remote_url
+}
+
 function update_linux_next
 {
 	cd $DIM_PREFIX/drm-intel-nightly
 
+	local nightly_origin=`map_nightly_remote origin`
+
 	# always update drm-intel-fixes
 	echo -n "Pushing drm-intel-fixes to for-linux-next-fixes... "
-	git push $DRY_RUN origin +origin/drm-intel-fixes:for-linux-next-fixes >& /dev/null
+	git push $DRY_RUN $nightly_origin +$nightly_origin/drm-intel-fixes:for-linux-next-fixes >& /dev/null
 	echo "Done."
 
-	if git merge-base --is-ancestor origin/drm-intel-next-fixes origin/drm-intel-fixes ; then
+	if git merge-base --is-ancestor $nightly_origin/drm-intel-next-fixes $nightly_origin/drm-intel-fixes ; then
 		# -fixes has caught up to dinf, i.e. we're out of the merge
 		# window. Push the next queue.
 		echo -n "Out of merge window. Pushing drm-intel-next-queued to for-linux-next... "
-		git push $DRY_RUN origin +origin/drm-intel-next-queued:for-linux-next >& /dev/null
+		git push $DRY_RUN $nightly_origin +$nightly_origin/drm-intel-next-queued:for-linux-next >& /dev/null
 		echo "Done."
 	else
 		# dinf is ahead of -fixes, i.e. drm-next has already closed for
@@ -251,7 +261,7 @@ function update_linux_next
 		# for the current -next cycle. Push dinf
 
 		echo -n "Pushing drm-intel-next-fixes to for-linux-next... "
-		git push $DRY_RUN origin +origin/drm-intel-next-fixes:for-linux-next >& /dev/null
+		git push $DRY_RUN $nightly_origin +$nightly_origin/drm-intel-next-fixes:for-linux-next >& /dev/null
 		echo "Done."
 	fi
 }
@@ -267,11 +277,20 @@ function check_conflicts
 	true
 }
 
+function rr_cache_dir
+{
+	if [ -d $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ ] ; then
+		echo $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/
+	else
+		echo $DIM_PREFIX/$DIM_DRM_INTEL/.git/rr-cache/
+	fi
+}
+
 function update_rerere_cache
 {
 	cd $DIM_PREFIX/drm-intel-rerere/
 	git pull
-	cp rr-cache/* $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ -r
+	cp rr-cache/* `rr_cache-dir` -r
 	cd -
 }
 
@@ -302,9 +321,10 @@ function dim_rebuild_nightly
 	fi
 
 	for remote in $(echo $nightly_branches | tr " " "\n" | sed 's|/.*$||g' | sort -u); do
-		echo -n "Fetching $remote... "
+		local nightly_remote=`map_nightly_remote $remote`
+		echo -n "Fetching $remote (as $nightly_remote) ... "
 		# git fetch returns 128 if there's nothing to be fetched
-		git fetch $remote >& /dev/null || true
+		git fetch $nightly_remote >& /dev/null || true
 		echo "Done."
 	done
 
@@ -324,12 +344,14 @@ function dim_rebuild_nightly
 		if [[ -n $sha1 ]] ; then
 			echo -n "Using override sha1: $sha1... "
 		else
-			sha1=$branch
+			local remote=${branch%%/*}
+			local nightly_remote=`map_nightly_remote $remote`
+			sha1=`echo $branch | sed -e s/^$remote/$nightly_remote/`
 		fi
 
 		if [ $first == 1 ] ; then
+			git reset --hard $sha1 &> /dev/null
 			echo "Reset. Done."
-			git reset --hard $sha1 >& /dev/null
 			first=0
 		elif git merge --rerere-autoupdate --ff-only $sha1 >& /dev/null ; then
 			# nothing to do if just fast-forward
@@ -365,14 +387,16 @@ function dim_rebuild_nightly
 	git commit --quiet -m "$integration_branch: $time integration manifest"
 	echo "Done."
 
+	local nightly_origin=`map_nightly_remote origin`
+
 	echo -n "Pushing $integration_branch... "
-	git push $DRY_RUN origin +HEAD >& /dev/null && echo "Done."
+	git push $DRY_RUN $nightly_origin +HEAD >& /dev/null && echo "Done."
 
 	echo -n "Updating rerere cache... "
 	cd $rerere
 	if git branch | grep rerere-cache | grep '\*' >& /dev/null ; then
 		git pull >& /dev/null
-		cp $DIM_PREFIX/$integration_branch/.git/rr-cache/* rr-cache -r
+		cp `rr_cache_dir` rr-cache -r
 		git add *.patch >& /dev/null || true
 		git add rr-cache/* > /dev/null
 		if git commit -m "$time: $integration_branch rerere cache update" >& /dev/null; then
@@ -381,7 +405,7 @@ function dim_rebuild_nightly
 			echo -n "Nothing changed. "
 		fi
 		echo -n "Pushing rerere cache... "
-		git push $DRY_RUN origin HEAD >& /dev/null && echo "Done."
+		git push $DRY_RUN $nightly_origin HEAD >& /dev/null && echo "Done."
 	else
 		echo "Fail: Branch setup for the rerere-cache is borked."
 		exit 1
-- 
2.9.3



More information about the Intel-gfx mailing list