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