[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 4/6] osstest: introduce a helper to get the svn revision of a git commit



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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.