On Tue, 18 Oct 2016, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> Needs new url-mapping information in nightly.conf to work properly.

I think in the long run the right fix would be to make nightly.conf
independent of remote names. Not sure if that's worth the trouble at
this point.

BR,
Jani.



>
> 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 48d5e7b6477a..f9b28d5fd241 100755
> --- a/dim
> +++ b/dim
> @@ -235,20 +235,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
> @@ -256,7 +266,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
>  }
> @@ -272,11 +282,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 -
>  }
>  
> @@ -307,9 +326,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
>  
> @@ -329,12 +349,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
> @@ -370,14 +392,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
> @@ -386,7 +410,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

-- 
Jani Nikula, Intel Open Source Technology Center

Reply via email to