All of lore.kernel.org
 help / color / mirror / Atom feed
* [maintainer-tools PATCH] dim: fix remote repository lookup function
       [not found] <CGME20170825113227eucas1p2beec67e2f2a805ccd34cf7bf71ed4ec1@eucas1p2.samsung.com>
@ 2017-08-25 11:31 ` Andrzej Hajda
  2017-09-27  9:58   ` Andrzej Hajda
  0 siblings, 1 reply; 10+ messages in thread
From: Andrzej Hajda @ 2017-08-25 11:31 UTC (permalink / raw)
  To: dri-devel
  Cc: Jani Nikula, Daniel Vetter, Marek Szyprowski, Bartlomiej Zolnierkiewicz

dim finds remote name by matching repository urls, but different users
requires different protocols/paths for remotes (ssh/git/https). Current
code incorrectly translates provided url to alternatives, the patch
fixes it.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 dim | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/dim b/dim
index 11aa675..d6d9269 100755
--- a/dim
+++ b/dim
@@ -223,15 +223,15 @@ fi
 #	git branch name - dim assumes that the remote and local name match
 # url:
 #	url to a repo, using ssh:// protocol
-# git_url:
-#	url to a repo, but using anonymous git:// protocol
+# urls:
+#	alternative urls to a repo, derived from url
 #
 # The below functions map between these.
 #
 
 function url_to_remote # url
 {
-	local url remote
+	local url urls remote
 
 	url="$1"
 
@@ -240,19 +240,17 @@ function url_to_remote # url
 		return 1
 	fi
 
-	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
+	urls=$(echo $url | sed -r \
+		-e 's!ssh://(git.freedesktop.org)/git/(.*)!\0|git://anon\1/\2|https://anon\1/git/\2.git!' \
+		-e 's!git://(git.kernel.org/.*)!\0|https://\1!')
+	remote=$(git remote -v | grep -m 1 -P "$urls" | cut -f 1)
 
 	if [[ -z "$remote" ]]; then
-		git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
-		remote=$(git remote -v | grep -m 1 "$git_url" | cut -f 1)
-
-		if [[ -z "$remote" ]]; then
-			echoerr "No git remote for url $url or $git_url found in $(pwd)"
-			echoerr "Please set it up using:"
-			echoerr "    $ git remote add <name> $url"
-			echoerr "with a name of your choice."
-			return 1
-		fi
+		echoerr "No git remote for url $url found in $(pwd)"
+		echoerr "Please set it up using:"
+		echoerr "    $ git remote add <name> url"
+		echoerr "with a name of your choice and url one of: ${urls//|/, }"
+		return 1
 	fi
 
 	echo $remote
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [maintainer-tools PATCH] dim: fix remote repository lookup function
  2017-08-25 11:31 ` [maintainer-tools PATCH] dim: fix remote repository lookup function Andrzej Hajda
@ 2017-09-27  9:58   ` Andrzej Hajda
  2017-09-28 14:51     ` Jani Nikula
  0 siblings, 1 reply; 10+ messages in thread
From: Andrzej Hajda @ 2017-09-27  9:58 UTC (permalink / raw)
  To: dri-devel
  Cc: Jani Nikula, Daniel Vetter, Marek Szyprowski, Bartlomiej Zolnierkiewicz

On 25.08.2017 13:31, Andrzej Hajda wrote:
> dim finds remote name by matching repository urls, but different users
> requires different protocols/paths for remotes (ssh/git/https). Current
> code incorrectly translates provided url to alternatives, the patch
> fixes it.
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>

Gently ping.

Andrzej

> ---
>  dim | 26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/dim b/dim
> index 11aa675..d6d9269 100755
> --- a/dim
> +++ b/dim
> @@ -223,15 +223,15 @@ fi
>  #	git branch name - dim assumes that the remote and local name match
>  # url:
>  #	url to a repo, using ssh:// protocol
> -# git_url:
> -#	url to a repo, but using anonymous git:// protocol
> +# urls:
> +#	alternative urls to a repo, derived from url
>  #
>  # The below functions map between these.
>  #
>  
>  function url_to_remote # url
>  {
> -	local url remote
> +	local url urls remote
>  
>  	url="$1"
>  
> @@ -240,19 +240,17 @@ function url_to_remote # url
>  		return 1
>  	fi
>  
> -	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
> +	urls=$(echo $url | sed -r \
> +		-e 's!ssh://(git.freedesktop.org)/git/(.*)!\0|git://anon\1/\2|https://anon\1/git/\2.git!' \
> +		-e 's!git://(git.kernel.org/.*)!\0|https://\1!')
> +	remote=$(git remote -v | grep -m 1 -P "$urls" | cut -f 1)
>  
>  	if [[ -z "$remote" ]]; then
> -		git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
> -		remote=$(git remote -v | grep -m 1 "$git_url" | cut -f 1)
> -
> -		if [[ -z "$remote" ]]; then
> -			echoerr "No git remote for url $url or $git_url found in $(pwd)"
> -			echoerr "Please set it up using:"
> -			echoerr "    $ git remote add <name> $url"
> -			echoerr "with a name of your choice."
> -			return 1
> -		fi
> +		echoerr "No git remote for url $url found in $(pwd)"
> +		echoerr "Please set it up using:"
> +		echoerr "    $ git remote add <name> url"
> +		echoerr "with a name of your choice and url one of: ${urls//|/, }"
> +		return 1
>  	fi
>  
>  	echo $remote


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [maintainer-tools PATCH] dim: fix remote repository lookup function
  2017-09-27  9:58   ` Andrzej Hajda
@ 2017-09-28 14:51     ` Jani Nikula
  2017-09-28 14:51       ` [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos Jani Nikula
  0 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2017-09-28 14:51 UTC (permalink / raw)
  To: Andrzej Hajda, dri-devel
  Cc: Daniel Vetter, Marek Szyprowski, Bartlomiej Zolnierkiewicz

On Wed, 27 Sep 2017, Andrzej Hajda <a.hajda@samsung.com> wrote:
> On 25.08.2017 13:31, Andrzej Hajda wrote:
>> dim finds remote name by matching repository urls, but different users
>> requires different protocols/paths for remotes (ssh/git/https). Current
>> code incorrectly translates provided url to alternatives, the patch
>> fixes it.
>>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>
> Gently ping.

Apologies for the delay. I had a hard time understanding all the sed
trickery you have there. Then I decided the right solution is to be able
to configure multiple URLs in nightly.conf for each repo in
drm_tip_repos.

Patch follows adding this support to dim, untested because I need to run
now. Unfortunately we can't update nightly.conf before dim users have
upgraded to the patched version, because otherwise their setups would
break.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos
  2017-09-28 14:51     ` Jani Nikula
@ 2017-09-28 14:51       ` Jani Nikula
  2017-10-03  6:15         ` Jani Nikula
  0 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2017-09-28 14:51 UTC (permalink / raw)
  To: Jani Nikula, Andrzej Hajda, dri-devel
  Cc: Daniel Vetter, Marek Szyprowski, Bartlomiej Zolnierkiewicz

This lets us configure a space separated list of URLs for each repo in
drm_tip_repos, with all accepted protocols and sources, and the first
one found gets picked. This way we don't have to have a complicated set
of rules for converting between ssh, git and https protocol URLs.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>

---

!!! UNTESTED !!!
---
 dim | 97 +++++++++++++++++++++++++++++++++++++++++++++------------------------
 1 file changed, 63 insertions(+), 34 deletions(-)

diff --git a/dim b/dim
index c6c746cdb154..d2f165893161 100755
--- a/dim
+++ b/dim
@@ -255,44 +255,73 @@ fi
 # The below functions map between these.
 #
 
-function url_to_remote # url
+function url_to_remote # url [url ...]
 {
 	local url remote
 
-	url="$1"
-
-	if [[ -z "$url" ]]; then
-		echoerr "$0 without url"
+	if [[ "$#" = "0" ]]; then
+		echoerr "url_to_remote without URLs"
 		return 1
 	fi
 
-	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
-
-	if [[ -z "$remote" ]]; then
-		git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
-		remote=$(git remote -v | grep -m 1 "$git_url" | cut -f 1)
+	for url; do
+		remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
+		if [[ -n "$remote" ]]; then
+			echo "$remote"
+			return 0
+		fi
+	done
 
-		if [[ -z "$remote" ]]; then
-			echoerr "No git remote for url $url or $git_url found in $(pwd)"
-			remote=${url%.git}
-			remote=${remote##*/}
-			read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true
-			if [[ "$REPLY" == "" ]] ; then
-				echoerr "Please set it up yourself using:"
-				echoerr "    $ git remote add <name> $url"
-				echoerr "with a name of your choice."
-				exit 1
-			fi
+	echoerr "No git remote for any of the URLs $* found in $(pwd)"
 
-			git remote add $remote $url
-		fi
+	url=$1
+	remote=${url%.git}
+	remote=${remote##*/}
+	read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true
+	if [[ "$REPLY" == "" ]] ; then
+		echoerr "Please set it up yourself using:"
+		echoerr "    $ git remote add <name> $url"
+		echoerr "with a name of your choice."
+		exit 1
 	fi
 
+	git remote add $remote $url
+
 	echo $remote
 
 	return 0
 }
 
+function url_to_git_url # url [url ...]
+{
+	local url git_url
+
+	if [[ "$#" = "0" ]]; then
+		echoerr "url_to_git_url without URLs"
+		return 1
+	fi
+
+	# Find the git:// URL, converting from ssh:// URL as fallback
+	for url; do
+		case $url in
+			git://*)
+				git_url=$url
+				break
+				;;
+			ssh://*)
+				git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
+				;;
+		esac
+	done
+
+	if [[ -z "$git_url" ]]; then
+		echoerr "No git or ssh URL in any of the URLs $*"
+		return 1
+	fi
+
+	echo $git_url
+}
+
 function branch_to_remote # branch
 {
 	local branch remote
@@ -595,7 +624,7 @@ function commit_rerere_cache
 
 function dim_rebuild_tip
 {
-	local integration_branch specfile time first rerere repo url remote
+	local integration_branch specfile time first rerere repo url_list remote
 
 	integration_branch=drm-tip
 	specfile=$(mktemp)
@@ -627,8 +656,8 @@ function dim_rebuild_tip
 	echo "Done."
 
 	for repo in "${!drm_tip_repos[@]}"; do
-		url=${drm_tip_repos[$repo]}
-		remote=$(url_to_remote $url)
+		url_list=${drm_tip_repos[$repo]}
+		remote=$(url_to_remote $url_list)
 		echo -n "Fetching $repo (local remote $remote)... "
 		git_fetch_helper $remote
 		echo "Done."
@@ -639,8 +668,8 @@ function dim_rebuild_tip
 		local branch override sha1 fixup_file
 
 		read -r repo branch override <<< $conf
-		url=${drm_tip_repos[$repo]}
-		remote=$(url_to_remote $url)
+		url_list=${drm_tip_repos[$repo]}
+		remote=$(url_to_remote $url_list)
 		sha1=$remote/$branch
 
 		echo -n "Merging $repo (local remote $remote) $branch... "
@@ -1641,7 +1670,7 @@ function prep_pull_tag_summary
 # dim_pull_request branch upstream
 function dim_pull_request
 {
-	local branch upstream remote repo req_file url git_url suffix tag
+	local branch upstream remote repo req_file url_list git_url suffix tag
 
 	branch=${1:?$usage}
 	upstream=${2:?$usage}
@@ -1679,8 +1708,8 @@ function dim_pull_request
 		repo=$(branch_to_repo $branch)
 	fi
 
-	url=${drm_tip_repos[$repo]}
-	git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
+	url_list=${drm_tip_repos[$repo]}
+	git_url=$(url_to_git_url $url_list)
 
 	git request-pull $upstream $git_url $tag >> $req_file
 	$DRY $DIM_MUA -s "[PULL] $branch" \
@@ -1729,7 +1758,7 @@ function dim_list_branches
 dim_alias_ub=update-branches
 function dim_update_branches
 {
-	local repo remote
+	local repo remote url_list
 
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 
@@ -1740,8 +1769,8 @@ function dim_update_branches
 	fi
 
 	for repo in "${!drm_tip_repos[@]}"; do
-		url=${drm_tip_repos[$repo]}
-		if ! remote=$(url_to_remote $url 2>/dev/null); then
+		url_list=${drm_tip_repos[$repo]}
+		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
 			continue
 		fi
 		echo -n "Fetching $repo (local remote $remote)... "
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos
  2017-09-28 14:51       ` [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos Jani Nikula
@ 2017-10-03  6:15         ` Jani Nikula
  2017-10-03  8:01           ` Daniel Vetter
  2017-10-09 10:30           ` Jani Nikula
  0 siblings, 2 replies; 10+ messages in thread
From: Jani Nikula @ 2017-10-03  6:15 UTC (permalink / raw)
  To: Andrzej Hajda, dri-devel
  Cc: Daniel Vetter, Marek Szyprowski, Bartlomiej Zolnierkiewicz

On Thu, 28 Sep 2017, Jani Nikula <jani.nikula@intel.com> wrote:
> This lets us configure a space separated list of URLs for each repo in
> drm_tip_repos, with all accepted protocols and sources, and the first
> one found gets picked. This way we don't have to have a complicated set
> of rules for converting between ssh, git and https protocol URLs.

I merged this last week with Daniel's IRC ack. We'll need to give people
a little bit of time before updating nightly.conf. Sorry for the
inconvenience in the mean time.

We should probably think about adding some real versioning to dim to be
able to handle this kind of stuff more systematically.

BR,
Jani.



>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> ---
>
> !!! UNTESTED !!!
> ---
>  dim | 97 +++++++++++++++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 63 insertions(+), 34 deletions(-)
>
> diff --git a/dim b/dim
> index c6c746cdb154..d2f165893161 100755
> --- a/dim
> +++ b/dim
> @@ -255,44 +255,73 @@ fi
>  # The below functions map between these.
>  #
>  
> -function url_to_remote # url
> +function url_to_remote # url [url ...]
>  {
>  	local url remote
>  
> -	url="$1"
> -
> -	if [[ -z "$url" ]]; then
> -		echoerr "$0 without url"
> +	if [[ "$#" = "0" ]]; then
> +		echoerr "url_to_remote without URLs"
>  		return 1
>  	fi
>  
> -	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
> -
> -	if [[ -z "$remote" ]]; then
> -		git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
> -		remote=$(git remote -v | grep -m 1 "$git_url" | cut -f 1)
> +	for url; do
> +		remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
> +		if [[ -n "$remote" ]]; then
> +			echo "$remote"
> +			return 0
> +		fi
> +	done
>  
> -		if [[ -z "$remote" ]]; then
> -			echoerr "No git remote for url $url or $git_url found in $(pwd)"
> -			remote=${url%.git}
> -			remote=${remote##*/}
> -			read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true
> -			if [[ "$REPLY" == "" ]] ; then
> -				echoerr "Please set it up yourself using:"
> -				echoerr "    $ git remote add <name> $url"
> -				echoerr "with a name of your choice."
> -				exit 1
> -			fi
> +	echoerr "No git remote for any of the URLs $* found in $(pwd)"
>  
> -			git remote add $remote $url
> -		fi
> +	url=$1
> +	remote=${url%.git}
> +	remote=${remote##*/}
> +	read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true
> +	if [[ "$REPLY" == "" ]] ; then
> +		echoerr "Please set it up yourself using:"
> +		echoerr "    $ git remote add <name> $url"
> +		echoerr "with a name of your choice."
> +		exit 1
>  	fi
>  
> +	git remote add $remote $url
> +
>  	echo $remote
>  
>  	return 0
>  }
>  
> +function url_to_git_url # url [url ...]
> +{
> +	local url git_url
> +
> +	if [[ "$#" = "0" ]]; then
> +		echoerr "url_to_git_url without URLs"
> +		return 1
> +	fi
> +
> +	# Find the git:// URL, converting from ssh:// URL as fallback
> +	for url; do
> +		case $url in
> +			git://*)
> +				git_url=$url
> +				break
> +				;;
> +			ssh://*)
> +				git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
> +				;;
> +		esac
> +	done
> +
> +	if [[ -z "$git_url" ]]; then
> +		echoerr "No git or ssh URL in any of the URLs $*"
> +		return 1
> +	fi
> +
> +	echo $git_url
> +}
> +
>  function branch_to_remote # branch
>  {
>  	local branch remote
> @@ -595,7 +624,7 @@ function commit_rerere_cache
>  
>  function dim_rebuild_tip
>  {
> -	local integration_branch specfile time first rerere repo url remote
> +	local integration_branch specfile time first rerere repo url_list remote
>  
>  	integration_branch=drm-tip
>  	specfile=$(mktemp)
> @@ -627,8 +656,8 @@ function dim_rebuild_tip
>  	echo "Done."
>  
>  	for repo in "${!drm_tip_repos[@]}"; do
> -		url=${drm_tip_repos[$repo]}
> -		remote=$(url_to_remote $url)
> +		url_list=${drm_tip_repos[$repo]}
> +		remote=$(url_to_remote $url_list)
>  		echo -n "Fetching $repo (local remote $remote)... "
>  		git_fetch_helper $remote
>  		echo "Done."
> @@ -639,8 +668,8 @@ function dim_rebuild_tip
>  		local branch override sha1 fixup_file
>  
>  		read -r repo branch override <<< $conf
> -		url=${drm_tip_repos[$repo]}
> -		remote=$(url_to_remote $url)
> +		url_list=${drm_tip_repos[$repo]}
> +		remote=$(url_to_remote $url_list)
>  		sha1=$remote/$branch
>  
>  		echo -n "Merging $repo (local remote $remote) $branch... "
> @@ -1641,7 +1670,7 @@ function prep_pull_tag_summary
>  # dim_pull_request branch upstream
>  function dim_pull_request
>  {
> -	local branch upstream remote repo req_file url git_url suffix tag
> +	local branch upstream remote repo req_file url_list git_url suffix tag
>  
>  	branch=${1:?$usage}
>  	upstream=${2:?$usage}
> @@ -1679,8 +1708,8 @@ function dim_pull_request
>  		repo=$(branch_to_repo $branch)
>  	fi
>  
> -	url=${drm_tip_repos[$repo]}
> -	git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
> +	url_list=${drm_tip_repos[$repo]}
> +	git_url=$(url_to_git_url $url_list)
>  
>  	git request-pull $upstream $git_url $tag >> $req_file
>  	$DRY $DIM_MUA -s "[PULL] $branch" \
> @@ -1729,7 +1758,7 @@ function dim_list_branches
>  dim_alias_ub=update-branches
>  function dim_update_branches
>  {
> -	local repo remote
> +	local repo remote url_list
>  
>  	cd $DIM_PREFIX/$DIM_DRM_INTEL
>  
> @@ -1740,8 +1769,8 @@ function dim_update_branches
>  	fi
>  
>  	for repo in "${!drm_tip_repos[@]}"; do
> -		url=${drm_tip_repos[$repo]}
> -		if ! remote=$(url_to_remote $url 2>/dev/null); then
> +		url_list=${drm_tip_repos[$repo]}
> +		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
>  			continue
>  		fi
>  		echo -n "Fetching $repo (local remote $remote)... "

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos
  2017-10-03  6:15         ` Jani Nikula
@ 2017-10-03  8:01           ` Daniel Vetter
  2017-10-09 10:30           ` Jani Nikula
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Vetter @ 2017-10-03  8:01 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Daniel Vetter, Marek Szyprowski, dri-devel, Bartlomiej Zolnierkiewicz

On Tue, Oct 03, 2017 at 09:15:46AM +0300, Jani Nikula wrote:
> On Thu, 28 Sep 2017, Jani Nikula <jani.nikula@intel.com> wrote:
> > This lets us configure a space separated list of URLs for each repo in
> > drm_tip_repos, with all accepted protocols and sources, and the first
> > one found gets picked. This way we don't have to have a complicated set
> > of rules for converting between ssh, git and https protocol URLs.
> 
> I merged this last week with Daniel's IRC ack. We'll need to give people
> a little bit of time before updating nightly.conf. Sorry for the
> inconvenience in the mean time.
> 
> We should probably think about adding some real versioning to dim to be
> able to handle this kind of stuff more systematically.

We update dim in dim update-branches, and we complain about old dim. I
think a few days of update time is plenty enough, at least it seems to
have been for adding the drm-amd remote.
-Daniel

> 
> BR,
> Jani.
> 
> 
> 
> >
> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> >
> > ---
> >
> > !!! UNTESTED !!!
> > ---
> >  dim | 97 +++++++++++++++++++++++++++++++++++++++++++++------------------------
> >  1 file changed, 63 insertions(+), 34 deletions(-)
> >
> > diff --git a/dim b/dim
> > index c6c746cdb154..d2f165893161 100755
> > --- a/dim
> > +++ b/dim
> > @@ -255,44 +255,73 @@ fi
> >  # The below functions map between these.
> >  #
> >  
> > -function url_to_remote # url
> > +function url_to_remote # url [url ...]
> >  {
> >  	local url remote
> >  
> > -	url="$1"
> > -
> > -	if [[ -z "$url" ]]; then
> > -		echoerr "$0 without url"
> > +	if [[ "$#" = "0" ]]; then
> > +		echoerr "url_to_remote without URLs"
> >  		return 1
> >  	fi
> >  
> > -	remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
> > -
> > -	if [[ -z "$remote" ]]; then
> > -		git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
> > -		remote=$(git remote -v | grep -m 1 "$git_url" | cut -f 1)
> > +	for url; do
> > +		remote=$(git remote -v | grep -m 1 "$url" | cut -f 1)
> > +		if [[ -n "$remote" ]]; then
> > +			echo "$remote"
> > +			return 0
> > +		fi
> > +	done
> >  
> > -		if [[ -z "$remote" ]]; then
> > -			echoerr "No git remote for url $url or $git_url found in $(pwd)"
> > -			remote=${url%.git}
> > -			remote=${remote##*/}
> > -			read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true
> > -			if [[ "$REPLY" == "" ]] ; then
> > -				echoerr "Please set it up yourself using:"
> > -				echoerr "    $ git remote add <name> $url"
> > -				echoerr "with a name of your choice."
> > -				exit 1
> > -			fi
> > +	echoerr "No git remote for any of the URLs $* found in $(pwd)"
> >  
> > -			git remote add $remote $url
> > -		fi
> > +	url=$1
> > +	remote=${url%.git}
> > +	remote=${remote##*/}
> > +	read -r -i "$remote" -e -p "Enter a name to auto-add this remote, leave blank to abort: " || true
> > +	if [[ "$REPLY" == "" ]] ; then
> > +		echoerr "Please set it up yourself using:"
> > +		echoerr "    $ git remote add <name> $url"
> > +		echoerr "with a name of your choice."
> > +		exit 1
> >  	fi
> >  
> > +	git remote add $remote $url
> > +
> >  	echo $remote
> >  
> >  	return 0
> >  }
> >  
> > +function url_to_git_url # url [url ...]
> > +{
> > +	local url git_url
> > +
> > +	if [[ "$#" = "0" ]]; then
> > +		echoerr "url_to_git_url without URLs"
> > +		return 1
> > +	fi
> > +
> > +	# Find the git:// URL, converting from ssh:// URL as fallback
> > +	for url; do
> > +		case $url in
> > +			git://*)
> > +				git_url=$url
> > +				break
> > +				;;
> > +			ssh://*)
> > +				git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
> > +				;;
> > +		esac
> > +	done
> > +
> > +	if [[ -z "$git_url" ]]; then
> > +		echoerr "No git or ssh URL in any of the URLs $*"
> > +		return 1
> > +	fi
> > +
> > +	echo $git_url
> > +}
> > +
> >  function branch_to_remote # branch
> >  {
> >  	local branch remote
> > @@ -595,7 +624,7 @@ function commit_rerere_cache
> >  
> >  function dim_rebuild_tip
> >  {
> > -	local integration_branch specfile time first rerere repo url remote
> > +	local integration_branch specfile time first rerere repo url_list remote
> >  
> >  	integration_branch=drm-tip
> >  	specfile=$(mktemp)
> > @@ -627,8 +656,8 @@ function dim_rebuild_tip
> >  	echo "Done."
> >  
> >  	for repo in "${!drm_tip_repos[@]}"; do
> > -		url=${drm_tip_repos[$repo]}
> > -		remote=$(url_to_remote $url)
> > +		url_list=${drm_tip_repos[$repo]}
> > +		remote=$(url_to_remote $url_list)
> >  		echo -n "Fetching $repo (local remote $remote)... "
> >  		git_fetch_helper $remote
> >  		echo "Done."
> > @@ -639,8 +668,8 @@ function dim_rebuild_tip
> >  		local branch override sha1 fixup_file
> >  
> >  		read -r repo branch override <<< $conf
> > -		url=${drm_tip_repos[$repo]}
> > -		remote=$(url_to_remote $url)
> > +		url_list=${drm_tip_repos[$repo]}
> > +		remote=$(url_to_remote $url_list)
> >  		sha1=$remote/$branch
> >  
> >  		echo -n "Merging $repo (local remote $remote) $branch... "
> > @@ -1641,7 +1670,7 @@ function prep_pull_tag_summary
> >  # dim_pull_request branch upstream
> >  function dim_pull_request
> >  {
> > -	local branch upstream remote repo req_file url git_url suffix tag
> > +	local branch upstream remote repo req_file url_list git_url suffix tag
> >  
> >  	branch=${1:?$usage}
> >  	upstream=${2:?$usage}
> > @@ -1679,8 +1708,8 @@ function dim_pull_request
> >  		repo=$(branch_to_repo $branch)
> >  	fi
> >  
> > -	url=${drm_tip_repos[$repo]}
> > -	git_url=$(echo $url | sed -e 's/git\./anongit./' -e 's/ssh:/git:/')
> > +	url_list=${drm_tip_repos[$repo]}
> > +	git_url=$(url_to_git_url $url_list)
> >  
> >  	git request-pull $upstream $git_url $tag >> $req_file
> >  	$DRY $DIM_MUA -s "[PULL] $branch" \
> > @@ -1729,7 +1758,7 @@ function dim_list_branches
> >  dim_alias_ub=update-branches
> >  function dim_update_branches
> >  {
> > -	local repo remote
> > +	local repo remote url_list
> >  
> >  	cd $DIM_PREFIX/$DIM_DRM_INTEL
> >  
> > @@ -1740,8 +1769,8 @@ function dim_update_branches
> >  	fi
> >  
> >  	for repo in "${!drm_tip_repos[@]}"; do
> > -		url=${drm_tip_repos[$repo]}
> > -		if ! remote=$(url_to_remote $url 2>/dev/null); then
> > +		url_list=${drm_tip_repos[$repo]}
> > +		if ! remote=$(url_to_remote $url_list 2>/dev/null); then
> >  			continue
> >  		fi
> >  		echo -n "Fetching $repo (local remote $remote)... "
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos
  2017-10-03  6:15         ` Jani Nikula
  2017-10-03  8:01           ` Daniel Vetter
@ 2017-10-09 10:30           ` Jani Nikula
  2017-10-09 10:37             ` Daniel Stone
  2017-10-10  8:10             ` Andrzej Hajda
  1 sibling, 2 replies; 10+ messages in thread
From: Jani Nikula @ 2017-10-09 10:30 UTC (permalink / raw)
  To: Andrzej Hajda, dri-devel
  Cc: Daniel Vetter, Marek Szyprowski, Bartlomiej Zolnierkiewicz

On Tue, 03 Oct 2017, Jani Nikula <jani.nikula@intel.com> wrote:
> I merged this last week with Daniel's IRC ack. We'll need to give people
> a little bit of time before updating nightly.conf. Sorry for the
> inconvenience in the mean time.

Andrzej, all the bits and pieces for this have been pushed, so https://
should just work for all repos *except* Dave's drm tree. I don't know
why, but [1] doesn't advertize https for it.

BR,
Jani.


[1] https://cgit.freedesktop.org/~airlied/linux/

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos
  2017-10-09 10:30           ` Jani Nikula
@ 2017-10-09 10:37             ` Daniel Stone
  2017-10-11 19:22               ` Jani Nikula
  2017-10-10  8:10             ` Andrzej Hajda
  1 sibling, 1 reply; 10+ messages in thread
From: Daniel Stone @ 2017-10-09 10:37 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Bartlomiej Zolnierkiewicz, Daniel Vetter, dri-devel, Marek Szyprowski

Hey,

On 9 October 2017 at 11:30, Jani Nikula <jani.nikula@intel.com> wrote:
> On Tue, 03 Oct 2017, Jani Nikula <jani.nikula@intel.com> wrote:
>> I merged this last week with Daniel's IRC ack. We'll need to give people
>> a little bit of time before updating nightly.conf. Sorry for the
>> inconvenience in the mean time.
>
> Andrzej, all the bits and pieces for this have been pushed, so https://
> should just work for all repos *except* Dave's drm tree. I don't know
> why, but [1] doesn't advertize https for it.

Probably because it's not linked in from his public_html? He'd need to
do that, and also make sure that git-update-server-info was run in a
hook somewhere too.

Cheers,
Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos
  2017-10-09 10:30           ` Jani Nikula
  2017-10-09 10:37             ` Daniel Stone
@ 2017-10-10  8:10             ` Andrzej Hajda
  1 sibling, 0 replies; 10+ messages in thread
From: Andrzej Hajda @ 2017-10-10  8:10 UTC (permalink / raw)
  To: Jani Nikula, dri-devel
  Cc: Daniel Vetter, Marek Szyprowski, Bartlomiej Zolnierkiewicz

On 09.10.2017 12:30, Jani Nikula wrote:
> On Tue, 03 Oct 2017, Jani Nikula <jani.nikula@intel.com> wrote:
>> I merged this last week with Daniel's IRC ack. We'll need to give people
>> a little bit of time before updating nightly.conf. Sorry for the
>> inconvenience in the mean time.
> Andrzej, all the bits and pieces for this have been pushed, so https://
> should just work for all repos *except* Dave's drm tree. I don't know
> why, but [1] doesn't advertize https for it.
>
> BR,
> Jani.
>
>
> [1] https://cgit.freedesktop.org/~airlied/linux/
>
Sorry for late response, I have tested the code and it works, thanks.


Regards

Andrzej

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos
  2017-10-09 10:37             ` Daniel Stone
@ 2017-10-11 19:22               ` Jani Nikula
  0 siblings, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2017-10-11 19:22 UTC (permalink / raw)
  To: Daniel Stone
  Cc: Bartlomiej Zolnierkiewicz, Daniel Vetter, dri-devel, Marek Szyprowski

On Mon, 09 Oct 2017, Daniel Stone <daniel@fooishbar.org> wrote:
> Hey,
>
> On 9 October 2017 at 11:30, Jani Nikula <jani.nikula@intel.com> wrote:
>> On Tue, 03 Oct 2017, Jani Nikula <jani.nikula@intel.com> wrote:
>>> I merged this last week with Daniel's IRC ack. We'll need to give people
>>> a little bit of time before updating nightly.conf. Sorry for the
>>> inconvenience in the mean time.
>>
>> Andrzej, all the bits and pieces for this have been pushed, so https://
>> should just work for all repos *except* Dave's drm tree. I don't know
>> why, but [1] doesn't advertize https for it.
>
> Probably because it's not linked in from his public_html? He'd need to
> do that, and also make sure that git-update-server-info was run in a
> hook somewhere too.

Sorry, how do you do these two steps exactly? I tried looking around in
the docs, [1] is the closest I could find but nothing on https.

BR,
Jani.


[1] https://www.freedesktop.org/wiki/Infrastructure/git/RepositoryAdmin/
    

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-10-11 19:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170825113227eucas1p2beec67e2f2a805ccd34cf7bf71ed4ec1@eucas1p2.samsung.com>
2017-08-25 11:31 ` [maintainer-tools PATCH] dim: fix remote repository lookup function Andrzej Hajda
2017-09-27  9:58   ` Andrzej Hajda
2017-09-28 14:51     ` Jani Nikula
2017-09-28 14:51       ` [dim PATCH] dim: allow a space separated list of URLs for each repo in drm_tip_repos Jani Nikula
2017-10-03  6:15         ` Jani Nikula
2017-10-03  8:01           ` Daniel Vetter
2017-10-09 10:30           ` Jani Nikula
2017-10-09 10:37             ` Daniel Stone
2017-10-11 19:22               ` Jani Nikula
2017-10-10  8:10             ` Andrzej Hajda

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.