Subversion Repositories se3

Rev

Rev 6631 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6625 dbo 1
#!/bin/bash
2
#
3
## $Id: updatese3.sh 2271 2007-06-16 00:44:23Z keyser $ ##
4
#
5
##### Met a jour Se3 depuis le d�pot SVN #####
6
#
7
 
8
 
9
function usage {
10
        echo "usage: $0 -b branche -a archi -d distrib -v version [-n maj] [package]"
11
        echo "       -b :  choix de la branche (se3|se3testing|se3XP)"
12
        echo "       -a :  choix de l'architecture (i386|amd64)"       
13
        echo "       -d :  choix de la distrib (lenny|squeeze)"
14
        echo "       -v :  choix de la version (2.1|2.2)"
15
        exit $1;
16
}
17
 
18
while getopts ":hb:a:d:v:n:" cmd
19
do
20
        case $cmd in   
21
          b) BRANCHE=$OPTARG ;;
22
          a) ARCH=$OPTARG;;
23
          d) DISTRIB=$OPTARG;;
24
          v) VERSION=$OPTARG ;;
25
          n) MAJNB=$OPTARG ;;
26
          h) usage 0 ;;
27
          ?) echo "bad option!"
28
              usage 1 ;;
29
        esac
30
done
31
 
32
shift $(($OPTIND - 1))
33
 
34
if [ $# -eq "0" ]
35
then
36
  echo "compilation des modules :"
37
  liste_modules=$(svn list $url_branche | sed "s|/||g")
38
  echo "$liste_modules"
39
else
40
  liste_modules=$@
41
  echo "compilation de $@"
42
fi
43
 
44
if ( [ -z "$VERSION" ] || [ -z "$DISTRIB" ] || [ -z "$BRANCHE" ]  ); then
45
usage 1
46
fi
47
[ "$BRANCHE" == "xp" -o "$BRANCHE" == "se3xp" ] && BRANCHE="se3XP"
48
 
49
builddir=$(pwd)
50
mkdir -p debs
51
mkdir -p svn
52
 
53
svnurl="https://svn.ac-grenoble.fr/svn/se3"
54
repocmd="$builddir/debs/update_repo_${BRANCHE}.sh"
55
 
56
 
57
# chemin du depot debian sur le serveur
58
depot="/var/se3-2/repos/apt/debian"
59
# user
60
repouser="wawa"
61
 
62
[ -f "$repocmd" ] || echo "#!/bin/bash" > $repocmd
63
chmod u+x $repocmd
64
 
65
 
66
[ "$VERSION" == "2.1" ]  && url_branche="$svnurl/branches/$version"
67
[ "$VERSION" == "2.2" ] && url_branche="$svnurl/trunk"
68
 
69
 
70
# paquets debian sources ( versions avec dch ) ou DEBIAN
71
function compile {
72
  if [ "$1" == "se3master" ]; then
73
     module="se3"
74
  else
75
     module="$1"
76
  fi
77
  if [ -d "$builddir/svn/$module" ]; then          
78
     svn switch $url_branche/$1 $builddir/svn/$module
79
  else
80
     svn checkout $url_branche/$1 $builddir/svn/$module
81
  fi
82
  VERSION_MODULE=$VERSION.$(svn info $builddir/svn/$module | grep "R*vision de la der" | awk '{ print $NF }')
83
  echo $VERSION_MODULE
84
  mkdir -p $builddir/build
85
  cp -a $builddir/svn/$module/* $builddir/build
86
  cd $builddir/build
87
  find * -name .svn -exec rm -fr "{}" \; &>/dev/null  
88
  # commandes specifiques a un paquet ( a eviter si possible, modifier les sources !)
89
  [ -f "$builddir/buildscripts.d/$module" ] && . $builddir/buildscripts.d/$module
90
  #
91
  if [ -d DEBIAN ]; then
92
     sed -i "s/#VERSION#/$VERSION_MODULE/g" DEBIAN/control*
93
     find * -name .svn -exec rm -fr "{}" \; &>/dev/null
94
     deb="${module}_${VERSION_MODULE}_all.deb"
95
     dpkg-deb -b . ../$deb
96
     echo "reprepro -C $BRANCHE -b $depot includedeb $DISTRIB $module $deb" >> $repocmd
97
     mv ../$deb $builddir/debs
98
  elif [ -d sources/debian ]; then
99
     cd sources
100
     dh_clean
101
     debuild -uc -us -b
102
     cd ..
103
     pkg_name=$(ls *.deb | sed "s/.deb//;s/${module}_//")
104
     echo "reprepro -C $BRANCHE -b $depot includedeb $DISTRIB $module ${module}_${VERSION_MODULE}.${pkg_name}.deb" >> $repocmd
105
     mv ${module}_${pkg_name}.deb $builddir/debs/${module}_${VERSION_MODULE}.${pkg_name}.deb
106
 #    mv ${pkg_name}.changes $builddir/debs/$pkg_name.${VERSION_MODULE}.changes
107
  fi
108
  cd $builddir
109
  rm -fr $builddir/build
110
}
111
 
112
echo $liste_modules | while read package ;  do
113
    echo "compilation de $package pour la branche $BRANCHE version $VERSION distrib $DISTRIB"
114
    compile $package
115
done
116
 
117
 
118
exit 0