[Xcb] Are the util-common-m4 submodules relative on purpose?

Dirk Wallenstein halsmit at t-online.de
Wed Apr 6 10:10:35 PDT 2011


On Thu, Mar 24, 2011 at 09:49:54AM +0100, Dirk Wallenstein wrote:
> On Thu, Mar 24, 2011 at 12:52:49AM +0100, Arnaud Fontaine wrote:
> > Hi,
> > 
> >     > Hi, I mean this in .gitmodules:
> >     >     [submodule "m4"]
> >     >         path = m4
> >     >         url = ../util-common-m4.git
> > 
> >     > instead of:
> >     >     [submodule "m4"] 
> >     >         path = m4
> >     >         url = git://anongit.freedesktop.org/xcb/util-common-m4 
> > 
> > Yes, it  is relative  on purpose.  There  are several reasons  for this,
> > such as  being easier  for developers  (you may want  to write  code for
> > util-common-m4 and test it in util-wm or publish your own util-common-m4
> > somewhere along with util, without modifying .gitsubmodules) and you may
> > not want to use git protocol.
> 
> First off, I was (a bit erratically) thinking about that, but I dropped
> it because it would require users to always use a local mirror to work
> out of the box.  And even then they would always have to push into the
> mirror, so it is more complex after all.
> 
> .gitsubmodules just specifies the starting point for cloners.  If the
> need to change and test util-common-m4 they simply redirect the remote
> URL of the submodule (in m4/.git/config) to a local repo.  A relative
> URL in .gitmodules does not change anything about that.
> If someone wants to use a modified util-common-m4, I think it's best to
> record that in a commit and in .gitmodules.

I've added a section to the wiki here [1].  Attached is a x-jhbuild
plug-in to adapt the submodules in one call.

[1] http://wiki.x.org/wiki/ModularDevelopersGuide#Usingalocalcloneofasubmodule

-- 
Cheers,
  Dirk
-------------- next part --------------
#!/bin/sh

NEW_SUBMODULE_LOCATION="$1"
PLUGIN_NAME=`basename "$0"`

XCB_SUBMODULE_USERS="xcb-util xcb-util-image xcb-util-keysyms xcb-util-renderutil xcb-util-wm"
XCB_M4_SUBMODULE_NAME="xcb-util-common-m4"

error() {
    echo "ERROR ($PLUGIN_NAME): $@" >&2
    exit 1
}


usage() {
    cat << EOU
Sub-Command Usage : $PLUGIN_NAME

Redirect the m4 submodule of the repositories "$XCB_SUBMODULE_USERS" to
$XCB_M4_SUBMODULE_NAME of this repository group.  All those repositories should
be checked out already.  That can be done with the command:
  $ xjh update xcb-util-all
EOU
}

case "$1" in
    -h|--help)
        usage
        exit 0
        ;;
esac

m4_submodule_path=`xjh --callback modinfo --one -f dir "$XCB_M4_SUBMODULE_NAME"`
[ $? -eq 0 ] || error "Could not obtain path to $XCB_M4_SUBMODULE_NAME"

for dir in `xjh --callback modinfo --one  -f dir $XCB_SUBMODULE_USERS` ; do
    m4_dir="$dir/m4"
    cd "$m4_dir" || error "cd to $m4_dir failed"
    git config remote.origin.url "$m4_submodule_path"
    echo -n "$m4_dir => "
    git config remote.origin.url
done


More information about the Xcb mailing list