Subject: [tryton] Re: tryton-dev script

From: Cédric Krier <[email-masked]>
Date: Fri, 21 Nov 2008 10:42:21 +0100

On 21/11/08 10:24 +0100, Hartmut Goebel wrote:
> Dan Horák schrieb:
>> Hartmut Goebel píše v Pá 21. 11. 2008 v 09:52 +0100:
>
>>> - does not handle current diractory
>>> - should be renamed into something like "tryton-cloner.sh", since it
>>>    does not only only handle development and used 'hg clone'
>> Yes, it is really useful, but I have modified it to clone only the
>> modules when "-m" is passed on the command line, see the attached patch.
>
> Enclosed please find a version including my suggestions, Dan's '-m' and 
> some ugly-code-removal ;-)
>
> Still missing: pull+update
> But the later can easily added by using the forest extension.
>

Ok, I put a new version with your suggestions.
I added a -u option to update all the repositories and I add also
hgforest.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: [email-masked]
Jabber: [email-masked]
Website: http://www.b2ck.com/

---

From: Hartmut Goebel <[email-masked]>
Date: Fri, 21 Nov 2008 10:24:22 +0100

-- 
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP

Goebel Consult
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de
#!/bin/sh

HG='hg'
WEBSITE="http://hg.tryton.org/"

DIRECTORY=$(pwd)
BRANCH=
ONLYMODULES=

while getopts 'd:b:mh' OPTION ; do
    case $OPTION in
        d) DIRECTORY=${OPTARG};;
        b) BRANCH=${OPTARG}/;;
        m) ONLYMODULES=yes;;
        ?) echo >&2 "Usage: $(basename $0) [-d directory] [-b branch] [-m]"
        exit 2;;
    esac
done

[ -d "$DIRECTORY" ] || mkdir -p "$DIRECTORY"

if [ -z $ONLYMODULES ] ; then
    echo "Cloning tryton into $DIRECTORY"
    $HG clone $WEBSITE${BRANCH}tryton "$DIRECTORY"/tryton
    if [ $? -ne 0 ]; then
	echo >&2 "Cloning tryton failed!"
	exit 2
    fi

    echo "Cloning trytond into $DIRECTORY"
    $HG clone $WEBSITE${BRANCH}trytond "$DIRECTORY"/trytond
    if [ $? -ne 0 ]; then
	echo >&2 "Cloning trytond failed!"
	exit 2
    fi
elif [ ! -d "$DIRECTORY"/trytond/trytond/modules ] ; then
    mkdir -p "$DIRECTORY"/trytond/trytond/modules
fi

wget -q ${WEBSITE}${BRANCH}/modules -O - \
| sed 's!</a>!\n</a>!g' | sed 's/.*>//' \
| grep -v -E '(Atom|RSS|Name|Description|Contact|Last change|^$)' \
| while read module ; do
    echo "Clone module $module into $DIRECTORY/trytond/trytond/modules/"
    $HG clone $WEBSITE${BRANCH}modules/"$module" "$DIRECTORY"/trytond/trytond/modules/"$module"
    if [ $? -ne 0 ]; then
	echo >&2 "Cloning module $module trytond failed!"
        exit 2
    fi
done

---

From: Dan Horák <[email-masked]>
Date: Fri, 21 Nov 2008 10:07:19 +0100

Hartmut Goebel píše v Pá 21. 11. 2008 v 09:52 +0100:
> Cédric Krier schrieb:
> 
> > http://www.b2ck.com/~ced/tryton-dev.sh
> 
> Wow, this is good!
> 
> Some remarks:
> - errors if exists

it could be modified to do clone or pull+update :-)

> - should add support for hg-forest
> 
> Okay, I'll stop the which list for now ;-)
> 

		Dan

--~--~---------~--~----~------------~-------~--~----~
[email-masked] mailing list
-~----------~----~----~----~------~----~------~--~---

--- tryton-dev.sh.orig	2008-11-21 10:01:43.000000000 +0100
+++ tryton-dev.sh	2008-11-21 10:04:05.000000000 +0100
@@ -4,18 +4,21 @@ WEBSITE="http://hg.tryton.org/"
 
 DIRECTORY=`pwd`
 BRANCH=
-while getopts 'd:b:h' OPTION
+ONLYMODULES=
+while getopts 'd:b:mh' OPTION
 do
     case $OPTION in
         d) DIRECTORY=${OPTARG};;
         b) BRANCH=${OPTARG}/;;
-        ?) printf "Usage: %s: [-d directory] [-b branch]\n" $(basename $0) >&2
+        m) ONLYMODULES=yes;;
+        ?) printf "Usage: %s: [-d directory] [-b branch] [-m]\n" $(basename $0) >&2
         exit 2;;
     esac
 done
 
 mkdir -p ${DIRECTORY}
 
+if [ -z $ONLYMODULES ]; then
 printf "Clone tryton into %s\n" ${DIRECTORY}/
 ${HG} clone ${WEBSITE}${BRANCH}tryton ${DIRECTORY}/tryton
 if [ $? -ne 0 ]; then
@@ -29,6 +32,7 @@ if [ $? -ne 0 ]; then
     printf "Clone trytond failed!\n" >&2
     exit 2
 fi
+fi
 
 for module in `wget -q ${WEBSITE}${BRANCH}/modules -O -|sed 's/<\/a>/\n<\/a>/g'|sed 's/.*>//'|grep -v -E '(Atom|RSS|Name|Description|Contact|Last change|^$)'`; do
     printf "Clone module %s into %s\n" ${module} ${DIRECTORY}/trytond/trytond/modules/

---

From: Hartmut Goebel <[email-masked]>
Date: Fri, 21 Nov 2008 09:54:30 +0100

> - errors if exists

Should have been "if directory exists", but I overlooked a line, so this 
is not a problem.

Goebel Consult

---

From: Hartmut Goebel <[email-masked]>
Date: Fri, 21 Nov 2008 09:52:44 +0100

Wow, this is good!

Some remarks:

Goebel Consult

---

From: Cédric Krier <[email-masked]>
Date: Thu, 20 Nov 2008 23:53:45 +0100

Hi,

I wrote a little script to extract tryton (server, client) and all
modules from one branch in oneshot.
The script is stored here:

It takes two args:

-d directory: for the directory where to extract the repositories
-b branch: to specify which branch (like 1.0) to extract, if not set it
    will take the developement.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59