Code

Updated datepicker to position every time in dynamic layouts
[gosa.git] / gosa-core / contrib / make-gosa-package
index 8fa112606a853e9be1bb4b646f35230f8bab45ca..acb7c37a606147aa8678614a3d0c4db1de6b7df9 100755 (executable)
@@ -25,11 +25,18 @@ SECTION="web"
 SI_SECTION="utils"
 TARGET_RELEASE="etch"
 MAKE_PLUGINS=""
-NOT_RELEASED="heimdal dak dfs glpi opsi apache2 ssh"
+MAKE_GOTO=""
+GOTO=""
+PBUILDER=""
+NOT_RELEASED="heimdal dak dfs glpi apache2"
+GOTO_NOT_RELEASED="apache-directory-studio goto-cd libresourcepool-net-ldap-perl-1.002 libresourcepool-perl-1.0104 openproj ptc syslinux" 
+DEBIAN_PKG="remove"
+NO_SVN="use"
+EXTRACT=`pwd`
 
 usage() {
        cat <<-EOF
-       GOsa Debian package build tool. Build snapshots from selected SVN locations.
+       GOsa Debian package build tool. Build snapshots from selected SVN locations or local directories.
        Usage: ${0##*/} [options]
        
        Options:
@@ -40,7 +47,11 @@ usage() {
          -c|--changelog    Debian changelog entry [$RELEASE_REASON]
          -s|--section      Debian section to place GOsa in [$SECTION]
          -i|--si-section   Debian section to place GOsa-SI in [$SI_SECTION]
-          -d|--debian-pkg   Don't clear up debian packages for plugins (for developers only)
+         -d|--debian-pkg   Don't clear up debian packages for plugins (for developers only)
+         -n|--no-svn       Don't extract gosa from svn (when internet connectivity is not present)
+         -x|--extract-dir  Directory where the checkout is for no-svn
+         -g|--build-goto   Build the goto2 packages
+          -l|--use-pbuilder Use pbuilder to build the packages
          -h|--help         this help
 
        EOF
@@ -55,7 +66,7 @@ for cmd in dh-make-gosa debchange dpkg-buildpackage dpkg-source svn; do
 done
 
 # Import command line parameters
-PARMS=`getopt -o e::d::b:r:s:c:i:p:,h --long branch:,changelog:,plugins:,section:,si-section:,release:,help -n "${0##*/}" -- "$@"`
+PARMS=`getopt -o e::d::b:r:s:c:i:p:n:x:g::l::,h --long branch:,changelog:,plugins:,section:,si-section:,release:,help -n "${0##*/}" -- "$@"`
 eval set -- "$PARMS"
 
 while true; do
@@ -75,7 +86,15 @@ while true; do
                 -i|--si-section)
                        SI_SECTION=$2; shift 2 ;;
                 -d|--debian-pkg)
-                        DEBIAN_PKG=$2; shift 2 ;;
+                        DEBIAN_PKG=""; shift 2 ;;
+                -n|--no-svn)
+                        NO_SVN=""; shift 2;;
+                -x|--extract-dir)
+                        EXTRACT=$2; shift 2;;
+                -g|--build-goto)
+                        GOTO="use"; shift 2;;
+                -l|--use-pbuilder)
+                        PBUILDER="use"; shift 2;;
                 -h|--help)
                        usage ;;
                 --)
@@ -85,49 +104,121 @@ while true; do
         esac
 done
 
-echo "Loading svn information for '${BRANCH}'..."
-svn co -N https://oss.gonicus.de/repositories/gosa/${BRANCH} gosa-info/ > /dev/null
-BRANCH_REV=$(LANG=C svn info gosa-info | sed -n -e 's/^Last Changed Rev: \([0-9]*\).*$/\1/p')
-rm -rf gosa-info
+if [ "$NO_SVN" = "use" ]
+then
+       echo "Loading svn information for gosa '${BRANCH}'..."
+       svn co -N https://oss.gonicus.de/repositories/gosa/${BRANCH} gosa-info/ > /dev/null
+       BRANCH_REV=$(LANG=C svn info gosa-info | sed -n -e 's/^Last Changed Rev: \([0-9]*\).*$/\1/p')
+       rm -rf gosa-info
+
+        echo "Loading svn information for goto '${BRANCH}'..."
+        svn co -N https://oss.gonicus.de/repositories/goto/${BRANCH} goto-info/ > /dev/null
+        GOTO_BRANCH_REV=$(LANG=C svn info goto-info | sed -n -e 's/^Last Changed Rev: \([0-9]*\).*$/\1/p')
+        rm -rf goto-info
+
+else
+        echo "Loading svn information for gosa '${BRANCH}' from local checkout ..."
+       BRANCH_REV=$(LANG=C svn info $EXTRACT/gosa-core | sed -n -e 's/^Last Changed Rev: \([0-9]*\).*$/\1/p')
+
+       if [ "$GOTO" = "use" ]
+       then
+               echo "Loading svn information for goto '${BRANCH}' from local checkout ..."
+               GOTO_BRANCH_REV=$(LANG=C svn info $EXTRACT/goto | sed -n -e 's/^Last Changed Rev: \([0-9]*\).*$/\1/p')
+       fi
+fi
+
+if [ "$NO_SVN" = "use" ]
+then
+       # Load current revision from logs
+       VERSION=$(svn cat -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-core/debian/changelog \
+               | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p')
+       if [ "$BRANCH" == "trunk" ]; then
+               GOSA_VER="${VERSION}+svn${BRANCH_REV}"
+       else
+               GOSA_VER="${VERSION}"
+       fi
 
-# Load current revision from logs
-VERSION=$(svn cat -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-core/debian/changelog \
-       | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p')
-if [ "$BRANCH" == "trunk" ]; then
-       GOSA_VER="${VERSION}+svn${BRANCH_REV}"
 else
-       GOSA_VER="${VERSION}"
+        # Load current revision from logs
+       VERSION=$(cat $EXTRACT/gosa-core/debian/changelog | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p')
+
+        if [ "$BRANCH" == "trunk" ]; then
+                GOSA_VER="${VERSION}+svn${BRANCH_REV}"
+        else
+                GOSA_VER="${VERSION}"
+        fi
+       echo $GOSA_VER
 fi
+
 GOSA_DIR="gosa-${GOSA_VER}"
 
 ORIG_FILE="gosa_${GOSA_VER}.orig.tar.gz"
 
-# Export from svn...
-BNAME=$(basename $BRANCH)
-[ -d "gosa-${BNAME}" ] && rm -rf gosa-$BNAME
-echo "Exporting current GOsa (rev: ${BRANCH_REV}) from '${BRANCH}'..."
-svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-core gosa-${BNAME} > /dev/null
-svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-si gosa-si-${BNAME} > /dev/null
-svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-plugins gosa-plugins-${BNAME} > /dev/null
-
-VERSION=$(cat "gosa-${BNAME}/debian/changelog" | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p')
-if [ "$BRANCH" == "trunk" ]; then
-       GOSA_VER="${VERSION}+svn${BRANCH_REV}"
+if [ "$NO_SVN" = "use" ]
+then
+       # Export from svn...
+       BNAME=$(basename $BRANCH)
+       [ -d "gosa-${BNAME}" ] && rm -rf gosa-$BNAME
+       echo "Exporting current GOsa (rev: ${BRANCH_REV}) from '${BRANCH}'..."
+       svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-core gosa-${BNAME} > /dev/null
+       svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-si gosa-si-${BNAME} > /dev/null
+       svn export -r "${BRANCH_REV}" https://oss.gonicus.de/repositories/gosa/${BRANCH}/gosa-plugins gosa-plugins-${BNAME} > /dev/null
+
+        if [ "$GOTO" = "use" ]
+        then
+               echo "Exporting current GOto (rev: ${GOTO_BRANCH_REV}) from '${BRANCH}'..."
+               svn export -r "${GOTO_BRANCH_REV}" https://oss.gonicus.de/repositories/goto/${BRANCH}/ goto-${BNAME} > /dev/null
+       fi
 else
-       GOSA_VER="${VERSION}"
+        # Export from local checkout...
+        echo "Exporting current GOsa (rev: ${BRANCH_REV}) from localcheckout '${BRANCH}'..."
+       BNAME=$(basename $BRANCH)
+       cp -r gosa-core gosa-${GOSA_VER}
+       mv gosa-si gosa-si-${GOSA_VER}
+       mv gosa-plugins gosa-plugins-${BNAME}
+
+        if [ "$GOTO" = "use" ]
+        then
+               echo "Exporting current GOto (rev: ${GOTO_BRANCH_REV}) from localcheckout '${BRANCH}'..."
+               BNAME=$(basename $BRANCH)
+               mv goto goto-${BNAME}
+       fi
+fi
+
+if [ "$NO_SVN" = "use" ]
+then
+        VERSION=$(cat "gosa-${BNAME}/debian/changelog" | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p')
 fi
+
 GOSA_DIR="gosa-${GOSA_VER}"
 GOSA_SI_DIR="gosa-si-${GOSA_VER}"
+GOTO_DIR="goto-${BNAME}"
+
+if [ "$NO_SVN" = "use" ]
+then
+       if [ "$BNAME" != "$GOSA_VER" ]
+       then
+               rm -rf "gosa-${GOSA_VER}"
+       fi
+fi
 
-if [ "$BNAME" != "$GOSA_VER" ]
+if [ "$NO_SVN" = "use" ]
 then
-       rm -rf "gosa-${GOSA_VER}"
+       if [ "$BNAME" != "$GOSA_VER" ]
+       then
+               mv "gosa-${BNAME}" "gosa-${GOSA_VER}"
+               mv "gosa-si-${BNAME}" "gosa-si-${GOSA_VER}"
+       fi
 fi
 
-if [ "$BNAME" != "$GOSA_VER" ]
+echo "cleaning svn entries from sources"
+find ${GOSA_DIR} -type d -name ".svn" -exec rm -rf {} \; >/dev/null 2>&1
+find ${GOSA_SI_DIR} -type d -name ".svn" -exec rm -rf {} \; >/dev/null 2>&1
+find gosa-plugins-${BNAME} -type d -name ".svn" -exec rm -rf {} \; >/dev/null 2>&1
+
+if [ "$GOTO" = "use" ]
 then
-       mv "gosa-${BNAME}" "gosa-${GOSA_VER}"
-       mv "gosa-si-${BNAME}" "gosa-si-${GOSA_VER}"
+       find goto-${BNAME} -type d -name ".svn" -exec rm -rf {} \; >/dev/null 2>&1
 fi
 
 echo "Creating original sources 'gosa-${GOSA_VER}'..."
@@ -145,9 +236,13 @@ if [ -z "$MAKE_PLUGINS" ]; then
                MAKE_PLUGINS=$(echo -n $MAKE_PLUGINS | sed "s/$i//")
        done
 fi
+
 for plugin in $MAKE_PLUGINS; do
 
        GOSA_PLUG_DIR="gosa-plugin-$plugin-${GOSA_VER}"
+
+       echo "gosa plugin dir" $GOSA_PLUG_DIR
+
        mv "gosa-plugins-${BNAME}/$plugin" .
 
        echo "Debianizing plugin $plugin"
@@ -163,6 +258,21 @@ done
 
 rm -rf gosa-plugins-${BNAME}
 
+if [ "$GOTO" = "use" ]
+then
+        MAKE_GOTO=$(ls -1 goto-${BNAME}/)
+
+        for i in $GOTO_NOT_RELEASED; do
+                MAKE_GOTO=$(echo -n $MAKE_GOTO | sed "s/$i//")
+        done
+
+       for goto in $MAKE_GOTO; do
+               mv "goto-${BNAME}/$goto" .
+       done
+
+       rm -rf goto-${BNAME}
+fi
+
 echo "Deploying patches..."
 for patch in $(find patches -type f | grep -v .svn); do
 
@@ -178,13 +288,21 @@ for patch in $(find patches -type f | grep -v .svn); do
        fi
 done
 
-# Passe section im GOsa_DIR an
+# Put section in GOsa_DIR
 sed -i "s#^Section: web#Section: $SECTION#g" ${GOSA_DIR}/debian/control
 sed -i "s#^Section: utils#Section: $SI_SECTION#g" ${GOSA_SI_DIR}/debian/control
 
 for plugin in $MAKE_PLUGINS; do
        GOSA_PLUGIN_DIRS="$GOSA_PLUGIN_DIRS gosa-plugin-$plugin-${GOSA_VER}"
 done
+
+if [ "$GOTO" = "use" ]
+then
+       for goto in $MAKE_GOTO; do
+               GOTO_DIRS="$GOTO_DIRS $goto"
+       done
+fi
+
 for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
        echo "Adapting version in $dir"
        if [ "$TARGET_RELEASE" == "unstable" ]; then
@@ -206,23 +324,63 @@ then
        for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
                dpkg-source -b "$dir"
        done
+
+        if [ "$GOTO" = "use" ]
+        then
+               echo "Creating GOto sources..."
+               for dir in $GOTO_DIRS; do
+                       dpkg-source -b "$dir"
+               done
+       fi
 else
        echo "Creating debian packages..."
+       echo $PBUILDER
+
        for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
+       if [ "$PBUILDER" = "use" ]
+       then
+               echo "using pbuilder"
+               (cd "$dir"; pdebuild)
+       else
                (cd "$dir"; dpkg-buildpackage -k$DEBSIGN_KEYID -rfakeroot -sa)
+       fi
        done
+
+        if [ "$GOTO" = "use" ]
+        then
+               echo "Creating GOto debian packages..."
+               for dir in $GOTO_DIRS; do
+               if [ "$PBUILDER" = "use" ]
+               then
+                       echo "using pbuilder to build goto debian packages"
+                       (cd "$dir"; pdebuild)
+               else
+                       (cd "$dir"; dpkg-buildpackage -k$DEBSIGN_KEYID -rfakeroot -sa)
+               fi
+               done
+       fi
 fi
 
 echo "Removing gosa snapshot..."
 if [ -z "$DEBIAN_PKG" ]
 then
-       for dir in $GOSA_DIR; do
-        rm -rf "$dir"
-       done
+       if [ "$NO_SVN" = "use" ]
+       then
+               for dir in $GOSA_DIR; do
+               rm -rf "$dir"
+               done
+       fi
 else
        for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
        rm -rf "$dir"
        done
+
+        if [ "$GOTO" = "use" ]
+        then
+               for dir in $GOTO_DIRs; do
+               rm -rf "$dir"
+               done
+       fi
 fi