xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH 4/6] osstest: introduce a helper to get the svn revision of a git commit
Date: Wed, 20 Feb 2019 17:59:59 +0100	[thread overview]
Message-ID: <20190220170001.32614-5-roger.pau@citrix.com> (raw)
In-Reply-To: <20190220170001.32614-1-roger.pau@citrix.com>

This only works when the svn revision is stored as a git note
with the format 'revision=<revision number>'.

Such conversion is required in order to bootstrap a FreeBSD system
without relying on external package repositories. FreeBSD base system
only contains a subversion client (no git client), and thus in order
to fetch the ports repository (that contain the external packages
build makefiles) svn must be used.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 cri-common | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/cri-common b/cri-common
index 8d2d26cf..2655a9ac 100644
--- a/cri-common
+++ b/cri-common
@@ -38,12 +38,10 @@ besteffort_repo () {
 	cached_repo "$1" '[fetch=try]'
 }
 
-repo_tree_rev_fetch_git () {
-	local treename=$1
-	local remoteurl=$2
-	local remotetag=$3
-	local localtag=$4
+repo_get_realurl () {
+	local remoteurl=$1
 	local proxy=`getconfig GitCacheProxy`
+
 	case $remoteurl in
 	$proxy*)
 		local realurl="$remoteurl" ;;
@@ -52,14 +50,35 @@ repo_tree_rev_fetch_git () {
 	*)
 		local realurl="$remoteurl" ;;
 	esac
-	if ! test -d $repos/$treename; then
-	        git clone --bare $realurl $repos/$treename >&2
-	fi
+
+	echo $realurl
+}
+
+repo_tree_rev_fetch_git () {
+	local treename=$1
+	local remoteurl=$2
+	local remotetag=$3
+	local localtag=$4
+	local realurl=`repo_get_realurl $remoteurl`
+
 	cd $repos/$treename
 	git fetch -f $realurl $remotetag:$localtag >&2
 	git rev-parse $localtag^0
 }
 
+repo_tree_git2svn_rev () {
+	local treename=$1
+	local remoteurl=$2
+	local gitrev=$3
+	local realurl=`repo_get_realurl $remoteurl`
+
+	cd $repos/$treename
+	git fetch -f $realurl refs/notes/commits:refs/notes/commits >&2
+	git notes show $gitrev | \
+		sed -n 's/^.*revision=\([0-9][0-9]*\).*$/\1/p'
+}
+
+
 select_prevxenbranch () {
 	prevxenbranch=`./cri-getprevxenbranch $xenbranch`
 }
-- 
2.17.2 (Apple Git-113)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-02-20 17:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 16:59 [PATCH 0/6] osstest: create a local binary FreeBSD package repository Roger Pau Monne
2019-02-20 16:59 ` [PATCH 1/6] osstest: introduce a helper to stash a whole directory Roger Pau Monne
2019-05-23  9:48   ` Ian Jackson
2019-05-23  9:48     ` [Xen-devel] " Ian Jackson
2019-05-24  9:42     ` Roger Pau Monné
2019-05-24  9:42       ` [Xen-devel] " Roger Pau Monné
2019-02-20 16:59 ` [PATCH 2/6] osstest: introduce a helper to create a weblink to a directory Roger Pau Monne
2019-05-23  9:57   ` Ian Jackson
2019-05-23  9:57     ` [Xen-devel] " Ian Jackson
2019-02-20 16:59 ` [PATCH 3/6] osstest: allow to perform multiple anoints in the same transaction Roger Pau Monne
2019-05-23 10:00   ` Ian Jackson
2019-05-23 10:00     ` [Xen-devel] " Ian Jackson
2019-02-20 16:59 ` Roger Pau Monne [this message]
2019-05-23 10:03   ` [PATCH 4/6] osstest: introduce a helper to get the svn revision of a git commit Ian Jackson
2019-05-23 10:03     ` [Xen-devel] " Ian Jackson
2019-05-24  9:57     ` Roger Pau Monné
2019-05-24  9:57       ` [Xen-devel] " Roger Pau Monné
2019-05-24 10:35       ` Ian Jackson
2019-05-24 10:35         ` [Xen-devel] " Ian Jackson
2019-02-20 17:00 ` [PATCH 5/6] osstest: introduce a script to build a FreeBSD package repository Roger Pau Monne
2019-05-23 10:19   ` Ian Jackson
2019-05-23 10:19     ` [Xen-devel] " Ian Jackson
2019-05-23 10:38   ` Ian Jackson
2019-05-23 10:38     ` [Xen-devel] " Ian Jackson
2019-05-24 10:13     ` Roger Pau Monné
2019-05-24 10:13       ` [Xen-devel] " Roger Pau Monné
2019-05-24 11:21       ` Ian Jackson
2019-05-24 11:21         ` [Xen-devel] " Ian Jackson
2019-02-20 17:00 ` [PATCH 6/6] osstest: use a locally built pkg repository for FreeBSD Roger Pau Monne
2019-05-23 11:06   ` Ian Jackson
2019-05-23 11:06     ` [Xen-devel] " Ian Jackson
2019-05-24 10:45     ` Roger Pau Monné
2019-05-24 10:45       ` [Xen-devel] " Roger Pau Monné
2019-05-24 17:26       ` Ian Jackson
2019-05-24 17:26         ` [Xen-devel] " Ian Jackson

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=20190220170001.32614-5-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).