Hello!

After a while, I have finally found out what made problems while the 
compilation of the toaster packages in the different SuSE releases. Now all 
toaster packages can be build for the above mentioned distributions. I have 
compiled versions for 9.3-i586 10.0-i586 10.0-x86_64 10.1-i586 10.1-x86_64. I 
think, it should also compile on SE distributions.

As usual, I always compile the packages in build environments. Therefore I had 
to modify the spec-files as explained here:

--------------------------------------------
=> libdomainkeys-toaster
I changed the text 'ripMIME for qmail-toaster' to 'DomainKey library'. This is only a cosmetic thing and not important for compiling

--------------------------------------------
=> vpopmail-toaster
Requires: All SuSE releases need "pwdutils", to ensure, that the users and groups can be added before building

--------------------------------------------
=> qmail-toaster
BuildRequires: All SuSE releases need "mysql-devel"
Requires: All SuSE releases need "pwdutils", to ensure, that the users and groups can be added before building

--------------------------------------------
=> courier-authlib-toaster
BuildRequires: "vpopmail-toaster, gcc-c++, libstdc++-devel, expect, mysql-shared, 
mysql-devel"

--------------------------------------------
=> courier-imap-toaster
BuildRequires: All SuSE releases need "gcc-c++, libstdc++-devel, mysql-devel"
"fileutils" and "textutils" should be moved to the distribution specific [Build]Requires sections because they are not available in SuSE.

--------------------------------------------
=> control-panel-toaster
The version information for PHP is not good. It is better to refer to PHP in 
general and query the information number of PHP. There is no need to restrict 
to PHP5 for example. Is there any specific reason why to request a specific 
Apache version?

--------------------------------------------
=> qmailmrtg-toaster
BuildRequires: All SuSE releases need "mrtg"
The PHP/Apache version information had to be changed (see 
"control-panel-toaster")

--------------------------------------------
=> maildrop-toaster
BuildRequires: "gcc-c++, libstdc++-devel, pcre, pcre-devel, openldap2-client, mrtg, 
net-tools, openssl, cyrus-sasl, vpopmail-toaster, qmail-toaster"

--------------------------------------------
=> isoqlog-toaster ??????????????
                                #PKSUSE100='php5'
                                #PKSUSE101='php'
                                ;;
--------------------------------------------
=> squirrelmail-toaster
The PHP/Apache version information had to be changed (see 
"control-panel-toaster")

--------------------------------------------
=> spamassassin-toaster
BuildRequires: Replaced the line "perl >= 5.8.7, perl(Digest::SHA1), perl(HTML::Parser), openssl-devel"
        with "tperl >= 5.8.7, perl-Digest-SHA1, perl-HTML-Parser, openssl-devel"
Requires: Replaced the line "perl(Digest::SHA1), perl(HTML::Parser), perl(Pod::Usage), procmail"
        with "tperl-Digest-SHA1, perl-HTML-Parser, procmail"

--------------------------------------------
=>clamav-toaster
Requires: All SuSE releases need "pwdutils", to ensure, that the users and groups can be added before building In the %post section the line "/sbin/service freshclam start > /dev/null 2>&1"
has been replaced by
"
if test %{build_sus_100} -eq 0 -a %{build_sus_10064} -eq 0; then
 /sbin/service freshclam start > /dev/null 2>&1
fi
"
because /sbin/service is not available at SuSE distributions before 10.1.
--------------------------------------------
=>simscan-toaster
BuildRequires: perl-Digest-SHA1, perl-HTML-Parser, clamav-toaster, 
spamassassin-toaster, ucspi-tcp-toaster

--------------------------------------------
=>djbdns
BuildRequires: the line "chkconfig, initscripts, sh-utils, daemontools-toaster, ucspi-tcp-toaster"

has been replaced by, because some of the packages are not available there. I 
suggest to move those packages to the relevant sections of the distributions.

"sh-utils, daemontools-toaster, ucspi-tcp-toaster"

before the line "# create log symlinks"
the following lines have been inserted, to allow the rpm-packager to find some 
symlinks:

# touch logs
pushd %{buildroot}/var/djbdns
mkdir -p dnscachex/log dnscache/log tinydns/log axfrdns/log
touch dnscachex/log/main dnscache/log/main tinydns/log/main axfrdns/log/main
popd


--------------------------------------------
Unfortunately SuSE seems to ignore the BuildPreReq lines. Therefore all 
BuildPreReq lines have been renamed to BuildRequires. The statements are 
identical, as said in 
http://www.redhat.com/archives/rpm-list/2003-June/msg00088.html.

I suggest to do that for all spec files, to reduce the work for the SuSE 
maintainers.

--------------------------------------------
A SuSE <=10.0 specific problem is, that _ALL_ BuildRequires are processed, even 
when excluded by an %if statement. The only solution is, to remove all other 
distribution sections to make it compile nicely.

For SuSE <=10.0 it is also neccesary to define a BuildRequires statement which 
contains some default packages. Otherwise it does not compile most packages:

BuildRequires: aaa_base, acl, attr, bash, bind-utils, bison, bzip2, coreutils, 
cpio, cpp, cracklib, cvs, cyrus-sasl, db, devs, diffutils, e2fsprogs, file, 
filesystem, fillup, findutils, flex, gawk, gdbm-devel, glibc, glibc-devel, 
glibc-locale, gpm, grep, groff, gzip, info, insserv, klogd, less, libacl, 
libattr, libgcc, libnscd, libselinux, libstdc++, libxcrypt, libzio, m4, make, 
man, mktemp, module-init-tools, ncurses, ncurses-devel, net-tools, netcfg, 
openldap2-client, openssl, pam, pam-modules, patch, permissions, popt, 
procinfo, procps, psmisc, pwdutils, rcs, readline, sed, strace, syslogd, 
sysvinit, tar, tcpd, texinfo, timezone, unzip, util-linux, vim, zlib, 
zlib-devel, autoconf, automake, binutils, gcc, gdbm, gettext, libtool, perl, 
rpm, net-tools, openssl, cyrus-sasl, zlib-devel, pwdutils

SuSE <=10.0 does not like "," signs within BuildRequires sections. All those 
must to be removed before building.

And then, another nice thing, SuSE does not like version information in the BuildRequires sections. Those information must be removed, too.
I suggest to check if the version information in (Build)Requires sections are 
important: It seems, that it sometimes is there just to have something there: 
For example the web-applications does not really need a specific version while 
translating or running them. It would make maintenance much easier to remove 
those unnecessary information.

--------------------------------------------

To automate the build process, I have attached a script-file which is working 
on the above mentioned SuSE versions. Build can be done as follows:

1) Download the SRPM files

2) copy the attached file to the same directory

3) ensure, that the BUILD_RPMS variable points to an installation repository 
for the current SuSE version

4) run current-opensuse-build.sh. Use --help to read some information

As mentioned, I can compile all packages with SuSE 9.3 - OpenSuSE 10.1. I have 
not tested with SE, but I think it should run, too.

While processing the packages, diff files are generated which reflect the changes done by 
the script. Some SuSE <=10.0 specific changes are NOT reflected in the diff-file, because 
they would break other distributions functionality. Setting "dryrun" to 1 in the 
script would do everything except the build process. This could be used to generate the 
diff-files only.

--------------------------------------------


If you have any suggestions/questions/ideas, please send a mail.

Best regards,
Johannes

--


|---------------------------------
|  weberhofer GmbH               | Johannes Weberhofer
|  information technologies, Austria
|
|  phone : +43 (0)1 5454421 0    | email: [EMAIL PROTECTED]
|  fax   : +43 (0)1 5454421 19   | web  : http://weberhofer.at
|  mobile: +43 (0)699 11998315
|----------------------------------------------------------->>

#!/bin/sh
#
# build the system for SuSE 9.3 - OpenSuSE 10.1 systems
#
# author: Johannes Weberhofer, May - July 2006
# licensed under the GPL
#

# ####################################################################
# modify settings here
# please ensure, that the BUILD_RPMS environment variable is set to a
# valid (Open)SuSE installation repository

# This variable should be set to a directory where all (S)RPMs will be
# copied to
QMAILRPM=`dirname ~/qmailrpm`/`basename ~/qmailrpm`

# no changes should be done below this point
# ####################################################################

if test $# -eq 1 -a "$1" != "--help" ; then
        ARCH=$1
fi

if test -z "$ARCH" ; then
        ARCH=`grep '(' /etc/SuSE-release | sed -e 's/[^(]*(// ; s/)// ; s/\-/_/ 
; s/X/x/ '`
fi


# check parameters
if test $# -gt 1 -o "$1" == "--help" ; then
        echo "usage: `basename $0` [i586|x86_64]"
        echo ""
        echo "Default architecture for your system is: $ARCH"
        echo "Please do not forget to set 'BUILD_RPMS' to a valid (Open)SuSE 
installation repository. "
        echo "Currently it is set to: $BUILD_RPMS"
        echo ""
        echo "Before starting the build process, download the SRPMs to the 
current directory"
        echo ""
        echo "The resulting (S)RPMs will be copied to $QMAILRPM"
        echo "If you like to set another directory, please edit `basename $0`"
        echo "------------"
        echo "(c) Johannes Weberhofer <[EMAIL PROTECTED]>, May - July 2006, 
Version 1.0"
        echo "    licensed under the GPL"
        echo "------------"
        exit 1
fi


# here are the default SuSE RPM's located
DEFAULTRPM="$BUILD_RPMS"

DRYRUN=0

SUSERELEASE=`grep VERSION /etc/SuSE-release | sed 's/VERSION = //'`

if test "$ARCH" == "i586" ; then
        TOASTERTYPE=''
        TOASTERARCH=''
else
        TOASTERTYPE='64'
        TOASTERARCH=' x86_64'
fi
SUSETOASTERRELEASE=`echo "$SUSERELEASE" | tr -d '.'`

if test $SUSETOASTERRELEASE -lt 101 ; then
        SUSETOASTERRELEASE=100
fi

if test ! -d "$QMAILRPM/SuSE-$SUSERELEASE" ; then
        mkdir -p "$QMAILRPM/SuSE-$SUSERELEASE"
fi


# ####################################################################
# and now build the packages

BUILDPKGS="daemontools-toaster ucspi-tcp-toaster vpopmail-toaster libdomainkeys 
qmail-toaster courier-authlib-toaster courier-imap-toaster autorespond-toaster 
control-panel-toaster ezmlm-toaster qmailadmin-toaster qmailmrtg-toaster 
maildrop-toaster isoqlog-toaster vqadmin-toaster squirrelmail-toaster 
spamassassin-toaster clamav-toaster ripmime-toaster simscan-toaster djbdns"

for PACKAGE in $BUILDPKGS ; do
        DIR=`ls $PACKAGE-*.src.rpm | tail -n1 | sed -e 's/.src.rpm//'`
        if test ! -e "$QMAILRPM/SuSE-$SUSERELEASE/RPMS/$ARCH/$DIR.$ARCH.rpm" -a 
! -e "$QMAILRPM/SuSE-$SUSERELEASE/RPMS/noarch/$DIR.noarch.rpm"; then
                echo
                echo -e "\033[40m\033[001;031mPackage     : 
\033[40m\033[001;033m$PACKAGE\033[0m"
                echo -e "\033[40m\033[001;031mBuilding for: 
\033[40m\033[001;033mSuSE $SUSERELEASE\033[0m"
                echo -e "\033[40m\033[001;031mArchitecture: 
\033[40m\033[001;033m$ARCH\033[0m"
                echo
                if test ! -d "$DIR" ; then
                        mkdir "$DIR"
                else
                        rm -rf "$DIR/*"
                fi
                pushd "$DIR" 2>&1 > /dev/null
                unrpm "../$DIR.src.rpm" 2>&1 > /dev/null

                # do some package-related things
                PKSUSE100=''
                PKSUSE101=$PKSUSE100
                case "$PACKAGE" in
                        libdomainkeys-toaster)
                                SEDS='s/ripMIME for qmail-toaster/DomainKey 
library/'
                                ;;
                        vpopmail-toaster)
                                SEDS='s/^\(%define.*ostype SuSE 
*10\.[0-9].*Linux\)/\1\nRequires:\tpwdutils/'
                                ;;
                        qmail-toaster)
                                SEDS='s/^\(%define.*ostype SuSE 
*10\.[0-9].*Linux\)/\1\nRequires:\tpwdutils/'
                                PKSUSE100='mysql-devel'
                                PKSUSE101=$PKSUSE100
                                ;;
                        courier-authlib-toaster)
                                PKSUSE100='vpopmail-toaster, gcc-c++, 
libstdc++-devel, expect, mysql-shared, mysql-devel'
                                PKSUSE101=$PKSUSE100
                                ;;
                        courier-imap-toaster)
                                PKSUSE100='gcc-c++, libstdc++-devel, 
mysql-devel'
                                SEDS='/^BuildRequires:/ s/fileutils// ; 
/^Requires:/ s/fileutils// ; /^BuildRequires:/ s/textutils// ; /^Requires:/ 
s/textutils//'
                                PKSUSE101=$PKSUSE100
                                ;;
                        control-panel-toaster)
                                PKSUSE100='apache, libapr0, expat'
                                PKSUSE101='apache2, libapr1, expat'
                                SEDS='s/^\(Requires:.*apache2 >= 2.0.52, php5 
>= [0-9\.]*\)/Requires:\tapache2 >= 2.0.52, php >= 
4.4.0\nBuildRequires:\tapache2, libapr-util1/ ; s/^\(Requires:.*apache2 >= 
2.0.52, php4 >= [0-9\.]*\)/Requires:\tapache2 >= 2.0.52, php >= 4.4.0/'
                                ;;
                        qmailmrtg-toaster)
                                PKSUSE100='mrtg'
                                PKSUSE101=$PKSUSE100
                                SEDS='s/^\(Requires:.*cron >= 4.1, apache2 >= 
2.0.54, php4 >= 4.4.0, mrtg\)/Requires:\tcron >= 4.1, apache2 >= 2.0.54, php >= 
4.4.0/'
                                ;;
                        maildrop-toaster)
                                PKSUSE100='gcc-c++, libstdc++-devel, pcre, 
pcre-devel, openldap2-client, mrtg, net-tools, openssl, cyrus-sasl, 
vpopmail-toaster, qmail-toaster'
                                PKSUSE101=$PKSUSE100
                                ;;
                        isoqlog-toaster)
                                #PKSUSE100='php5'
                                #PKSUSE101='php'
                                ;;
                        squirrelmail-toaster)
                                SEDS='s/^\(Requires:.*apache2 >= 2.0.54, php4 
>= 4.4.0\)/Requires:\tapache2 >= 2.0.54, php >= 4.4.0/'
                                ;;
                        spamassassin-toaster)
                                SEDS='s/^\(BuildRequires:.*perl >= 5.8.7, 
perl(Digest::SHA1), perl(HTML::Parser), openssl-devel\)/BuildRequires:\tperl >= 
5.8.7, perl-Digest-SHA1, perl-HTML-Parser, openssl-devel/ ; 
s/^\(Requires:.*perl(Digest::SHA1), perl(HTML::Parser), perl(Pod::Usage), 
procmail\)/Requires:\tperl-Digest-SHA1, perl-HTML-Parser, procmail/'
                                ;;
                        clamav-toaster)
                                PKSUSE100='qmail-toaster'
                                PKSUSE101=$PKSUSE100
                                SEDS='s/^\(%define.*ostype SuSE 
*10\.[0-9].*Linux\)/\1\nRequires:\tpwdutils/ ;
                                s/^\(\/sbin\/service freshclam start.*\)/if 
test %{build_sus_100} -eq 0 -a %{build_sus_10064} -eq 0; then\n  \1\nfi/'
                                ;;
                        simscan-toaster)
                                PKSUSE100='perl-Digest-SHA1, perl-HTML-Parser, 
clamav-toaster, spamassassin-toaster, ucspi-tcp-toaster'
                                PKSUSE101=$PKSUSE100
                                ;;
                        djbdns)
                                SEDS='
s/chkconfig, initscripts, sh-utils, daemontools-toaster, 
ucspi-tcp-toaster/daemontools-toaster, ucspi-tcp-toaster/ ;

s/\(Buildprereq:        shadow-utils\)/#\1/

s/^\(# create log symlinks\)$/# touch logs\npushd 
%{buildroot}\/var\/djbdns\nmkdir -p dnscachex\/log dnscache\/log tinydns\/log 
axfrdns\/log\ntouch dnscachex\/log\/main dnscache\/log\/main tinydns\/log\/main 
axfrdns\/log\/main\npopd\n\n\1/ ;
s/^\(\/var\/log\/djbdns\/axfrdns\)$/\1\n%config(noreplace)\/var\/djbdns\/tinydns\/log\/main\n%config(noreplace)\/var\/djbdns\/axfrdns\/log\/main/
 ;
s/^\(\/var\/log\/djbdns\/dnscachex\)$/\1\n%config(noreplace)\/var\/djbdns\/dnscachex\/log\/main/
 ;
s/^\(\/var\/log\/djbdns\/dnscache\)$/\1\n%config(noreplace)\/var\/djbdns\/dnscache\/log\/main/'
                                ;;
                esac
                SPECFILE=`ls *.spec | tail -n1`

                # SuSE seems to ignore the BuildPreReq lines.
                # Therefore all BuildPreReq lines are renamed to BuildRequires
                # The statements are identical, as said in
                # 
http://www.redhat.com/archives/rpm-list/2003-June/msg00088.html
                #
                sed -i.orig -e 's/^BuildPreReq:/BuildRequires:/' $SPECFILE

                # now do some changes for the suse distributions
                if test -n "$SEDS" ; then
                        sed -i -e "$SEDS" $SPECFILE
                fi
                if test -n "$PKSUSE100" ; then
                        sed -i -e "s/^\(%define.*ostype SuSE 
*10\.0.*Linux\)/\1\nBuildRequires:\t$PKSUSE100/" $SPECFILE
                fi
                if test -n "$PKSUSE101" ; then
                        sed -i -e "s/^\(%define.*ostype SuSE 
*10\.1.*Linux\)/\1\nBuildRequires:\t$PKSUSE101/" $SPECFILE
                fi

                # SuSE before 10.1 did not include all packages to build the 
toaster
                # packaged properly. Therefore they should be included for SuSE 
10.0
                # distributions.
                sed -i -e 's/^\(%define.*ostype SuSE 
*10\.0.*Linux\)/\1\nBuildRequires:\taaa_base, acl, attr, bash, bind-utils, 
bison, bzip2, coreutils, cpio, cpp, cracklib, cvs, cyrus-sasl, db, devs, 
diffutils, e2fsprogs, file, filesystem, fillup, findutils, flex, gawk, 
gdbm-devel, glibc, glibc-devel, glibc-locale, gpm, grep, groff, gzip, info, 
insserv, klogd, less, libacl, libattr, libgcc, libnscd, libselinux, libstdc++, 
libxcrypt, libzio, m4, make, man, mktemp, module-init-tools, ncurses, 
ncurses-devel, net-tools, netcfg, openldap2-client, openssl, pam, pam-modules, 
patch, permissions, popt, procinfo, procps, psmisc, pwdutils, rcs, readline, 
sed, strace, syslogd, sysvinit, tar, tcpd, texinfo, timezone, unzip, 
util-linux, vim, zlib, zlib-devel, autoconf, automake, binutils, gcc, gdbm, 
gettext, libtool, perl, rpm, net-tools, openssl, cyrus-sasl, zlib-devel, 
pwdutils/' $SPECFILE

                diff -u $SPECFILE.orig $SPECFILE > ../$PACKAGE.diff

                sed -i -e 
's/\(^%define.*build_sus_'$SUSETOASTERRELEASE$TOASTERTYPE' [^0]*\)\(0$\)/\1 1/' 
$SPECFILE

                # for SuSE < 10.1 all occurences of "BuildRequires" are 
interpreted, even when excluded by
                # %if...%endif sections. "BuildRequires" does additionally NOT 
accept version information.
                # SuSE < 10.1 ignores the "BuildPreReq" sections, so all it's 
information must be copied to
                # "BuildRequires"

                # begin speciallity for Suse < 10.1
                if test $SUSETOASTERRELEASE -lt 101 ; then
                        # backup the full spec files
                        cp $SPECFILE complete-$SPECFILE
                        # read the required distibution statements
                        DISTSTATEMENT=`sed -n -e "/^%if 
%{build_sus_$SUSETOASTERRELEASE$TOASTERTYPE}$/,/^%endif/p " $SPECFILE`

                        # remove all distibution statements
                        sed -i -e '/^%if %{build_[a-z]*_[0-9]*}$/,/^%endif/d' 
$SPECFILE
                        sed -i -e '/^%if %{default}$/,/^%endif/d' $SPECFILE

                        # split up and insert the current distributions 
statement on the proper position
                        csplit --quiet $SPECFILE "/# Distro Statements/+1"

                        cat xx00 > $SPECFILE
                        echo -e "$DISTSTATEMENT" >> $SPECFILE
                        cat xx01 | sed -e '/./,$!d ; /^BuildRequires/ 
s/\(BuildRequires:\)\([a-z]\)/\1\t\2/' >> $SPECFILE
                        rm xx00 xx01

                        # re-format BuildRequires statements for the whole 
package (not for the distibution)
                        sed -i -e '/^BuildRequires/ s/[<>=]\+ [0-9\.\-]\+//g ; 
/^BuildRequires/ s/,/ /g ; /^BuildRequires/ s/[ ]+/ /g ; /^BuildRequires/ s/ [ 
]*/ /g' $SPECFILE

                fi
                # end speciallity for Suse < 10.1

                if test $DRYRUN -ne 1 ; then
                        build $SPECFILE --clean --arch=$ARCH \
                                --rpms 
$DEFAULTRPM/:$QMAILRPM/SuSE-$SUSERELEASE/RPMS/$ARCH:$QMAILRPM/SuSE-$SUSERELEASE/RPMS/noarch
                        if test $? -ne 0 ; then
                                exit 1
                        fi

                        cp -a /var/tmp/build-root/usr/src/packages/* 
"$QMAILRPM/SuSE-$SUSERELEASE/"

                        popd 2>&1 > /dev/null
                        rm -rf "$DIR"
                else
                        popd 2>&1 > /dev/null
                fi
        fi
done

if test -e all-toaster-opensuse.diff ; then
        rm all-toaster-opensuse.diff
fi
cat *.diff > all-toaster-opensuse.diff

---------------------------------------------------------------------
     QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to