From ba608b2721c758e421646ddce96b4607f4338e4d Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 20 Feb 2009 16:05:55 +0000 Subject: [PATCH] Updated redhat build script git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13436 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/redhat/02_fix_class_mapping.patch | 34 ++--- gosa-core/redhat/make-gosa-package | 159 ++++++++++++++++---- gosa-core/redhat/rpm-make-gosa | 50 +++--- 3 files changed, 174 insertions(+), 69 deletions(-) diff --git a/gosa-core/redhat/02_fix_class_mapping.patch b/gosa-core/redhat/02_fix_class_mapping.patch index 7fb379c05..432dcf020 100644 --- a/gosa-core/redhat/02_fix_class_mapping.patch +++ b/gosa-core/redhat/02_fix_class_mapping.patch @@ -1,20 +1,3 @@ ---- gosa-core~/include/class_config.inc 2009-02-16 14:19:18.000000000 +0100 -+++ gosa-core/include/class_config.inc 2009-02-16 14:18:15.000000000 +0100 -@@ -76,12 +76,12 @@ - if we have installed or removed plugins. - */ - if(session::global_is_set("class_location.inc:timestamp")){ -- $tmp = stat("../include/class_location.inc"); -+ $tmp = stat("/var/cache/gosa/class.cache"); - if($tmp['mtime'] != session::global_get("class_location.inc:timestamp")){ - session::global_un_set("plist"); - } - } -- $tmp = stat("../include/class_location.inc"); -+ $tmp = stat("/var/cache/gosa/class.cache"); - session::global_set("class_location.inc:timestamp",$tmp['mtime']); - - if($this->filename != "" && filemtime($this->filename) != $this->last_modified){ --- gosa-core~/include/functions.inc 2009-02-16 14:19:18.000000000 +0100 +++ gosa-core/include/functions.inc 2009-02-16 14:18:15.000000000 +0100 @@ -73,7 +73,7 @@ @@ -48,3 +31,20 @@ /* Sanity checks */ if (!file_exists($filename) || is_writable($filename)) { +--- gosa-core~/include/class_config.inc 2009-02-16 14:19:18.000000000 +0100 ++++ gosa-core/include/class_config.inc 2009-02-16 14:18:15.000000000 +0100 +@@ -76,12 +76,12 @@ + if we have installed or removed plugins. + */ + if(session::global_is_set("class_location.inc:timestamp")){ +- $tmp = $tmp = stat("/var/cache/gosa/class.cache"); ++ $tmp = stat("../include/class_location.inc"); + if($tmp['mtime'] != session::global_get("class_location.inc:timestamp")){ + session::global_un_set("plist"); + } + } +- $tmp = stat("/var/cache/gosa/class.cache"); ++ $tmp = stat("../include/class_location.inc"); + session::global_set("class_location.inc:timestamp",$tmp['mtime']); + + if($this->filename != "" && filemtime($this->filename) != $this->last_modified){ diff --git a/gosa-core/redhat/make-gosa-package b/gosa-core/redhat/make-gosa-package index d7d4ccb28..d5acc74ea 100755 --- a/gosa-core/redhat/make-gosa-package +++ b/gosa-core/redhat/make-gosa-package @@ -1,52 +1,145 @@ #!/bin/sh -if [ $# -ne 1 ]; then - echo "Usage: make-all trunk" +if [ $# -ne 2 ]; then + echo "Usage: RHEL/SLES/OpenSuse 2.6.4" exit 1 fi -what=$1 -NOT_RELEASED="heimdal dak dfs glpi opsi apache2 ssh" +# Prepare Variables depending on build system +## +release=$2 +distribution=$1 +NOT_RELEASED="heimdal dak dfs glpi opsi apache2 ssh uw-imap" +if [ "$release" != "trunk" ] +then + release="tags/$release" +fi + + +# Export the requested SVN release +## +if [ ! -d rpm_src ] +then + mkdir rpm_src; +fi -svn export https://oss.gonicus.de/repositories/gosa/tags/$what/gosa-core -svn export https://oss.gonicus.de/repositories/gosa/tags/$what/gosa-plugins -VERSION=$(cat gosa-core/debian/changelog | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p') +if [ ! -d rpm_src/gosa-core ] +then +svn export https://oss.gonicus.de/repositories/gosa/$release/gosa-core \ + ./rpm_src/gosa-core +else + echo "SVN export of 'gosa-core' exists, skipping!" +fi -#redhat -rm -rf /usr/src/redhat/RPMS/noarch/gosa* -rm -rf /usr/src/redhat/SPECS/gosa.spec -rm -rf /usr/src/redhat/SOURCES/* -rm -rf /usr/src/redhat/SPECS/* +if [ ! -d rpm_src/gosa-plugins ] +then +svn export https://oss.gonicus.de/repositories/gosa/$release/gosa-plugins \ + ./rpm_src/gosa-plugins +else + echo "SVN export of 'gosa-plugins' exists, skipping!" +fi -#suse -rm -rf /usr/src/packages/RPMS/noarch/gosa* -rm -rf /usr/src/packages/SPECS/gosa.spec -rm -rf /usr/src/packages/SOURCES/* -rm -rf /usr/src/packages/SPECS/* +# Detect build version +## +VERSION=$(cat rpm_src/gosa-core/debian/changelog | head -n 1 | sed -n -e 's/.*(\([^-]*\).*/\1/p') + + +case "$distribution" in + "RHEL" ) + build_path='/usr/src/redhat' + ;; + "SLES" ) + build_path='/usr/src/packages' + ;; + "OpenSuse" ) + build_path='/usr/src/packages' + ;; + * ) + echo "$distribution is unknown" + exit 1; + ;; +esac + +# Clean up +## +echo ".. some cleanup in '$build_path'" +rm -rf /var/tmp/gosa* +rm -rf $build_path/RPMS/noarch/gosa* +rm -rf $build_path/SOURCES/gosa* +rm -rf $build_path/SPECS/gosa* +rm -rf rpm_src/gosa-$VERSION + +PATHS='BUILD SPECS RPMS SOURCES' +for path in $PATHS; do + if [ ! -d $build_path/$path ] + then + mkdir -p $build_path/$path + fi +done -cp -a gosa-core gosa-$VERSION -tar cfj /usr/src/redhat/SOURCES/gosa-$VERSION.tar.bz2 gosa-$VERSION -cp gosa-$VERSION/redhat/0* /usr/src/redhat/SOURCES/ -sed "s/^Version:.*$/Version: $VERSION/" gosa-$VERSION/redhat/gosa.spec > /usr/src/redhat/SPECS/gosa.spec +# Create SRC tar +## +echo "Creating source tar.gz for gosa-$VERSION" +cp -a rpm_src/gosa-core rpm_src/gosa-$VERSION +cd rpm_src +tar cfj $build_path/SOURCES/gosa-$VERSION.tar.bz2 gosa-$VERSION +cd .. -#suse fallback -mkdir -p /usr/src/packages/SOURCES/ -ln -s /usr/src/redhat/SPECS/gosa.spec /usr/src/packages/SOURCES/gosa.spec +# Copy patches +## +echo "Copying build patches" +cp rpm_src/gosa-$VERSION/redhat/*.patch $build_path/SOURCES/ -rpmbuild -bb /usr/src/redhat/SPECS/gosa.spec +# Prepare spec file, replace Version +## +echo "Preparing spec file" +sed "s/^Version:.*$/Version: $VERSION/" \ + rpm_src/gosa-$VERSION/redhat/gosa.spec > $build_path/SPECS/gosa.spec -MAKE_PLUGINS=$(ls -1 gosa-plugins/*/plugin.dsc | sed 's/^.*\/\([^\/]*\)\/plugin.dsc$/\1/') + +# Build GOsa RPM +## +echo "Try to build package ... rpmbuild" +rpmbuild --quiet -bb $build_path/SPECS/gosa.spec +if [ $? != 0 ] +then + echo "Error: Build error" + exit 1 +fi + +# +# Build GOsa plugins +# + +# Create a list of all available plugins +## +MAKE_PLUGINS=$(ls -1 rpm_src/gosa-plugins/*/plugin.dsc \ + | sed 's/^.*\/\([^\/]*\)\/plugin.dsc$/\1/') + +# Skip black listed plugins +## for i in $NOT_RELEASED; do MAKE_PLUGINS=$(echo -n $MAKE_PLUGINS | sed "s/$i//") done -cd gosa-plugins +# Try to create plugin specfiles and try to build +## for plugin in $MAKE_PLUGINS; do - ../gosa-core/redhat/rpm-make-gosa $plugin - rpmbuild -bb /usr/src/redhat/SPECS/gosa-plugin-$plugin.spec -done -#rm -rf gosa-core -rm -rf gosa-$VERSION -rm -rf gosa-plugins + echo "# $plugin " + + ./gosa-core/redhat/rpm-make-gosa $plugin $build_path + if [ $? != 0 ] + then + echo "Error: Could not prepare build process" + exit 1 + fi + + rpmbuild --quiet -bb $build_path/SPECS/gosa-plugin-$plugin.spec + if [ $? != 0 ] + then + echo "Error: Build error in $plugin" + exit 1 + fi +done diff --git a/gosa-core/redhat/rpm-make-gosa b/gosa-core/redhat/rpm-make-gosa index 1965cc039..f5899da32 100755 --- a/gosa-core/redhat/rpm-make-gosa +++ b/gosa-core/redhat/rpm-make-gosa @@ -1,21 +1,32 @@ #!/bin/sh configfile=gosa-plugin-${1}.spec +path="rpm_src/gosa-plugins/${1}" echo "Reading plugin parameters..." -name=$(awk /name/ $1/plugin.dsc | awk '{ print $3 }') -description=$(awk /description/ $1/plugin.dsc | awk -F '"' '{ print $2 }') -version=$(awk /version/ $1/plugin.dsc | awk '{ print $3 }') -author=$(awk /author/ $1/plugin.dsc | awk -F '"' '{ print $2 }') -homepage=$(awk /homepage/ $1/plugin.dsc | awk '{ print $3 }') -depends=$(sed -n 's/^depends\s*=\s*//p' $1/plugin.dsc | sed 's/^/ /;s/,/ /g;s/\s\s*/ /g;s/ / gosa-plugin-/g;s/^ //;s/ /,/') -conflicts=$(awk /conflicts/ $1/plugin.dsc | awk '{ print $3 }') -provides=$(awk /provides/ $1/plugin.dsc | awk '{ print $3 }') +name=$(awk /name/ ${path}/plugin.dsc | awk '{ print $3 }') +description=$(awk /description/ ${path}/plugin.dsc | awk -F '"' '{ print $2 }') +version=$(awk /version/ ${path}/plugin.dsc | awk '{ print $3 }') +author=$(awk /author/ ${path}/plugin.dsc | awk -F '"' '{ print $2 }') +homepage=$(awk /homepage/ ${path}/plugin.dsc | awk '{ print $3 }') +depends=$(sed -n 's/^depends\s*=\s*//p' ${path}/plugin.dsc | sed 's/^/ /;s/,/ /g;s/\s\s*/ /g;s/ / gosa-plugin-/g;s/^ //;s/ /,/') +conflicts=$(awk /conflicts/ ${path}/plugin.dsc | awk '{ print $3 }') +provides=$(awk /provides/ ${path}/plugin.dsc | awk '{ print $3 }') release=0 -echo "Creating Spec file..." -cat << EOF | sed -e "s%@@NAME@@%$name%g" -e "s%@@DESCRIPTION@@%$description%g" -e "s%@@VERSION@@%$version%g" -e "s%@@AUTHOR@@%$author%g" -e "s%@@HOMEPAGE@@%$homepage%g" -e "s%@@DEPENDS@@%$depends%g" -e "s%@@CONFLICTS@@%$conflicts%g" -e "s%@@PROVIDES@@%$provides%g" -e "s%@@RELEASE@@%$release%g" -e "s%@@.*@@%not_defined%g" > $configfile + +cat << EOF | sed -e "s%@@NAME@@%$name%g" \ + -e "s%@@DESCRIPTION@@%$description%g" \ + -e "s%@@VERSION@@%$version%g" \ + -e "s%@@AUTHOR@@%$author%g" \ + -e "s%@@HOMEPAGE@@%$homepage%g" \ + -e "s%@@DEPENDS@@%$depends%g" \ + -e "s%@@CONFLICTS@@%$conflicts%g" \ + -e "s%@@PROVIDES@@%$provides%g" \ + -e "s%@@RELEASE@@%$release%g" \ + -e "s%@@.*@@%not_defined%g" > $configfile + # Some sort of "detection" of suse %{?suse_version:%define suse 1} %{!?suse_version:%define suse 0} @@ -67,6 +78,9 @@ BuildArch: noarch # Move extra HTML and images mkdir -p %{buildroot}/usr/share/gosa/html/plugins/@@NAME@@ + +echo "%{buildroot} <<---------" + if [ -d html ]; then mv ./html/* %{buildroot}/usr/share/gosa/html/plugins/@@NAME@@ fi @@ -108,15 +122,13 @@ rm -rf %{buildroot} EOF # Create eventually missing directories -[ ! -d /usr/src/redhat/SOURCES ] && mkdir -p /usr/src/redhat/SOURCES -[ ! -d /usr/src/redhat/SPECS ] && mkdir -p /usr/src/redhat/SPECS +[ ! -d ${2}/SOURCES ] && mkdir -p ${2}/SOURCES +[ ! -d ${2}/SPECS ] && mkdir -p ${2}/SPECS -mv $configfile /usr/src/redhat/SPECS -cp -r ./$1 /tmp/$1-${version} +mv $configfile ${2}/SPECS +cp -r ./rpm_src/gosa-plugins/${1} /tmp/gosa-plugin-${1}-${version} cd /tmp/ -mv $1-${version} gosa-plugin-${1}-${version} -tar cjf gosa-plugin-${1}-${version}.tar.bz2 ./gosa-plugin-${1}-${version} -rm -rf $1-${version} gosa-plugin-${1}-${version} -mv -f gosa-plugin-${1}-${version}.tar.bz2 /usr/src/redhat/SOURCES - +tar cjf ${2}/SOURCES/gosa-plugin-${1}-${version}.tar.bz2 ./gosa-plugin-${1}-${version} +rm -rf gosa-plugin-${1}-${version} echo "Done." +exit 0 -- 2.30.2