461b4f135087b0b1c8986b075a2fdde73c9a99a3
1 #!/bin/sh
3 # TODO: getopts ###########################################################
4 RELEASE_REASON="GOsa svn snapshot"
5 BRANCH="trunk"
6 SECTION="web"
7 SI_SECTION="utils"
8 TARGET_RELEASE="etch"
9 MAKE_PLUGINS=""
10 ###########################################################################
12 [ $BRANCH = "trunk" ] || BRANCH="branches/$BRANCH"
13 echo "Loading svn information for '${BRANCH}'..."
14 svn co -N https://oss.gonicus.de/repositories/gosa/${BRANCH} gosa-info/ > /dev/null
15 BRANCH_REV=$(LANG=C svn info gosa-info | sed -n -e 's/^Last Changed Rev: \([0-9]*\).*$/\1/p')
16 rm -rf gosa-info
18 # Load current revision from logs
19 VERSION=$(svn cat -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-core/debian/changelog \
20 | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p')
21 GOSA_VER="${VERSION}+svn${BRANCH_REV}"
22 GOSA_DIR="gosa-${GOSA_VER}"
24 ORIG_FILE="gosa_${GOSA_VER}.orig.tar.gz"
26 # Export from svn...
27 [ -d "gosa-${BRANCH}" ] && rm -rf gosa-$BRANCH
28 echo "Exporting current GOsa (rev: ${BRANCH_REV}) from '${BRANCH}'..."
29 svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-core gosa-${BRANCH} > /dev/null
30 svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-si gosa-si-${BRANCH} > /dev/null
31 svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-plugins gosa-plugins-${BRANCH} > /dev/null
33 VERSION=$(cat "gosa-${BRANCH}/debian/changelog" | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p')
34 GOSA_VER="${VERSION}+svn${BRANCH_REV}"
35 GOSA_DIR="gosa-${GOSA_VER}"
36 GOSA_SI_DIR="gosa-si-${GOSA_VER}"
38 if [ -d "gosa-${GOSA_VER}" ]
39 then
40 rm -rf "gosa-${GOSA_VER}"
41 fi
42 mv "gosa-${BRANCH}" "gosa-${GOSA_VER}"
43 mv "gosa-si-${BRANCH}" "gosa-si-${GOSA_VER}"
45 echo "Creating original sources 'gosa-${GOSA_VER}'..."
46 tar -c -f "gosa_${GOSA_VER}.orig.tar" "${GOSA_DIR}"
47 tar -c -f "gosa-si_${GOSA_VER}.orig.tar" "${GOSA_SI_DIR}"
49 echo "Compressing sources..."
50 gzip -9 "gosa_${GOSA_VER}.orig.tar"
51 gzip -9 "gosa-si_${GOSA_VER}.orig.tar"
53 export OVERRIDE_VERSION="$GOSA_VER"
54 if [ -z "$MAKE_PLUGINS" ]; then
55 MAKE_PLUGINS=$(ls -1 gosa-plugins-${BRANCH}/*/plugin.dsc | sed 's/^.*\/\([^\/]*\)\/plugin.dsc$/\1/')
56 fi
57 for plugin in $MAKE_PLUGINS; do
59 GOSA_PLUG_DIR="gosa-plugin-$plugin-${GOSA_VER}"
60 mv "gosa-plugins-${BRANCH}/$plugin" .
62 echo "Debianizing plugin $plugin"
63 yes | dh-make-gosa --section web $plugin
64 rm -rf "$plugin"
66 echo "Packing original sources 'gosa-plugin-$plugin-${GOSA_VER}'..."
67 tar -c -f "gosa-plugin-${plugin}_${GOSA_VER}.orig.tar" "${GOSA_PLUG_DIR}"
69 echo "Compressing sources..."
70 gzip -9 "gosa-plugin-${plugin}_${GOSA_VER}.orig.tar"
71 done
73 rm -rf gosa-plugins-${BRANCH}
75 echo "Deploying patches..."
76 for patch in $(find patches -type f | grep -v .svn); do
78 if echo $patch | grep -q gosa-plugin; then
79 plugin=$(echo $patch | sed 's/^.*gosa-plugin-\([^-]*\).*$/\1/g')
80 echo "* gosa-plugin-$plugin patch: $patch"
81 [ -d "gosa-plugin-${plugin}-${GOSA_VER}/debian/patches" ] || mkdir -p "gosa-plugin-${plugin}-${GOSA_VER}/debian/patches"
82 cp "$patch" gosa-plugin-${plugin}-${GOSA_VER}/debian/patches
83 else
84 echo "* gosa-core patch: $patch"
85 [ -d "${GOSA_DIR}/debian/patches" ] && mkdir -p "${GOSA_DIR}/debian/patches"
86 cp "$patch" ${GOSA_DIR}/debian/patches
87 fi
88 done
90 # Passe section im GOsa_DIR an
91 sed -i "s#^Section: web#Section: $SECTION#g" ${GOSA_DIR}/debian/control
92 sed -i "s#^Section: utils#Section: $SI_SECTION#g" ${GOSA_SI_DIR}/debian/control
94 for plugin in $MAKE_PLUGINS; do
95 GOSA_PLUGIN_DIRS="$GOSA_PLUGIN_DIRS gosa-plugin-$plugin-${GOSA_VER}"
96 done
97 for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
98 echo "Adapting version in $dir"
99 (cd "$dir"; echo | debchange -v "${GOSA_VER}-1${TARGET_RELEASE}1" -D "$TARGET_RELEASE" "$RELEASE_REASON" &> /dev/null)
100 [ -d $dir/debian/patches ] || continue
101 echo "Creating patch list for $dir"
102 ls -1 $dir/debian/patches | grep -v 00list | sed 's%^.*/%%g' > $dir/debian/patches/00list
103 done
105 # Update revision
106 sed -i "s/^\$svn_revision = .*$/\$svn_revision = '\$Revision: $BRANCH_REV \$';/g" $GOSA_DIR/include/functions.inc
108 if [ "$1" = "-s" ]
109 then
110 echo "Creating debian sources..."
111 for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
112 dpkg-source -b "$dir"
113 done
114 else
115 echo "Creating debian packages..."
116 for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
117 (cd "$dir"; dpkg-buildpackage -k$DEBSIGN_KEYID -rfakeroot -sa)
118 done
119 fi
121 echo "Removing gosa snapshot..."
122 #for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
123 # rm -rf "$dir"
124 #done
126 echo
127 echo "Moving result to 'dest'"
128 [ -d dest ] && rm -rf dest
129 mkdir dest
131 mv *.deb *.changes *.dsc *.gz dest/