From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH 04/18] dim: autodetect remotes, first part for dim_setup
Date: Fri, 21 Oct 2016 21:36:46 +0200 [thread overview]
Message-ID: <20161021193700.22100-5-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20161021193700.22100-1-daniel.vetter@ffwll.ch>
The goals here are multiple:
- simpler configuration through autodetection
- allows seamless upgrading to git worktree for the aux checkouts
- eventually I want to split up drm-misc into a separate remote ...
And yes this is just a start.
v2: Print errors to stderr, otherwise they can't be seen when directly
assigning the result of get_remote_name to a variable.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
dim | 112 +++++++++++++++++++++++++++++++++++---------------------------------
1 file changed, 58 insertions(+), 54 deletions(-)
diff --git a/dim b/dim
index 2601bb7dbbad..90eb553c6575 100755
--- a/dim
+++ b/dim
@@ -192,6 +192,24 @@ if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
dim_uptodate
fi
+function get_remote_name
+{
+ local remote_url=$1
+
+ local remote=`git remote -v | grep $remote_url | \
+ head -n1 | sed -e 's/^\(.*\)\t.*/\1/'`
+
+ if [[ $remote == "" ]] ; then
+ echoerr No git remote for $remote_url found in `pwd`.
+ echoerr Please set it up using
+ echoerr $ git remote add '<name>' $remote_url
+ echoerr with a name of your choice.
+ exit 1
+ fi
+
+ echo $remote
+}
+
# get message id from file
# $1 = file
message_get_id ()
@@ -1044,8 +1062,36 @@ function dim_update_branches
update_rerere_cache
}
+function setup_aux_checkout # name remote
+{
+ local name=$1
+ local remote_url=$2
+ local dir=$3
+ local remote
+
+ echo "Setting up $dir ..."
+
+ if [ ! -d $dir ]; then
+ git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $remote_url $dir
+ cd $dir
+ git config remote.origin.url $remote_url
+ echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates
+ git repack -a -d -l
+ remote=origin
+ else
+ cd $dir
+ remote=`get_remote_name $drm_intel_ssh`
+ fi
+ if ! git branch | grep $name > /dev/null ; then
+ git checkout -t $remote/$name
+ fi
+ cd ..
+}
+
function dim_setup
{
+ local remote
+
if [ ! -d $DIM_PREFIX ]; then
echo "please set up your repository directory with:"
echo " mkdir -p $DIM_PREFIX"
@@ -1062,76 +1108,34 @@ function dim_setup
exit 1
fi
cd $DIM_DRM_INTEL
- if ! git remote -v | grep "^origin[[:space:]]" | grep $linux_upstream_git > /dev/null; then
- echo "please set up remote origin for $linux_upstream_git"
- exit 1
- fi
- if ! git remote -v | grep "^$DIM_DRM_INTEL_REMOTE[[:space:]]" | grep $drm_intel_ssh > /dev/null; then
- echo "please set up remote $DIM_DRM_INTEL_REMOTE for $drm_intel_ssh with:"
- echo " git remote add $DIM_DRM_INTEL_REMOTE $drm_intel_ssh"
- echo "or update your configuration."
- exit 1
- fi
- if ! git remote -v | grep "^$DIM_DRM_UPSTREAM_REMOTE[[:space:]]" | grep $drm_upstream_git > /dev/null; then
- echo "please set up remote $DIM_DRM_UPSTREAM_REMOTE for $drm_upstream_git with:"
- echo " git remote add $DIM_DRM_UPSTREAM_REMOTE $drm_upstream_git"
- echo "or update your configuration."
- exit 1
- 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
- cd maintainer-tools
- git config remote.origin.url $drm_intel_ssh
- echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates
- git repack -a -d -l
- if ! git branch | grep maintainer-tools > /dev/null ; then
- git checkout -t origin/maintainer-tools
- fi
- cd ..
+ # check remote configuration
+ remote=`get_remote_name $linux_upstream_git`
+ remote=`get_remote_name $drm_intel_ssh`
+ remote=`get_remote_name $drm_upstream_git`
- 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
- cd drm-intel-rerere
- git config remote.origin.url $drm_intel_ssh
- echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates
- git repack -a -d -l
- if ! git branch | grep rerere-cache > /dev/null ; then
- git checkout -t origin/rerere-cache
- 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
+ setup_aux_checkout maintainer-tools $drm_intel_ssh maintainer-tools
+
+ setup_aux_checkout rerere-cache $drm_intel_ssh drm-intel-rerere
+
+ setup_aux_checkout drm-intel-nightly $drm_intel_ssh drm-intel-nightly
cd drm-intel-nightly
- mkdir -p .git/rr-cache
- git config remote.origin.url $drm_intel_ssh
- echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates
- git repack -a -d -l
- if ! git branch | grep drm-intel-nightly > /dev/null ; then
- git checkout -t origin/drm-intel-nightly
- fi
if git remote | grep drm-upstream > /dev/null ; then
git config remote.drm-upstream.url $drm_upstream_git
else
- git remote add drm-upstream $drm_upstream_git
+ remote=`get_remote_name $drm_upstream_git`
fi
if git remote | grep sound-upstream > /dev/null ; then
git config remote.sound-upstream.url $sound_upstream_git
else
- git remote add sound-upstream $sound_upstream_git
+ remote=`get_remote_name $sound_upstream_git`
fi
if git remote | grep driver-core-upstream > /dev/null ; then
git config remote.driver-core-upstream.url $driver_core_upstream_git
else
- git remote add driver-core-upstream $driver_core_upstream_git
+ remote=`get_remote_name $driver_core_upstream_git`
fi
echo "dim setup successfully completed!"
--
2.9.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-10-21 19:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 19:36 [PATCH 00/18] dim: split out drm-misc/tip.git Daniel Vetter
2016-10-21 19:36 ` [PATCH 01/18] dim: Extract TODO Daniel Vetter
2016-10-21 19:36 ` [PATCH 02/18] dim: Autocheck for up-to-dateness Daniel Vetter
2016-10-21 19:36 ` [PATCH 03/18] dim: echoerr helper for printing to stderr Daniel Vetter
2016-10-21 19:36 ` Daniel Vetter [this message]
2016-10-21 19:36 ` [PATCH 05/18] dim: support git worktree for aux checkouts Daniel Vetter
2016-10-21 19:36 ` [PATCH 06/18] dim: Nuke nightly-forget Daniel Vetter
2016-10-21 19:36 ` [PATCH 07/18] dim: autodetect branches in rebuild-nightly Daniel Vetter
2016-10-21 19:36 ` [PATCH 08/18] dim: remove integration-tree remotes Daniel Vetter
2016-10-21 19:36 ` [PATCH 09/18] dim: Split out drm-nightly.git Daniel Vetter
2016-10-21 19:36 ` [PATCH 10/18] dim: s/drm-nightly/drm-tip Daniel Vetter
2016-10-21 19:36 ` [PATCH 11/18] dim: use git branch --list Daniel Vetter
2016-10-21 19:36 ` [PATCH 12/18] dim: add revert-rerere Daniel Vetter
2016-10-21 19:36 ` [PATCH 13/18] dim: use get_maintainers.pl in dim fixes Daniel Vetter
2016-10-21 19:36 ` [PATCH 14/18] dim-update-next: Update DRIVER_TIMESTAMP Daniel Vetter
2016-10-21 19:36 ` [PATCH 15/18] dim: support multiple remotes for branches Daniel Vetter
2016-10-21 19:36 ` [PATCH 16/18] dim: remove DIM_DRM_UPSTREAM_REMOTE config var Daniel Vetter
2016-10-21 19:36 ` [PATCH 17/18] dim: Adapat create/remove-branch Daniel Vetter
2016-10-21 19:37 ` [PATCH 18/18] dim: Make update_linux_next multi-repo compliant Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161021193700.22100-5-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.