diff options
Diffstat (limited to 'rpm')
27 files changed, 2285 insertions, 0 deletions
diff --git a/rpm/INSTALL b/rpm/INSTALL new file mode 100644 index 000000000..d39bf70a2 --- /dev/null +++ b/rpm/INSTALL @@ -0,0 +1,4 @@ +See httemplates/docs/install-rpm.html and documentation on the wiki. + +This directory contains files that are RPM-specific and are referenced by the spec file during a build of the Freeside RPMs. + diff --git a/rpm/build/BOOTSTRAP b/rpm/build/BOOTSTRAP new file mode 100644 index 000000000..6ddf5b54d --- /dev/null +++ b/rpm/build/BOOTSTRAP @@ -0,0 +1,146 @@ +# its more notes than a script, so no #!/bin/sh yet + +# s/ivan/username/ in buildsysrc and below + + +### +# host dirs +### + + +cd +mkdir public_html +mkdir mock +mkdir redhat +mkdir redhat/SRPMS +mkdir buildsys +mkdir buildsys/ref +mkdir buildsys/ref/SRPMS + +cd buildsys +for a in build-freeside buildsysrc cvs-check-and-build enrpm expect-addsign expect-signrepo ovid2flute refresh-repo; do +ln -s ~/freeside/rpm/build/$a . +done + + +### +# vserver setup +### + + +#ftp://ftp.pld-linux.org/people/hawk/vserver-templates/Centos +#sudo vserver centos5 build -m template --context 5 --hostname centos5.freeside.biz --interface dummy0:10.5.4.5/24 -- -d centos5 -t centos5-i686.tar.bz2 +sudo vserver centos5 build -m template --context 5 --hostname centos5.freeside.biz --interface dummy0:10.5.4.5/24 -- -d centos5 -t centos5-x86_64.tar.bz2 + +#something like this as /etc/init.d/vserver-nat: +!/bin/sh +iptables -t nat -F +iptables -t nat -A POSTROUTING -s 10.5.4.0/24 -d ! 10.5.4.0/24 -j SNAT --to-source 192.168.1.143 + +vserver centos5 start +vserver centos5 enter +#edit /etc/resolv.conf (easier from outside, no vi inside yet) + +yum update +yum install openssh-server vim-minimal zsh screen sudo perl patch cvs diffutils rpm-build rsync + +adduser ivan #username +cd ~ivan #username +mkdir .ssh +vi .ssh/authorized_keys + +mkdir redhat +mkdir redhat/BUILD +mkdir redhat/RPMS +mkdir redhat/SOURCES +mkdir redhat/SPECS +mkdir redhat/SRPMS +chown -R ivan:ivan redhat + +vi ~/.rpmmacros +%_gpg_path /home/ivan/.gnupg +%_gpg_name Freeside Internet Services, Inc. RPM Signing Key + +vi /etc/ssh/sshd_config #ListenAddress +#also need to edit on the host so the vserver can claim its address + +vi /etc/pam.d/sshd +#comment out: +#session required pam_loginuid.so + +/etc/init.d/sshd restart + +vi /etc/sudoers + +exit #and test ssh'ing in + +### +# more... +### + +#copy the stuff from rpm/build/native into /home/ivan (#username) in the vserver +cd rpm/build/native +for a in build-from-cvs freeside-cvs makesrpm ovid2flute ovid-0.12-1.x86_64.rpm Ovid.diff; do + cp $a /var/lib/vservers/centos5/home/ivan/ +done + +for a in build-from-cvs freeside-cvs makesrpm ovid2flute; do + chmod a+rx /var/lib/vservers/centos5/home/ivan/$a +done + +vserver centos5 enter #or ssh 10.5.4.5 and sudo + +rpm -i ovid-0.12-1.x86_64.rpm +cd /usr/lib/perl5/site_perl/5.*/Ovid +patch < ~ivan/Ovid.diff + +#also checkout the necessary freeside versions... +export CVSROOT=":pserver:anonymous:anonymous@cvs.freeside.biz:/home/cvs/cvsroot" + +cvs checkout -rFREESIDE_1_7_BRANCH -d freeside-1.7 freeside +#cvs checkout -rFREESIDE_1_9_BRANCH -d freeside-1.9 freeside + +### +# yet more +### + +cp -i /var/lib/vservers/centos5/etc/yum.repos.d/CentOS-Base.repo /etc/yum/repos.d/ +#and s/$releasever/5/g; + +cp expect-* /usr/local/bin/ +#edit them and set your real passphrase for the gpg key you're using +#(as per that dir above) + +### +# and the repository +### + +cd +mkdir -p public_html/repo/centos/5/freeside-1.7/testing/x86_64/ +mkdir public_html/repo/centos/5/freeside-1.7/testing/i686 + +### +# and for enrpm! +### + +vserver centos5 enter +yum install perl-libwww-perl make +cpan +install RPM::Specfile +#if it fails, might need to go to /root/.cpan/build/RPM-Specfile-* and do it manually +install YAML + +#for user cpan-ability +mkdir .cpan +mkdir .cpan/CPAN +cp /usr/lib/perl5/5.8.8/CPAN/Config.pm .cpan/CPAN/MyConfig.pm +vi .cpan/CPAN/MyConfig.pm #and just leave and change the /root ones +chmod a+rx .cpan/CPAN/MyConfig.pm + +#edit ovid2flue and set user + +### +# references +### + +http://www.freeside.biz/mediawiki/index.php/Freeside:Documentation:CreatingRPMRepo diff --git a/rpm/build/build-freeside b/rpm/build/build-freeside new file mode 100755 index 000000000..afef96ab6 --- /dev/null +++ b/rpm/build/build-freeside @@ -0,0 +1,192 @@ +#!/bin/sh +# +# Copyright 2008, Elirion, Inc. All rights reserved. +# This software is licensed under the same terms as Freeside itself. +# +# This script rebuilds SRPMs of Freeside builds or the required Perl modules on all the target +# distributions and versions using mock. After a successful build, it signs the resulting RPMs +# and scp's them to the server where the yum repositories are hosted. +# (Of course, koji is supposed to do all this, including updating the repo.) + +VERSIONS='1.7 1.9' +#VERSIONS='1.7 1.9 2.1' +REPO=testing +BRANCH= +DISTROS='centos sles' +CENTOSVERS='5' +SLESVERS=10 +WHICHVERS= +ARCHS='i386 x86_64' + +BUILDSYSDIR=`dirname $0` + +MOCKWORK="$BUILDSYSDIR/mockwork" + +#MOCKARGS='--autocache' +MOCKARGS="--configdir=$BUILDSYSDIR/mock --resultdir=$MOCKWORK" + +if [ -f $BUILDSYSDIR/buildsysrc ]; then + #chmod a+x $BUILDSYSDIR/buildsysrc + #echo $BUILDSYSDIR/buildsysrc + . $BUILDSYSDIR/buildsysrc +fi +if [ -f $HOME/buildsysrc ]; then + #chmod a+x $HOME/buildsysrc + #echo $HOME/buildsysrc + . $HOME/buildsysrc +fi + +EXPECT_ADDSIGN=$BUILDSYSDIR/expect-addsign +if [ -f /usr/local/bin/expect-addsign ]; then + EXPECT_ADDSIGN=/usr/local/bin/expect-addsign +fi + +usage() { + echo "build-freeside: build RPMs for all target distros and architectures using mock" + echo "where:" + echo " -a <archs>: change architectures (currently: $ARCHS)" + echo " -b <branch>: change branch (currently: $BRANCH)" + echo " -d <distros>: change distributions (currently: $DISTROS)" + echo " -m <arguments>: change arguments passed to 'mock' (currently: $MOCKARGS)" + echo " -r <repo>: change repositories (currently: $REPO)" + echo " -s <srpms>: build these SRPMs instead of new ones in staging area" + echo " -v <versions>: change versions (currently: $VERSIONS)" + echo " -w <distvers>: change distro version (currently: $WHICHVERS)" + exit 0 +} + +while getopts "a:b:d:hm:r:s:v:w:" flag +do + case $flag in + a) + echo "Changing architectures from $ARCHS to $OPTARG" + ARCHS=$OPTARG;; + b) + echo "Changing branch from $BRANCH to $OPTARG" + BRANCH=$OPTARG;; + d) + echo "Changing distros from $DISTROS to $OPTARG" + DISTROS=$OPTARG;; + m) + echo "Changing mock arguments from $MOCKARGS to $OPTARG" + MOCKARGS=$OPTARG;; + r) + echo "Changing repository from $REPO to $OPTARG" + REPO=$OPTARG;; + s) + echo "Changing SRPMS from $SRPMS to $OPTARG" + SRPMS=$OPTARG;; + v) + echo "Changing versions from $VERSIONS to $OPTARG" + VERSIONS=$OPTARG;; + w) + echo "Changing which distro versions from $WHICHVERS to $OPTARG" + WHICHVERS=$OPTARG;; + *) + usage;; + esac +done + +if [ "${SRCFOLDER}x" = "x" ]; then + PWD=`pwd` + echo "No source folder defined! (BUILDSYSDIR=$BUILDSYSDIR pwd=$PWD)" + exit +fi + +if [ "${REFFOLDER}x" = "x" ]; then + echo "No reference folder defined!" + exit +fi + +if [ "${SRPMS}x" = "x" ]; then + # Work out the new SRPMs on grosbeak + SRPMS=`/usr/bin/rsync -Cavz --dry-run $SRCFOLDER/ $REFFOLDER | grep .src.rpm | grep -v safecat | tr '\n' ' '` + + # Go and get the SRPMs + /usr/bin/rsync -Cavz $SRCFOLDER/ $REFFOLDER +fi + +# Make sure the SRPMs are there +for srpm in ${SRPMS} +do + if [ ! -f $REFFOLDER/${srpm} ] + then + echo "No such file: $REFFOLDER/${srpm}" + exit + fi +done + +# Build all the SRPMs +for srpm in ${SRPMS} +do + for distro in $DISTROS + do + if [ "${WHICHVERS}x" = "x" ]; then + if [ "$distro" = "centos" ]; then + DISTVERS=$CENTOSVERS + fi + if [ "$distro" = "sles" ]; then + DISTVERS=$SLESVERS + fi + else + DISTVERS=$WHICHVERS + fi + for distver in $DISTVERS + do + os=${distro}-${distver} + for arch in $ARCHS + do + echo "$os - $arch: $srpm" + echo mock $MOCKARGS -r ${os}-${arch} $REFFOLDER/${srpm} + time mock $MOCKARGS -r ${os}-${arch} $REFFOLDER/${srpm} + if true #[ -f $MOCKWORK/${os}-${arch}/state/status ] && grep done $MOCKWORK/${os}-${arch}/state/status + then + for VERSION in $VERSIONS + do + DEST=$VERSION + if [ "${BRANCH}x" != "x" ] + then + DEST=$BRANCH + fi + # Copy freeside RPMs for this version only + #FILES=`ls -1 $MOCKWORK/${os}-${arch}/result/freeside*-${VERSION}-*.rpm | grep -v .src.rpm | tr '\n' ' '` + FILES=`ls -1 $MOCKWORK/freeside*-${VERSION}-*.rpm | grep -v .src.rpm | tr '\n' ' '` + echo $FILES + if [ "${FILES}x" != "x" ] + then + for FILE in $FILES + do + $EXPECT_ADDSIGN $FILE + done + if [ "${REPOMACHINE}x" != "x" ] + then + scp -p $FILES $REPOUSER@$REPOMACHINE:$REPOFOLDER/repo/${distro}/${distver}/freeside-${DEST}/${REPO}/${arch} + else + cp -p $FILES $REPOFOLDER/repo/${distro}/${distver}/freeside-${DEST}/${REPO}/${arch} + fi + fi + # Copy non-freeside RPMs to all versions + #FILES=`ls -1 $MOCKWORK/${os}-${arch}/result/*.rpm | grep -v freeside | grep -v .src.rpm | tr '\n' ' '` + FILES=`ls -1 $MOCKWORK/*.rpm | grep -v freeside | grep -v .src.rpm | tr '\n' ' '` + echo $FILES + if [ "${FILES}x" != "x" ] + then + for FILE in $FILES + do + $EXPECT_ADDSIGN $FILE + done + if [ "${REPOMACHINE}x" != "x" ] + then + scp -p $FILES $REPOUSER@$REPOMACHINE:$REPOFOLDER/repo/${distro}/${distver}/freeside-${DEST}/${REPO}/${arch} + else + cp -p $FILES $REPOFOLDER/repo/${distro}/${distver}/freeside-${DEST}/${REPO}/${arch} + fi + fi + done + fi + done + done + done +done + +echo "build-freeside done" diff --git a/rpm/build/buildsysrc b/rpm/build/buildsysrc new file mode 100755 index 000000000..c8d0beeb0 --- /dev/null +++ b/rpm/build/buildsysrc @@ -0,0 +1,14 @@ +# Define shell variables for the Freeside RPM build system +# + +SRCFOLDER=ivan@10.5.4.5:/home/ivan/redhat/SRPMS +REFFOLDER=$HOME/buildsys/ref/SRPMS +#ARCHS='i386 x86_64' +REPOFOLDER=/home/ivan/public_html +REPOBASEFOLDER=/home/ivan/public_html +KEYID=rpm + +VERSIONS='1.7' +DISTROS='centos' +CENTOSVERS='5' +#ARCHS='x86_64' diff --git a/rpm/build/cvs-check-and-build b/rpm/build/cvs-check-and-build new file mode 100755 index 000000000..e8cd52104 --- /dev/null +++ b/rpm/build/cvs-check-and-build @@ -0,0 +1,45 @@ +#!/bin/sh +# +# Copyright 2009, Elirion, Inc. All rights reserved. +# This software is licensed under the same terms as Freeside itself. +# +# This script wraps other scripts in the build system. It does a CVS comparison on the vserver +# to determine if the CVS contents have changed. If so, an SRPM is built. The script then invokes +# the local build script which pulls down this SRPM and uses mock to build binary RPMs for the +# default targets. Finally, the repository is updated. +# +# There's currently no testing for failure. + +FORCE_FLAG= +QUIET_FLAG= + +usage() { + echo "cvs-check-and-build: check Freeside CVS and build RPMs if changed" + echo "where:" + echo " -f: force SRPM rebuild even if CVS contents have not changed" + echo " -h: print this help message" + echo " -q: run yum-arch and createrepo in quiet mode" + exit 0 +} + +while getopts "fhq" flag +do + case $flag in + f) + echo "Force mode" + FORCE_FLAG=-f;; + q) + echo "Quiet mode" + QUIET_FLAG=-q;; + *) + usage;; + esac +done + +#ssh 10.5.4.5 /home/rsiddall/build-from-cvs $FORCE_FLAG +#cd /home/rsiddall/buildsys; ./build-freeside; ./refresh-repo $QUIET_FLAG + +ssh 10.5.4.5 ./build-from-cvs $FORCE_FLAG + +cd ~/buildsys; ./build-freeside; ./refresh-repo $QUIET_FLAG + diff --git a/rpm/build/enrpm b/rpm/build/enrpm new file mode 100755 index 000000000..3e674bc3a --- /dev/null +++ b/rpm/build/enrpm @@ -0,0 +1,178 @@ +#!/usr/bin/perl -w +# +# Attempt to build RPMs for Freeside from a tarball or module +# +# Contains portions of "cpanspec" http://cpanspec.sourceforge.net/ + +=head1 NAME + +enrpm - Attempt to build RPMs for Freeside from a tarball or a module + +=head1 SYNOPSIS + +enrpm [options] [tarball|module-name [...]] + + Options: + --help -h Help message + +=head1 DESCRIPTION + +B<enrpm> will generate a spec file to build a rpm from a CPAN-style +Perl module distribution, then try to build RPMs from that spec file +under mock, and update the repositories if successful. + +B<enrpm> uses the file extension of the tarball or module-name specified +on the command line to determine if the argument is a tarball or a module name. + +Modules are downloaded from the CPAN. You must have initialized CPAN on the machine +for B<enrpm> to be able to do this. + +For tarballs B<enrpm> attempts to build a usable .spec file using cpanflute2, and then builds +an SRPM from the .spec file and the tarball. + +Once an SRPM has been built, B<enrpm> uses an external script to build binary RPMs under "mock". +It then uses a second script to update the repositories. + +=head1 OPTIONS + +=over 4 + +=item B<--help> + +Print a brief help message and exit. + +=item B<--packager> + +Specify the name and e-mail address of the packager. This winds up in auto-generated .spec files. + +=item B<--server> + +Specify the host name or IP address of the server on which the SRPM will be built. This server must be +set up for SRPM building, which means it must have both B<ovid> and B<cpanflute2> installed on it. + +=item B<--dry-run> + +Just print out commands, don't actually run them. + +=back + +=head1 BUGS + +Currently has little in the way of error detection and diagnostics. + +The back-end should be replaced with an existing build system such as koji. + +=head1 AUTHOR + +Richard Siddall <richard.siddall@elirion.net> + +=head1 SEE ALSO + +L<perl(1)>, L<cpan2rpm(1)>, L<cpanflute2(1)> + +=cut + +use strict; +use Getopt::Long; +use Cwd qw/getcwd abs_path/; +use File::Basename; +use Sys::Hostname; # False laziness to get around a real config file... + +my %opts; + +GetOptions(\%opts, 'packager=s', 'release=s', 'server=s', 'dryrun'); + +$ENV{PATH} = "/bin:/usr/bin"; + +sub usage { + print STDERR "usage: enrpm --packager <Your Name <you\@example.com>> [--release=<rpm-release-string>] --server <server-name> [--dryrun] tarball|module-name\n"; + print STDERR "where:\n\t--packager is the name and e-mail address of the packager for the .spec file\n\t--release is the rpm release number for the .spec file\n\t--server is the server to build the SRPM on\n\t--dryrun means do not actually run the commands\n\n"; + print STDERR "\ttarball is the name of a tarball containing the Perl module to be packaged\n"; + print STDERR "\tmodule-name is the name of a CPAN Perl module to be packaged\n"; + exit; +} + +# Feeble excuse for not having a real configuration file +my $user = 'ivan'; +my $buildsys = "/home/$user/buildsys"; +#my $rembuild = '/home/rsiddall/buildsys/ref'; +my $remdeps = '/home/ivan'; +my $rpmtopdir = "/home/$user/redhat"; +my $packager = 'Ivan Kohler <ivan@freeside.biz>'; +my $server = '10.5.4.5'; + +$server = $opts{server} if defined($opts{server}); +$user = $1 if $server =~ /(\w+)\@[\w\d\.]+/; + +$packager = $opts{packager} if defined($opts{packager}); + +# Go ahead and build an SRPM... + +my $ovidignore = '--ignore ' . join ('--ignore ', qw/libwww/); + + +for my $file (@ARGV) { + my ($name,$version,$type); + + if ($file =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)\.(tar)\.(?:gz|bz2)$/) { + $name = $1; + $version = $2; + $type = $3; + } elsif ($file =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)\.tgz$/) { + $name = $1; + $version = $2; + $type = 'tar'; + } elsif ($file =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)\.(zip)$/) { + $name = $1; + $version = $2; + $type = $3; + } else { + # keep things happy if we get "Foo-Bar" instead of "Foo::Bar" + $file =~ s/-/::/g; + $name = $file; + $version = undef; + $type = 'module'; + } + + if ($type eq 'module') { + my $fluteopts = ''; + $fluteopts .= "--packager='$packager' " if defined($packager); + $fluteopts .= "--release='$opts{release}' " if defined($opts{release}); + do_cmd("ssh $user\@$server \"ovid --deps $ovidignore $name | tail -1 | $remdeps/ovid2flute $fluteopts | /bin/sh\""); + } else { + my $absfile = abs_path($file); + my $fname = basename($file); + die "Packager name and e-mail required" if !defined($packager); + die "RPM release string required" if !defined($opts{release}); + do_cmd("scp $absfile $user\@$server:/home/$user/$fname"); +# do_cmd("ssh $user\@$server 'cpanflute2 --just-spec --noperlreqs --email=\\\"$packager\\\" --release=$opts{release} /home/$user/$fname > /home/$user/work/redhat/SPECS/$name.spec;'"); +# do_cmd("ssh $user\@$server 'perl -pi -e \\\"s/perl\(perl\)/perl/g\\\" /home/$user/work/redhat/SPECS/$name.spec;'"); +# do_cmd("ssh $user\@$server 'rpmbuild -bs --nodeps --define \\\"_sourcedir /home/$user/\\\" --define \\\"_srcrpmdir /home/$user/work/redhat/SRPMS\\\" /home/$user/work/redhat/SPECS/$name.spec'"); + open SCRIPT, ">/home/$user/makesrpm" or die "Can't create SRPM construction script: ", $!; + print SCRIPT "#!/bin/sh\n\n"; + print SCRIPT "cpanflute2 --just-spec --noperlreqs --email='$packager' --release=$opts{release} /home/$user/$fname > $rpmtopdir/SPECS/$name.spec;\n"; + print SCRIPT "perl -pi -e 's/perl(perl)/perl/g' $rpmtopdir/SPECS/$name.spec\n"; + print SCRIPT "rpmbuild -bs --nodeps --define '_sourcedir /home/$user/' --define '_srcrpmdir $rpmtopdir/SRPMS' $rpmtopdir/SPECS/$name.spec\n"; + close SCRIPT or die "Can't close SRPM construction script: ", $!; + chmod(0711, "/home/$user/makesrpm"); + do_cmd("scp /home/$user/makesrpm $user\@$server:/home/$user/makesrpm"); + do_cmd("ssh $user\@$server /home/$user/makesrpm"); + } + my $olddir = getcwd(); + do_cmd("$buildsys/build-freeside"); +# if (-x "$buildsys/refresh-repo") { + do_cmd("$buildsys/refresh-repo"); +# } else { +# do_cmd("ssh $user\@$server $rembuild/refresh-repo"); +# } +} + +sub do_cmd { + my $cmd = shift; + + print "$cmd\n"; + `$cmd` if !exists($opts{dryrun}); +} + +1; + diff --git a/rpm/build/expect-addsign b/rpm/build/expect-addsign new file mode 100755 index 000000000..5634ed47b --- /dev/null +++ b/rpm/build/expect-addsign @@ -0,0 +1,8 @@ +#!/usr/bin/expect +set p "not our actual passphrase" +set f [lindex $argv 0] +#spawn /bin/rpm --resign $f +spawn /usr/bin/rpm --resign $f +expect "Enter pass phrase:" +send -- "$p\r" +expect eof diff --git a/rpm/build/expect-signrepo b/rpm/build/expect-signrepo new file mode 100755 index 000000000..81035f9f2 --- /dev/null +++ b/rpm/build/expect-signrepo @@ -0,0 +1,9 @@ +#!/usr/bin/expect +set password "not our actual passphrase" +set key [lindex $argv 0] +set output [lindex $argv 1] +set input [lindex $argv 2] +spawn gpg -sab --yes -u "$key" -o $output $input +expect "Enter passphrase:" +send -- "$password\r" +expect eof diff --git a/rpm/build/mock/centos-5-i386.cfg b/rpm/build/mock/centos-5-i386.cfg new file mode 100644 index 000000000..203d4fd13 --- /dev/null +++ b/rpm/build/mock/centos-5-i386.cfg @@ -0,0 +1,87 @@ +#!/usr/bin/python -tt +import os +config_opts['root'] = 'centos-5-i386' +config_opts['target_arch'] = 'i386' + +config_opts['cleanup_on_failure'] = 0 + +config_opts['chroot_setup_cmd'] = 'install buildsys-build' + +# caching related options +#these are probably obsolete? +config_opts['rebuild_cache'] = False +#config_opts['use_cache'] = False +config_opts['use_cache'] = True +config_opts['pack_cmd'] = "/usr/sbin/mock-helper pack" +config_opts['unpack_cmd'] = "/usr/sbin/mock-helper unpack" +config_opts['cache_ext'] = ".tar.gz" +config_opts['cache_topdir'] = "/var/cache/mock" +#config_opts['max_cache_age_days'] = 15 +config_opts['max_cache_age_days'] = 150 + +# config_opts['plugin_conf']['ccache_enable'] = True +config_opts['plugin_conf']['ccache_enable'] = False +# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G' +# config_opts['plugin_conf']['ccache_opts']['dir'] = "%(cache_topdir)s/%(root)s/ccache/" +config_opts['plugin_conf']['yum_cache_enable'] = True +config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] = 30 +config_opts['plugin_conf']['yum_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/yum_cache/" +config_opts['plugin_conf']['root_cache_enable'] = True +config_opts['plugin_conf']['root_cache_opts']['max_age_days'] = 15 +config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/" +config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "gzip" +config_opts['plugin_conf']['root_cache_opts']['extension'] = ".gz" + + +config_opts['yum.conf'] = """ + +[main] +cachedir=/var/cache/yum +debuglevel=1 +reposdir=/dev/null +logfile=/var/log/yum.log +retries=20 +obsoletes=1 +gpgcheck=0 +assumeyes=1 + +# repos + +[os] +name=os +mirrorlist=http://mirrorlist.centos.org/?release=5&arch=i386&repo=os +baseurl=http://mirror.centos.org/centos/5/os/i386/ +#baseurl=file:///home/rsiddall/mock/repos/centos/5/os/i386/ + +[updates] +name=updates +mirrorlist=http://mirrorlist.centos.org/?release=5&arch=i386&repo=updates +baseurl=http://mirror.centos.org/centos/5/updates/i386/ +#baseurl=file:///home/rsiddall/mock/repos/centos/5/updates/i386/ + +[groups] +name=groups +baseurl=http://dev.centos.org/centos/buildsys/5/ + +""" + +#something here is causing a problem, don't know what, see if we need anything +#config_opts['macros'] = """ +#%_topdir /builddir/build +#%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm +# +## Change the next two lines to reflect yourself. +# +#%packager Freeside Internet Services, Inc. <rpm@freeside.biz> +##%vendor +##%distribution +# +## please change this to reflect the Distro Tree and Repo hosting packages! +##%dist <distro>.<yourtag> +#%centos_ver 5 +# +##%_smp_mflags -j1 +# +#""" + + diff --git a/rpm/build/mock/centos-5-x86_64.cfg b/rpm/build/mock/centos-5-x86_64.cfg new file mode 100644 index 000000000..174136909 --- /dev/null +++ b/rpm/build/mock/centos-5-x86_64.cfg @@ -0,0 +1,88 @@ +#!/usr/bin/python -tt +import os + +config_opts['root'] = 'centos-5-x86_64' +config_opts['target_arch'] = 'x86_64' + +config_opts['cleanup_on_failure'] = 0 + +config_opts['chroot_setup_cmd'] = 'install buildsys-build' + +# caching related options +#these are probably obsolete? +config_opts['rebuild_cache'] = False +#config_opts['use_cache'] = False +config_opts['use_cache'] = True +config_opts['pack_cmd'] = "/usr/sbin/mock-helper pack" +config_opts['unpack_cmd'] = "/usr/sbin/mock-helper unpack" +config_opts['cache_ext'] = ".tar.gz" +config_opts['cache_topdir'] = "/var/cache/mock" +#config_opts['max_cache_age_days'] = 15 +config_opts['max_cache_age_days'] = 150 + +# config_opts['plugin_conf']['ccache_enable'] = True +config_opts['plugin_conf']['ccache_enable'] = False +# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G' +# config_opts['plugin_conf']['ccache_opts']['dir'] = "%(cache_topdir)s/%(root)s/ccache/" +config_opts['plugin_conf']['yum_cache_enable'] = True +config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] = 30 +config_opts['plugin_conf']['yum_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/yum_cache/" +config_opts['plugin_conf']['root_cache_enable'] = True +config_opts['plugin_conf']['root_cache_opts']['max_age_days'] = 15 +config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/" +config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "gzip" +config_opts['plugin_conf']['root_cache_opts']['extension'] = ".gz" + + +config_opts['yum.conf'] = """ + +[main] +cachedir=/var/cache/yum +debuglevel=1 +reposdir=/dev/null +logfile=/var/log/yum.log +retries=20 +obsoletes=1 +gpgcheck=0 +assumeyes=1 +exclude=[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz]*.i*86 g[abcdefghijkmnopqrstuvwxyz]*.i?86 glib2.i?86 glib.i?86 *-devel.i?86 +# repos + +[os] +name=os +mirrorlist=http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os +baseurl=http://mirror.centos.org/centos/5/os/x86_64/ +#baseurl=file:///home/rsiddall/mock/repos/centos/5/os/x86_64/ + +[updates] +name=updates +mirrorlist=http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=updates +baseurl=http://mirror.centos.org/centos/5/updates/x86_64/ +#baseurl=file:///home/rsiddall/mock/repos/centos/5/updates/x86_64/ + +[groups] +name=groups +baseurl=http://dev.centos.org/centos/buildsys/5/ +""" + +#something here is causing a problem, don't know what, see if we need anything +#re-enabled +#config_opts['macros'] = """ +#%_topdir /builddir/build +#%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm +# +## Change the next two lines to reflect yourself. +# +#%packager Freeside Internet Services, Inc. <rpm@freeside.biz> +##%vendor +##%distribution +# +## please change this to reflect the Distro Tree and Repo hosting packages! +##%dist <distro>.<yourtag> +#%centos_ver 5 +# +##%_smp_mflags -j1 +# +#""" + + diff --git a/rpm/build/mock/defaults.cfg b/rpm/build/mock/defaults.cfg new file mode 100644 index 000000000..3f9fcf6c2 --- /dev/null +++ b/rpm/build/mock/defaults.cfg @@ -0,0 +1,39 @@ +# mock defaults +# +# Define default values here. +# These values are overwritten in the /etc/mock/CHROOT.cfg files. +# +# Example: +# +# config_opts['foo'] = bar +config_opts['basedir'] = '/var/lib/mock/' +config_opts['chroot'] = '/usr/sbin/mock-helper chroot' +config_opts['mount'] = '/usr/sbin/mock-helper mount' +config_opts['umount'] = '/usr/sbin/mock-helper umount' +config_opts['rm'] = '/usr/sbin/mock-helper rm' +config_opts['mknod'] = '/usr/sbin/mock-helper mknod' +config_opts['yum'] = '/usr/sbin/mock-helper yum' +config_opts['runuser'] = '/sbin/runuser' +config_opts['chrootuser'] = 'mockbuild' +config_opts['chrootgroup'] = 'mockbuild' +config_opts['chrootuid'] = os.geteuid() +config_opts['chrootgid'] = os.getegid() +config_opts['chroothome'] = '/builddir' +config_opts['clean'] = True + +# caching related options +config_opts['rebuild_cache'] = False +config_opts['use_cache'] = False +config_opts['pack_cmd'] = "/usr/sbin/mock-helper pack" +config_opts['unpack_cmd'] = "/usr/sbin/mock-helper unpack" +config_opts['cache_ext'] = ".tar.gz" +config_opts['cache_topdir'] = "root-cache" +config_opts['max_cache_age_days'] = 15 + +# allow some network tests to run under the chroot +config_opts['files']['/etc/resolv.conf'] = open("/etc/resolv.conf","r").read() +config_opts['files']['/etc/hosts'] = open("/etc/hosts","r").read() + +config_opts['chroot_setup_cmd'] = 'install buildsys-build' +#config_opts['chroot_setup_cmd'] = 'groupinstall build' + diff --git a/rpm/build/mock/logging.ini b/rpm/build/mock/logging.ini new file mode 100644 index 000000000..fadc6a85b --- /dev/null +++ b/rpm/build/mock/logging.ini @@ -0,0 +1,84 @@ +[formatters] +keys: detailed,simple,unadorned,state + +[handlers] +keys: simple_console,detailed_console,unadorned_console,simple_console_warnings_only + +[loggers] +keys: root,build,state,mock + +[formatter_state] +format: %(asctime)s - %(message)s + +[formatter_unadorned] +format: %(message)s + +[formatter_simple] +format: %(levelname)s: %(message)s + +;useful for debugging: +[formatter_detailed] +format: %(levelname)s %(filename)s:%(lineno)d: %(message)s + +[handler_unadorned_console] +class: StreamHandler +args: [] +formatter: unadorned +level: INFO + +[handler_simple_console] +class: StreamHandler +args: [] +formatter: simple +level: INFO + +[handler_simple_console_warnings_only] +class: StreamHandler +args: [] +formatter: simple +level: WARNING + +[handler_detailed_console] +class: StreamHandler +args: [] +formatter: detailed +level: WARNING + +; usually dont want to set a level for loggers +; this way all handlers get all messages, and messages can be filtered +; at the handler level +; +; all these loggers default to a console output handler +; +[logger_root] +level: NOTSET +handlers: simple_console + +; mock logger normally has no output +; catches stuff like mock.trace_decorator and mock.util +; dont normally want to propagate to root logger, either +[logger_mock] +level: NOTSET +handlers: +qualname: mock +propagate: 1 + +[logger_state] +level: NOTSET +; unadorned_console only outputs INFO or above +handlers: unadorned_console +qualname: mock.Root.state +propagate: 0 + +[logger_build] +level: NOTSET +handlers: simple_console_warnings_only +qualname: mock.Root.build +propagate: 0 + +; the following is a list mock logger qualnames used within the code: +; +; qualname: mock.util +; qualname: mock.uid +; qualname: mock.trace_decorator + diff --git a/rpm/build/mock/site-defaults.cfg b/rpm/build/mock/site-defaults.cfg new file mode 100644 index 000000000..0ee2082eb --- /dev/null +++ b/rpm/build/mock/site-defaults.cfg @@ -0,0 +1,98 @@ +# mock defaults +# vim:tw=0:ts=4:sw=4:et: +# +# This config file is for site-specific default values that apply across all +# configurations. Options specified in this config file can be overridden in +# the individual mock config files. +# +# The defaults.cfg delivered by default has NO options set. Only set options +# here if you want to override the defaults. +# +# Entries in this file follow the same format as other mock config files. +# config_opts['foo'] = bar + +############################################################################# +# +# Things that we recommend you set in defaults.cfg: +# +# config_opts['basedir'] = '/var/lib/mock/' +# config_opts['cache_topdir'] = '/var/cache/mock' +# Note: the path pointed to by basedir and cache_topdir must be owned +# by group 'mock' and must have mode: g+rws +# config_opts['rpmbuild_timeout'] = 0 +# config_opts['use_host_resolv'] = True + +# You can configure log format to pull from logging.ini formats of these names: +# config_opts['build_log_fmt_name'] = "unadorned" +# config_opts['root_log_fmt_name'] = "detailed" +# config_opts['state_log_fmt_name'] = "state" +# +# mock will normally set up a minimal chroot /dev. +# If you want to use a pre-configured /dev, disable this and use the bind-mount +# plugin to mount your special /dev +# config_opts['internal_dev_setup'] = True +# +# internal_setarch defaults to 'True' if the python 'ctypes' package is +# available. It is in the python std lib on >= python 2.5. On older versions, +# it is available as an addon. On systems w/o ctypes, it will default to +# 'False' +# config_opts['internal_setarch'] = False +# +# the cleanup_on_* options allow you to automatically clean and remove the +# mock build directory, but only take effect if --resultdir is used. +# config_opts provides fine-grained control. cmdline only has big hammer +# +# config_opts['cleanup_on_success'] = 1 +# config_opts['cleanup_on_failure'] = 1 + +############################################################################# +# +# plugin related. Below are the defaults. Change to suit your site +# policy. defaults.cfg is a good place to do this. +# +# NOTE: Some of the caching options can theoretically affect build +# reproducability. Change with care. +# +# config_opts['plugin_conf']['ccache_enable'] = True +# config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '4G' +# config_opts['plugin_conf']['ccache_opts']['dir'] = "%(cache_topdir)s/%(root)s/ccache/" +# config_opts['plugin_conf']['yum_cache_enable'] = True +# config_opts['plugin_conf']['yum_cache_opts']['max_age_days'] = 30 +# config_opts['plugin_conf']['yum_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/yum_cache/" +# config_opts['plugin_conf']['root_cache_enable'] = True +# config_opts['plugin_conf']['root_cache_opts']['max_age_days'] = 15 +# config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/%(root)s/root_cache/" +# config_opts['plugin_conf']['root_cache_opts']['compress_program'] = "gzip" +# config_opts['plugin_conf']['root_cache_opts']['extension'] = ".gz" +# +# bind mount plugin is enabled by default but has no configured directories to mount +# config_opts['plugin_conf']['bind_mount_enable'] = True +# config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/host/path', '/bind/mount/path/in/chroot/' )) +# +# config_opts['plugin_conf']['tmpfs_enable'] = False +# config_opts['plugin_conf']['tmpfs_opts'] = {'required_ram_mb': 1024} + +############################################################################# +# +# Things that you can change, but we dont recommend it: +# config_opts['chroothome'] = '/builddir' +# config_opts['clean'] = True + +############################################################################# +# +# Things that are best suited for individual chroot config files: +# +# MUST SET (in individual chroot cfg file): +# config_opts['root'] = 'name-of-yum-build-dir' +# config_opts['target_arch'] = 'i386' +# config_opts['yum.conf'] = '' +# +# CAN SET, defaults usually work ok: +# config_opts['chroot_setup_cmd'] = 'install buildsys-build' +# config_opts['log_config_file'] = 'logging.ini' +# config_opts['more_buildreqs']['srpm_name-version-release'] = 'dependencies' +# config_opts['macros']['Add_your_macro_name_here'] = "add macro value here" +# config_opts['files']['path/name/no/leading/slash'] = "put file contents here." +# config_opts['chrootuid'] = os.getuid() +# config_opts['chrootgid'] = grp.getgrnam("mock")[2] +# config_opts['useradd'] = '/usr/sbin/useradd -m -u %(uid)s -g %(gid)s -d %(home)s -n %(user)s' # Fedora/RedHat diff --git a/rpm/build/mock/sles-10-i386.cfg b/rpm/build/mock/sles-10-i386.cfg new file mode 100644 index 000000000..ad1a62b40 --- /dev/null +++ b/rpm/build/mock/sles-10-i386.cfg @@ -0,0 +1,59 @@ +#!/usr/bin/python -tt + +import os + +config_opts['root'] = 'sles-10-i386' +config_opts['basedir'] = '/var/lib/mock/' +config_opts['chroot'] = '/usr/sbin/mock-helper chroot' +config_opts['mount'] = '/usr/sbin/mock-helper mount' +config_opts['umount'] = '/usr/sbin/mock-helper umount' +config_opts['rm'] = '/usr/sbin/mock-helper rm' +config_opts['mknod'] = '/usr/sbin/mock-helper mknod' +config_opts['yum'] = '/usr/sbin/mock-helper yum' +config_opts['runuser'] = '/bin/su' +config_opts['chroot_setup_cmd'] = 'groupinstall build build-minimal build-base' +config_opts['chrootuser'] = 'mockbuild' +config_opts['chrootgroup'] = 'users' +config_opts['chrootuid'] = os.geteuid() +config_opts['chrootgid'] = os.getegid() +config_opts['chroothome'] = '/builddir' +config_opts['clean'] = True +config_opts['target_arch'] = 'i386' +config_opts['use_cache'] = 1 + + +config_opts['yum.conf'] = """ +[main] +cachedir=/var/cache/yum +debuglevel=1 +logfile=/var/log/yum.log +reposdir=/dev/null +retries=20 +obsoletes=1 +gpgcheck=0 +assumeyes=1 + +# repos + +[base] +name=base +#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/i386/ +#baseurl=http://redshank.elirion.net/sles +baseurl=file:///home/rsiddall/mock/repos/sles10/i386 + +[build] +name=build +#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/i386/ +#baseurl=http://grosbeak.elirion.net/repo/sles/10/build/i386/ +baseurl=file:///home/rsiddall/public_html/repo/sles/10/build/i386 + +[groups] +name=groups +#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/mock/buildgroups/sles10/i386/ +#baseurl=http://redshank.elirion.net/slesgroup/sles10/i386/ +baseurl=file:///home/rsiddall/mock/buildgroups/sles10/i386 + +""" + + + diff --git a/rpm/build/mock/sles-10-x86_64.cfg b/rpm/build/mock/sles-10-x86_64.cfg new file mode 100644 index 000000000..d55b40ad6 --- /dev/null +++ b/rpm/build/mock/sles-10-x86_64.cfg @@ -0,0 +1,59 @@ +#!/usr/bin/python -tt + +import os + +config_opts['root'] = 'sles-10-x86_64' +config_opts['basedir'] = '/var/lib/mock/' +config_opts['chroot'] = '/usr/sbin/mock-helper chroot' +config_opts['mount'] = '/usr/sbin/mock-helper mount' +config_opts['umount'] = '/usr/sbin/mock-helper umount' +config_opts['rm'] = '/usr/sbin/mock-helper rm' +config_opts['mknod'] = '/usr/sbin/mock-helper mknod' +config_opts['yum'] = '/usr/sbin/mock-helper yum' +config_opts['runuser'] = '/bin/su' +config_opts['chroot_setup_cmd'] = 'groupinstall build build-minimal build-base' +config_opts['chrootuser'] = 'mockbuild' +config_opts['chrootgroup'] = 'users' +config_opts['chrootuid'] = os.geteuid() +config_opts['chrootgid'] = os.getegid() +config_opts['chroothome'] = '/builddir' +config_opts['clean'] = True +config_opts['target_arch'] = 'x86_64' +config_opts['use_cache'] = 1 + + +config_opts['yum.conf'] = """ +[main] +cachedir=/var/cache/yum +debuglevel=1 +logfile=/var/log/yum.log +reposdir=/dev/null +retries=20 +obsoletes=1 +gpgcheck=0 +assumeyes=1 + +# repos + +[base] +name=base +#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/x86_64/ +#baseurl=http://redshank.elirion.net/sles +baseurl=file:///home/rsiddall/mock/repos/sles10/x86_64 + +[build] +name=build +#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/sles10/base/x86_64/ +#baseurl=http://grosbeak.elirion.net/repo/sles/10/build/x86_64/ +baseurl=file:///home/rsiddall/public_html/repo/sles/10/build/x86_64 + +[groups] +name=groups +#baseurl=http://hb.linuxdev.us.dell.com/pub/yum/mock/buildgroups/sles10/x86_64/ +#baseurl=http://redshank.elirion.net/slesgroup/sles10/x86_64/ +baseurl=file:///home/rsiddall/mock/buildgroups/sles10/x86_64 + +""" + + + diff --git a/rpm/build/native/Ovid.diff b/rpm/build/native/Ovid.diff new file mode 100644 index 000000000..81db7c5a8 --- /dev/null +++ b/rpm/build/native/Ovid.diff @@ -0,0 +1,30 @@ +--- Package.pm.orig 2007-05-25 09:54:14.000000000 -0400 ++++ Package.pm 2007-07-07 15:35:20.000000000 -0400 +@@ -165,6 +165,7 @@ + push @out, $self->provreq($n); + } + ++ return join("\n", map { "Provides: $_"; } @out) if scalar(@out) > 5; + return join('', 'Provides: ', join ' ', @out); + } + +@@ -376,10 +377,15 @@ + + %install + +-make PREFIX=%{_prefix} \ +- DESTDIR=%{buildroot} \ +- INSTALLDIRS=@installdirs@ \ +- install ++if [ -f Build.PL -a -f Build ] ; then ++ ./Build destdir=%{buildroot} \ ++ install ++else ++ make PREFIX=%{_prefix} \ ++ DESTDIR=%{buildroot} \ ++ INSTALLDIRS=@installdirs@ \ ++ install ++fi + + [ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress + diff --git a/rpm/build/native/build-from-cvs b/rpm/build/native/build-from-cvs new file mode 100755 index 000000000..aa1319b96 --- /dev/null +++ b/rpm/build/native/build-from-cvs @@ -0,0 +1,75 @@ +#!/bin/sh +# +# Copyright 2008, Elirion, Inc. All rights reserved. +# This software is licensed under the same terms as Freeside itself. +# +# This script builds SRPMs if the Freeside CVS contents have changed. +# It must have reference copies of the Freeside versions it builds. +# Each SRPM's "release" is set to the date & time the script is run. +# The version number is forced to the CVS version. The version and release +# hard-coded in the last .spec file committed to CVS are NOT used. +# +source $HOME/freeside-cvs +RELEASE=`date +%Y%m%d%H%M%S` +QUIET_FLAG= +#FORCE_FLAG=0 +FORCE_FLAG=1 +#VERSIONS='1.7 1.9' +VERSIONS='1.7' + +while getopts "fhqv:" flag +do + case $flag in + f) + echo "Force mode" + FORCE_FLAG=1;; + q) + echo "Quiet mode" + QUIET_FLAG=-q;; + v) + echo "Changing versions from $VERSIONS to $OPTARG" + VERSIONS=$OPTARG;; + *) + usage;; + esac +done + +usage() { + echo "build-from-cvs: build SRPMs if the Freeside CVS contents have changed" + echo "where:" + echo " -f: force building SRPMs even if CVS is unchanged" + echo " -h: print this usage information" + echo " -q: run quietly" + echo " -v <versions>: change versions (currently: $VERSIONS)" + exit 0 +} + +for VERSION in $VERSIONS; do + echo ${VERSION} + /bin/rm -rf ref-${VERSION} + cp -pr freeside-${VERSION} ref-${VERSION} + cd freeside-${VERSION} + cvs update -d -P + cd .. + diff -qr --exclude=CVS freeside-${VERSION} ref-${VERSION} + RETVAL=$? + if [ $FORCE_FLAG = 1 -o $RETVAL -gt 0 ]; then + # Build the tarball with the modified .spec file in it, hard-coding the release into the .spec file + cd freeside-${VERSION} + for SPECFILE in install/rpm/freeside.spec rpm/freeside.spec; do + if [ -f $SPECFILE ]; then + cp -pf $SPECFILE .. + perl -p -i -e "s/\d+[^\}]+/${VERSION}/ if /%define\s+version\s+(\d+[^\}]+)\}/;" ${SPECFILE} + perl -pi -e "s/\$1/${RELEASE}/ if /%define\s+release\s+(\d+)/;" $SPECFILE + tar zcvf $HOME/redhat/SOURCES/freeside-${VERSION}.tar.gz --exclude CVS ../freeside-${VERSION} + mv -f ../`basename $SPECFILE` `dirname $SPECFILE` + fi + done + cd .. + rpmbuild -ts $HOME/redhat/SOURCES/freeside-${VERSION}.tar.gz + # Could do a koji-build here + # Or move the SRPM to a staging directory for the build machine to check + # Should make the Bundles and check the dependencies for changes + fi + /bin/rm -rf ref-${VERSION} +done diff --git a/rpm/build/native/freeside-cvs b/rpm/build/native/freeside-cvs new file mode 100755 index 000000000..88d12b4dc --- /dev/null +++ b/rpm/build/native/freeside-cvs @@ -0,0 +1,2 @@ +export CVSROOT=":pserver:anonymous:anonymous@cvs.freeside.biz:/home/cvs/cvsroot" +export CVS_RSH="ssh" diff --git a/rpm/build/native/makesrpm b/rpm/build/native/makesrpm new file mode 100755 index 000000000..fc9703ebc --- /dev/null +++ b/rpm/build/native/makesrpm @@ -0,0 +1,5 @@ +#!/bin/sh + +cpanflute2 --just-spec --noperlreqs --email='Ivan Kohler <ivan@freeside.biz>' --release=1 /home/rsiddall/Business-OnlinePayment-Jety-0.06.tar.gz > /home/rsiddall/redhat/SPECS/Business-OnlinePayment-Jety.spec; +perl -pi -e 's/perl(perl)/perl/g' /home/rsiddall/redhat/SPECS/Business-OnlinePayment-Jety.spec +rpmbuild -bs --nodeps --define '_sourcedir /home/rsiddall/' --define '_srcrpmdir /home/rsiddall/redhat/SRPMS' /home/rsiddall/redhat/SPECS/Business-OnlinePayment-Jety.spec diff --git a/rpm/build/native/ovid-0.12-1.x86_64.rpm b/rpm/build/native/ovid-0.12-1.x86_64.rpm Binary files differnew file mode 100644 index 000000000..363e08922 --- /dev/null +++ b/rpm/build/native/ovid-0.12-1.x86_64.rpm diff --git a/rpm/build/native/ovid2flute b/rpm/build/native/ovid2flute new file mode 100755 index 000000000..5bb836116 --- /dev/null +++ b/rpm/build/native/ovid2flute @@ -0,0 +1,141 @@ +#!/usr/bin/perl -w +# +# Convert the output from ovid --deps into a list of modules to run through cpanflute2 to get +# better .spec files, and generate SRPMs from these. + +use strict; +use Getopt::Long; + +# Need to fix up modules where Ovid parses the name incorrectly +my %badparse=( + 'Crypt-PasswdMD-5' => 'Crypt-PasswdMD5', + 'IPC-Run-3' => 'IPC-Run3', + 'Digest-SHA-1' => 'Digest-SHA1', + 'Digest-MD-4' => 'Digest-MD4', +); + +my %extra_buildreqs=( + 'File-Rsync' => [ qw/rsync/ ], + 'MIMETools' => [ qw/perl(Mail::Header) perl(Mail::Internet) perl(Mail::Field) perl(IO::Stringy) perl(File::Temp)/ ], + 'HTML::Scrubber' => [ qw/perl(HTML::Parser) perl(HTML::Tagset)/ ], +# 'Time::Duration' => [ qw/perl(Test::Pod) perl(Test::Pod::Coverage)/ ], +); + +my %extra_reqs=( + 'File-Rsync' => [ qw/rsync/ ], +); + +my %opts; + +GetOptions(\%opts, 'packager=s', 'release=s'); + +$opts{packager} = 'Richard Siddall <richard.siddall@elirion.net>' if !defined($opts{packager}); + +# Need to process modules that cause Ovid to crash +#my @extramods= qw/Text::CSV_XS Pod::Simple Crypt::SSLeay/; +#my @extramods= qw/Crypt::SSLeay/; +my @extramods= qw/IPC::ShareLite/; + +my $specfiledir="/home/ivan/work/redhat/SPECS"; +$specfiledir = "/home/ivan/redhat/SPECS" if ! -d $specfiledir; +my $srpmdir="/home/ivan/work/redhat/SRPMS"; +$srpmdir = "/home/ivan/redhat/SRPMS" if ! -d $srpmdir; + +foreach (reverse <STDIN>) { + next if !defined($_); + #print $_; + last if $_ !~ /^([-\w:]+) perl-([-\w\.]+)(-\d+[\w\.]+?)$/; + #print "$1 = $2\n" + my ($name, $rpm, $ver) = ($1, $2, $3); + print "# $name ($rpm - $ver)\n"; + foreach my $cand (keys %badparse) { + if ($rpm =~ /^$cand/) { + $rpm =~ s/^$cand/$badparse{$cand}/; + print "# Fixed up $rpm\n"; + last; + } + } + printcmds($name, "$rpm$ver"); + #print "cpanspec -v --packager 'Unknown <nobody\@example.com>' $name\n"; + #print "echo $rpm\n"; + #print "repoquery perl-$rpm\n"; + #touchsrpms($name, "$rpm$ver"); +} + +exit; + +foreach my $name (@extramods) { + my $rpm = $name; + $rpm =~ s/::/-/g; + my $tarball = `find ~/.cpan/sources -name '$rpm-*' -print | tail -1`; + #print "$name (Extra!)\n" + if ($tarball =~ /\/($rpm-.*?)(\.tar\.gz|\.tgz)\s*$/) { + $rpm = $1; + printcmds($name, $rpm); + } else { + die "Can't find full rpm name for $name in \"$tarball\"\n"; + } +} + +sub touchsrpms { + my ($name, $rpm) = @_; + my $repofolder ="/var/www/html/repo/sles/10/freeside-1.9/stable/x86_64"; + my $srpmfolder ="/home/ivan/work/redhat/SRPMS"; + my @files = glob "$repofolder/perl-$rpm-*.rpm"; + if (! scalar(@files)) { + print "Can't find $rpm in $repofolder\n"; + @files = glob "$srpmfolder/perl-$rpm-*.src.rpm\n"; + if (scalar(@files)) { + my $file = pop @files; + print "touch $file\n"; + } else { + print STDERR "No corresponding SRPM: $srpmfolder/perl-$rpm-*.src.rpm\n"; + printcmds($name, $rpm); + } + } +} + +sub printcmds { + my ($name, $rpm) = @_; + + my $tarball = `find ~/.cpan -name '$rpm.tar.gz' -print`; + $tarball = `find ~/.cpan -name '$rpm.tgz' -print` if ! $tarball; + chomp($tarball); +# my $specfile = "$specfiledir/$name.spec"; + my $rpmname = $rpm; + $rpmname = $1 if $rpm =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)$/; + my $specfile = "$specfiledir/perl-$rpmname.spec"; + $specfile =~ s/::/-/g; + # Work out which version of the SRPM we're going to generate. + my $rel; + if (!defined($opts{release})) { + for ($rel = 1; ; $rel++) { + my $srpm = "$srpmdir/perl-$rpm-$rel.src.rpm"; + last if ! -e $srpm; + print "# File exists: $srpm\n"; + } + } else { + $rel = $opts{release}; + } + my $fluteopts = ""; + foreach my $cand (keys %extra_buildreqs) { + if ($rpm =~ /^$cand/) { + $fluteopts .= join "", map { "--buildrequires $_ " } @{$extra_buildreqs{$cand}}; + last; + } + } + foreach my $cand (keys %extra_reqs) { + if ($rpm =~ /^$cand/) { + $fluteopts .= join "", map { "--requires $_ " } @{$extra_reqs{$cand}}; + last; + } + } + print "cpanflute2 --just-spec --noperlreqs --email='$opts{packager}' --release=$rel $fluteopts $tarball > $specfile;\n"; + # Should fix up the .spec file + print "perl -pi -e 's/perl\\(perl\\)/perl/g' $specfile;\n"; + my $tarballdir = `dirname $tarball` or die "Can't find tarball for $name: $tarball\n"; + chomp($tarballdir); + print "rpmbuild -bs --nodeps --define '_sourcedir $tarballdir' --define '_srcrpmdir $srpmdir' $specfile\n"; + print "# Generates: $srpmdir/perl-$rpm-$rel.src.rpm\n"; +} + diff --git a/rpm/build/ovid2flute b/rpm/build/ovid2flute new file mode 100755 index 000000000..403b1d93f --- /dev/null +++ b/rpm/build/ovid2flute @@ -0,0 +1,139 @@ +#!/usr/bin/perl -w +# +# Convert the output from ovid --deps into a list of modules to run through cpanflute2 to get +# better .spec files, and generate SRPMs from these. + +use strict; +use Getopt::Long; + +# Need to fix up modules where Ovid parses the name incorrectly +my %badparse=( + 'Crypt-PasswdMD-5' => 'Crypt-PasswdMD5', + 'IPC-Run-3' => 'IPC-Run3', + 'Digest-SHA-1' => 'Digest-SHA1', + 'Digest-MD-4' => 'Digest-MD4', +); + +my %extra_buildreqs=( + 'File-Rsync' => [ qw/rsync/ ], + 'MIMETools' => [ qw/perl(Mail::Header) perl(Mail::Internet) perl(Mail::Field) perl(IO::Stringy) perl(File::Temp)/ ], + 'HTML::Scrubber' => [ qw/perl(HTML::Parser) perl(HTML::Tagset)/ ], +# 'Time::Duration' => [ qw/perl(Test::Pod) perl(Test::Pod::Coverage)/ ], +); + +my %extra_reqs=( + 'File-Rsync' => [ qw/rsync/ ], +); + +my %opts; + +GetOptions(\%opts, 'packager=s', 'release=s'); + +$opts{packager} = 'Richard Siddall <richard.siddall@elirion.net>' if !defined($opts{packager}); + +# Need to process modules that cause Ovid to crash +#my @extramods= qw/Text::CSV_XS Pod::Simple Crypt::SSLeay/; +#my @extramods= qw/Crypt::SSLeay/; +my @extramods= qw/IPC::ShareLite/; + +my $specfiledir="/home/rsiddall/work/redhat/SPECS"; +my $srpmdir="/home/rsiddall/work/redhat/SRPMS"; + +foreach (reverse <STDIN>) { + next if !defined($_); + #print $_; + last if $_ !~ /^([-\w:]+) perl-([-\w\.]+)(-\d+[\w\.]+?)$/; + #print "$1 = $2\n" + my ($name, $rpm, $ver) = ($1, $2, $3); + print "# $name ($rpm - $ver)\n"; + foreach my $cand (keys %badparse) { + if ($rpm =~ /^$cand/) { + $rpm =~ s/^$cand/$badparse{$cand}/; + print "# Fixed up $rpm\n"; + last; + } + } + printcmds($name, "$rpm$ver"); + #print "cpanspec -v --packager 'Unknown <nobody\@example.com>' $name\n"; + #print "echo $rpm\n"; + #print "repoquery perl-$rpm\n"; + #touchsrpms($name, "$rpm$ver"); +} + +exit; + +foreach my $name (@extramods) { + my $rpm = $name; + $rpm =~ s/::/-/g; + my $tarball = `find ~/.cpan/sources -name '$rpm-*' -print | tail -1`; + #print "$name (Extra!)\n" + if ($tarball =~ /\/($rpm-.*?)(\.tar\.gz|\.tgz)\s*$/) { + $rpm = $1; + printcmds($name, $rpm); + } else { + die "Can't find full rpm name for $name in \"$tarball\"\n"; + } +} + +sub touchsrpms { + my ($name, $rpm) = @_; + my $repofolder ="/var/www/html/repo/sles/10/freeside-1.9/stable/x86_64"; + my $srpmfolder ="/home/rsiddall/work/redhat/SRPMS"; + my @files = glob "$repofolder/perl-$rpm-*.rpm"; + if (! scalar(@files)) { + print "Can't find $rpm in $repofolder\n"; + @files = glob "$srpmfolder/perl-$rpm-*.src.rpm\n"; + if (scalar(@files)) { + my $file = pop @files; + print "touch $file\n"; + } else { + print STDERR "No corresponding SRPM: $srpmfolder/perl-$rpm-*.src.rpm\n"; + printcmds($name, $rpm); + } + } +} + +sub printcmds { + my ($name, $rpm) = @_; + + my $tarball = `find ~/.cpan -name '$rpm.tar.gz' -print`; + $tarball = `find ~/.cpan -name '$rpm.tgz' -print` if ! $tarball; + chomp($tarball); +# my $specfile = "$specfiledir/$name.spec"; + my $rpmname = $rpm; + $rpmname = $1 if $rpm =~ /^(?:.*\/)?(.*)-(?:v\.?)?([^-]+)$/; + my $specfile = "$specfiledir/perl-$rpmname.spec"; + $specfile =~ s/::/-/g; + # Work out which version of the SRPM we're going to generate. + my $rel; + if (!defined($opts{release})) { + for ($rel = 1; ; $rel++) { + my $srpm = "$srpmdir/perl-$rpm-$rel.src.rpm"; + last if ! -e $srpm; + print "# File exists: $srpm\n"; + } + } else { + $rel = $opts{release}; + } + my $fluteopts = ""; + foreach my $cand (keys %extra_buildreqs) { + if ($rpm =~ /^$cand/) { + $fluteopts .= join "", map { "--buildrequires $_ " } @{$extra_buildreqs{$cand}}; + last; + } + } + foreach my $cand (keys %extra_reqs) { + if ($rpm =~ /^$cand/) { + $fluteopts .= join "", map { "--requires $_ " } @{$extra_reqs{$cand}}; + last; + } + } + print "cpanflute2 --just-spec --noperlreqs --email='$opts{packager}' --release=$rel $fluteopts $tarball > $specfile;\n"; + # Should fix up the .spec file + print "perl -pi -e 's/perl\\(perl\\)/perl/g' $specfile;\n"; + my $tarballdir = `dirname $tarball` or die "Can't find tarball for $name: $tarball\n"; + chomp($tarballdir); + print "rpmbuild -bs --nodeps --define '_sourcedir $tarballdir' --define '_srcrpmdir $srpmdir' $specfile\n"; + print "# Generates: $srpmdir/perl-$rpm-$rel.src.rpm\n"; +} + diff --git a/rpm/build/refresh-repo b/rpm/build/refresh-repo new file mode 100755 index 000000000..32d07ad97 --- /dev/null +++ b/rpm/build/refresh-repo @@ -0,0 +1,164 @@ +#!/bin/sh +# +# Copyright 2008, Elirion, Inc. All rights reserved. +# This software is licensed under the same terms as Freeside itself. +# +# This script iterates through all the specified Freeside repositories, running +# both yum-arch and createrepo to update the yum repository meta-data. +# The script should be run after the repository contents are changed. +# +# TBD: Run yum-arch, createrepo, or both, as appropriate for the distro and version +# the repository is targetted for. +# +DISTROS='centos sles' +CENTOSVERS='4 5' +SLESVERS=10 +WHICHVERS= +VERSIONS='1.7 1.9' +ARCHS='i386 x86_64' +REPOS='testing stable prerelease' +RPMS= +KEYID=rsiddall +SAVEDIR=$HOME + +REPOBASEFOLDER=/var/www/html + +QUIET_FLAG= + +BUILDSYSDIR=`dirname $0` + +if [ -f $BUILDSYSDIR/buildsysrc ]; then + #chmod a+x $BUILDSYSDIR/buildsysrc + #echo $BUILDSYSDIR/buildsysrc + . $BUILDSYSDIR/buildsysrc +fi +if [ -f $HOME/buildsysrc ]; then + #chmod a+x $HOME/buildsysrc + #echo $HOME/buildsysrc + . $HOME/buildsysrc +fi + + +usage() { + echo "refresh-repo: refresh yum metadata for all yum repositories" + echo "where:" + echo " -a <archs>: change architectures (currently: $ARCHS)" + echo " -d <distros>: change distributions (currently: $DISTROS)" + echo " -r <repos>: change repositories (currently: $REPOS)" + echo " -v <versions>: change versions (currently: $VERSIONS)" + echo " -w <distvers>: change distro version (currently: $WHICHVERS)" + exit 0 +} + +while getopts "a:d:hqr:v:w:" flag +do + case $flag in + a) + echo "Changing architectures from $ARCHS to $OPTARG" + ARCHS=$OPTARG;; + d) + echo "Changing distros from $DISTROS to $OPTARG" + DISTROS=$OPTARG;; + q) + echo "Quiet mode" + QUIET_FLAG=-q;; + r) + echo "Changing repository from $REPOS to $OPTARG" + REPOS=$OPTARG;; + v) + echo "Changing versions from $VERSIONS to $OPTARG" + VERSIONS=$OPTARG;; + w) + echo "Changing which distro versions from $WHICHVERS to $OPTARG" + WHICHVERS=$OPTARG;; + *) + usage;; + esac +done + +#for DISTRO in ${DISTROS}; do +# for VERSION in ${VERSIONS}; do +# for REPO in ${REPOS}; do +# for ARCH in ${ARCHS}; do +# # Determine which RPMs need to be signed +# NEWRPMS=`rpm --checksig $REPOBASEFOLDER/repo/$DISTROS/$DISTVERS/freeside-${VERSION}/${REPO}/${ARCH}/*.rpm | grep -v ' gpg ' | cut -d ':' -f 1 | tr '\n' ' '` +# RPMS=`echo "$RPMS $NEWRPMS"` +# done +# done +# done +#done +##rpm --addsign $RPMS +#for RPM in $RPMS; do +# ./expect-addsign $RPM +#done +for DISTRO in ${DISTROS}; do + for VERSION in ${VERSIONS}; do + for REPO in ${REPOS}; do + for ARCH in ${ARCHS}; do + if [ "${WHICHVERS}x" = "x" ]; then + if [ "$DISTRO" = "centos" ]; then + DISTVERS=$CENTOSVERS + fi + if [ "$DISTRO" = "sles" ]; then + DISTVERS=$SLESVERS + fi + else + DISTVERS=$WHICHVERS + fi + for distver in $DISTVERS + do + # Update the repo information + echo "${DISTRO}-${distver}: $VERSION - $REPO - $ARCH" + DIR=$REPOBASEFOLDER/repo/$DISTRO/$distver/freeside-${VERSION}/${REPO}/${ARCH} + if [ -d $DIR ] + then + # SLES requires signed repodata. Save any existing files so we don't regenerate + for ext in asc key + do + if [ -e $DIR/repodata/repomd.xml.${ext} ] + then + mv $DIR/repodata/repomd.xml.${ext} $SAVEDIR + fi + done + if [ "$DISTRO" = "sles" ] + then + for file in $DIR/freeside-mysql-*.rpm + do + mv $file $file.old + done + for file in $DIR/freeside-selfservice-*.rpm + do + mv $file $DIR/../self-service/$ARCH + done + fi + if [ "$DISTRO-$distver" = "centos-4" ] + then + yum-arch $QUIET_FLAG $DIR/ + fi +# createrepo $QUIET_FLAG --checkts $DIR/ + createrepo $QUIET_FLAG $DIR/ + if [ "$DISTRO" = "sles" ] + then + # SLES requires signed repodata... + if [ -e $SAVEDIR/repomd.xml.asc ] + then + mv $SAVEDIR/repomd.xml.asc $DIR/repodata + fi + +# gpg -sab --yes -u "$KEYID" -o $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml + ./expect-signrepo $KEYID $DIR/repodata/repomd.xml.asc $DIR/repodata/repomd.xml + if [ -e $SAVEDIR/repomd.xml.key ] + then + mv $SAVEDIR/repomd.xml.key $DIR/repodata + else + gpg -a --yes -u "$KEYID" --export -o $DIR/repodata/repomd.xml.key + fi + fi + else + echo "No such folder $DIR - skipping" + fi + done + done + done + done +done diff --git a/rpm/freeside-selfservice.conf b/rpm/freeside-selfservice.conf new file mode 100644 index 000000000..f2c103b2c --- /dev/null +++ b/rpm/freeside-selfservice.conf @@ -0,0 +1,11 @@ +ScriptAlias /selfservice %%%FREESIDE_SELFSERVICE_DOCUMENT_ROOT%%%/cgi + +<Directory %%%FREESIDE_SELFSERVICE_DOCUMENT_ROOT%%%/cgi> +SSLRequireSSL +DirectoryIndex selfservice.cgi +AllowOverride None +Options +ExecCGI -Includes +Order deny,allow +Allow from all +SetHandler cgi-script +</Directory> diff --git a/rpm/freeside.spec b/rpm/freeside.spec new file mode 100644 index 000000000..d9d2596a1 --- /dev/null +++ b/rpm/freeside.spec @@ -0,0 +1,492 @@ +%{!?_initrddir:%define _initrddir /etc/rc.d/init.d} +%{!?version:%define version 2.1.0} +%{!?release:%define release 8} + +Summary: Freeside ISP Billing System +Name: freeside +Version: %{version} +Release: %{release} +License: AGPLv3 +Group: Applications/Internet +URL: http://www.sisd.com/freeside/ +Vendor: Freeside +Source: http://www.sisd.com/freeside/%{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +BuildArch: noarch +Requires: %{name}-frontend +Requires: %{name}-backend +%if "%{_vendor}" != "suse" +Requires: tetex-latex +Requires: ghostscript +%else +Requires: te_latex +Requires: ghostscript-library +%endif +Requires: perl-Fax-Hylafax-Client + +%if "%{_vendor}" != "suse" +%define apache_conffile /etc/httpd/conf/httpd.conf +%define apache_confdir /etc/httpd/conf.d +%define apache_version 2 +%define freeside_document_root /var/www/freeside +%define freeside_selfservice_document_root /var/www/freeside-selfservice +%else +%define apache_conffile /etc/apache2/uid.conf +%define apache_confdir /etc/apache2/conf.d +%define apache_version 2 +%define freeside_document_root /srv/www/freeside +%define freeside_selfservice_document_root /srv/www/freeside-selfservice +%endif +# Can change this back to /var/cache/subsys/freeside when cache relocation is fixed and released +%define freeside_cache /etc/freeside +%define freeside_conf /etc/freeside +%define freeside_export /etc/freeside +%define freeside_lock /var/lock/freeside +%define freeside_log /var/log/freeside +%define freeside_socket /etc/freeside +%define rt_enabled 0 +%define fs_queue_user fs_queue +%define fs_selfservice_user fs_selfservice +%define fs_cron_user fs_daily +%define db_types Pg mysql + +%define texmflocal /usr/share/texmf + +%define _rpmlibdir /usr/lib/rpm +%define rpmfiles rpm + +%description +Freeside is a flexible ISP billing system + +%package mason +Summary: HTML::Mason interface for %{name} +Group: Applications/Internet +Prefix: %{freeside_document_root} +%if "%{_vendor}" != "suse" +Requires: mod_ssl +%endif +Requires: perl-Apache-DBI +Provides: %{name}-frontend = %{version} +BuildArch: noarch + +%description mason +This package includes the HTML::Mason web interface for %{name}. +You should install only one %{name} web interface. + +%package postgresql +Summary: PostgreSQL backend for %{name} +Group: Applications/Internet +Requires: perl-DBI +Requires: perl-DBD-Pg >= 1.32 +Requires: %{name} +Conflicts: %{name}-mysql +Provides: %{name}-backend = %{version} + +%description postgresql +This package includes the PostgreSQL database backend for %{name}. +You should install only one %{name} database backend. +Please note that this RPM does not create the database or database user; it only installs the required drivers. + +%package mysql +Summary: MySQL database backend for %{name} +Group: Applications/Internet +Requires: perl-DBI +Requires: perl-DBD-MySQL +Requires: %{name} +Conflicts: %{name}-postgresql +Provides: %{name}-backend = %{version} + +%description mysql +This package includes the MySQL database backend for %{name}. +You should install only one %{name} database backend. +Please note that this RPM does not create the database or database user; it only installs the required drivers. + +%package selfservice +Summary: Self-service interface for %{name} +Group: Applications/Internet +Requires: %{name}-selfservice-cgi + +%description selfservice +This package installs the Perl modules and CGI scripts for the self-service interface for %{name}. +For security reasons, it is set to conflict with %{name} as you should not install the billing system and self-service interface on the same computer. + +%package selfservice-core +Summary: Core Perl libraries for the self-service interface for %{name} +Group: Applications/Internet + +%description selfservice-core +This package installs the Perl modules and client daemon for the self-service interface for %{name}. It does not install the CGI interface and can be used with a different front-end. +For security reasons, it is set to conflict with %{name} as you should not install the billing system and self-service interface on the same computer. + +%package selfservice-cgi +Summary: CGI scripts for the self-service interface for %{name} +Group: Applications/Internet +Requires: %{name}-selfservice-core +Prefix: %{freeside_selfservice_document_root} + +%description selfservice-cgi +This package installs the CGI scripts for the self-service interface for %{name}. The scripts use some core libraries packaged in a separate RPM. +For security reasons, it is set to conflict with %{name} as you should not install the billing system and self-service interface on the same computer. + +%package selfservice-php +Summary: Sample PHP files for the self-service interface for %{name} +Group: Applications/Internet +Prefix: %{freeside_selfservice_document_root} + +%description selfservice-php +This package installs the sample PHP scripts for the self-service interface for %{name}. +For security reasons, it is set to conflict with %{name} as you should not install the billing system and self-service interface on the same computer. + +%prep +%setup -q +%{__rm} -f bin/pod2x # Only useful to Ivan Kohler now +perl -pi -e 's|/usr/local/bin|%{_bindir}|g' FS/Makefile.PL +# RPM handles changing file ownership, so Makefile shouldn't +perl -pi -e 's/\s+-o\s+(freeside|root)(\s+-g\s+\$\{\w+\})?\s+/ /g' Makefile +perl -ni -e 'print if !/\s+chown\s+/;' Makefile + +# Fix-ups for self-service. Should merge this into Makefile +perl -pi -e 's|/usr/local/sbin|%{_sbindir}|g' FS/bin/freeside-selfservice-server +perl -pi -e 's|/usr/local/bin|%{_bindir}|g' fs_selfservice/FS-SelfService/Makefile.PL +perl -pi -e 's|/usr/local/sbin|%{_sbindir}|g' fs_selfservice/FS-SelfService/Makefile.PL +perl -pi -e 's|/usr/local/freeside|%{freeside_socket}|g' fs_selfservice/FS-SelfService/*.pm +perl -pi -e 's|socket\s*=\s*"/usr/local/freeside|socket = "%{freeside_socket}|g' fs_selfservice/FS-SelfService/freeside-selfservice-* +perl -pi -e 's|log_file\s*=\s*"/usr/local/freeside|log_file = "%{freeside_log}|g' fs_selfservice/FS-SelfService/freeside-selfservice-* +perl -pi -e 's|lock_file\s*=\s*"/usr/local/freeside|lock_file = "%{freeside_lock}|g' fs_selfservice/FS-SelfService/freeside-selfservice-* + +# Fix-ups for SuSE +%if "%{_vendor}" == "suse" +perl -pi -e 's|htpasswd|/usr/sbin/htpasswd2|g if /system/;' FS/FS/access_user.pm +perl -pi -e 'print "Order deny,allow\nAllow from all\n" if /<Files/i;' htetc/freeside*.conf +%endif + +# Override find-requires/find-provides to supplement Perl requires for HTML::Mason file handler.pl +cat << \EOF > %{name}-req +#!/bin/sh +tee %{_tmppath}/filelist | %{_rpmlibdir}/rpmdeps --requires | grep -v -E '^perl\(the\)$' \ +| grep -v -E '^perl\((lib|strict|vars|RT)\)$' \ +| grep -v -E '^perl\(RT::' \ +| grep -v -E '^perl\(FS::' \ +| sort -u +grep handler.pl %{_tmppath}/filelist | xargs %{_rpmlibdir}/perldeps.pl --requires \ +| grep -v -E '^perl\((lib|strict|vars|RT)\)$' \ +| grep -v -E '^perl\(RT::' \ +| sort -u +EOF + +%define __find_provides %{_rpmlibdir}/rpmdeps --provides +%define __find_requires %{_builddir}/%{name}-%{version}/%{name}-req +%{__chmod} +x %{__find_requires} +%define _use_internal_dependency_generator 0 + +%build + +# False laziness... +# The htmlman target now makes wiki documentation. Let's pretend we made it. +touch htmlman +%{__make} alldocs + +#perl -pi -e 's|%%%%%%VERSION%%%%%%|%{version}|g' FS/bin/* +cd FS +if [ "%{_vendor}" = "suse" ]; then + CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL +else + CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix} SITELIBEXP=$RPM_BUILD_ROOT%{perl_sitelib} SITEARCHEXP=$RPM_BUILD_ROOT%{perl_sitearch} INSTALLSCRIPT=$RPM_BUILD_ROOT%{_bindir} +fi +%{__make} OPTIMIZE="$RPM_OPT_FLAGS" +cd .. +%{__make} perl-modules RT_ENABLED=%{rt_enabled} FREESIDE_CACHE=%{freeside_cache} FREESIDE_CONF=%{freeside_conf} FREESIDE_EXPORT=%{freeside_export} FREESIDE_LOCK=%{freeside_lock} FREESIDE_LOG=%{freeside_log} +touch perl-modules + +cd fs_selfservice/FS-SelfService +if [ "%{_vendor}" = "suse" ]; then + CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL +else + CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix} SITELIBEXP=$RPM_BUILD_ROOT%{perl_sitelib} SITEARCHEXP=$RPM_BUILD_ROOT%{perl_sitearch} INSTALLSCRIPT=$RPM_BUILD_ROOT%{_sbindir} +fi +%{__make} OPTIMIZE="$RPM_OPT_FLAGS" +cd ../.. + +%install +%{__rm} -rf %{buildroot} + +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_document_root} + +touch install-perl-modules perl-modules +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_cache} +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_conf} +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_export} +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_lock} +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_log} +for DBTYPE in %{db_types}; do + %{__mkdir_p} $RPM_BUILD_ROOT/tmp + [ -d $RPM_BUILD_ROOT%{freeside_conf}/default_conf ] && %{__rm} -rf $RPM_BUILD_ROOT%{freeside_conf}/default_conf + %{__make} create-config DB_TYPE=$DBTYPE DATASOURCE=DBI:$DBTYPE:dbname=%{name} RT_ENABLED=%{rt_enabled} FREESIDE_CACHE=$RPM_BUILD_ROOT%{freeside_cache} FREESIDE_CONF=$RPM_BUILD_ROOT/tmp FREESIDE_EXPORT=$RPM_BUILD_ROOT%{freeside_export} FREESIDE_LOCK=$RPM_BUILD_ROOT%{freeside_lock} FREESIDE_LOG=$RPM_BUILD_ROOT%{freeside_log} DIST_CONF=$RPM_BUILD_ROOT%{freeside_conf}/default_conf + %{__mv} $RPM_BUILD_ROOT/tmp/secrets $RPM_BUILD_ROOT%{freeside_conf} + %{__rm} -rf $RPM_BUILD_ROOT/tmp +done +%{__rm} install-perl-modules perl-modules $RPM_BUILD_ROOT%{freeside_conf}/default_conf/ticket_system + +touch docs +%{__perl} -pi -e "s|%%%%%%FREESIDE_DOCUMENT_ROOT%%%%%%|%{freeside_document_root}|g" htetc/handler.pl +%{__make} install-docs RT_ENABLED=%{rt_enabled} PREFIX=$RPM_BUILD_ROOT%{_prefix} TEMPLATE=mason FREESIDE_DOCUMENT_ROOT=$RPM_BUILD_ROOT%{freeside_document_root} MASON_HANDLER=$RPM_BUILD_ROOT%{freeside_conf}/handler.pl MASONDATA=$RPM_BUILD_ROOT%{freeside_cache}/masondata +%{__perl} -pi -e "s|$RPM_BUILD_ROOT||g" $RPM_BUILD_ROOT%{freeside_conf}/handler.pl +%{__rm} docs + +# Install the init script +%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir} +%{__make} install-init INSTALLGROUP=root INIT_FILE=$RPM_BUILD_ROOT%{_initrddir}/%{name} QUEUED_USER=%{fs_queue_user} SELFSERVICE_USER=%{fs_selfservice_user} SELFSERVICE_MACHINES= INIT_INSTALL= +%{__perl} -pi -e "\ + s|/etc/default|/etc/sysconfig|g;\ + " $RPM_BUILD_ROOT%{_initrddir}/%{name} + +# Install the HTTPD configuration snippet for HTML::Mason +%{__mkdir_p} $RPM_BUILD_ROOT%{apache_confdir} +%{__make} install-apache FREESIDE_DOCUMENT_ROOT=%{freeside_document_root} RT_ENABLED=%{rt_enabled} APACHE_CONF=$RPM_BUILD_ROOT%{apache_confdir} APACHE_VERSION=%{apache_version} FREESIDE_CONF=%{freeside_conf} MASON_HANDLER=%{freeside_conf}/handler.pl +%{__perl} -pi -e 'print "Alias /%{name} %{freeside_document_root}\n\n" if /^<Directory/;' $RPM_BUILD_ROOT%{apache_confdir}/freeside-*.conf +%{__perl} -pi -e 'print "SSLRequireSSL\n" if /^AuthName/i;' $RPM_BUILD_ROOT%{apache_confdir}/freeside-*.conf + +# Make lists of the database-specific configuration files +for DBTYPE in %{db_types}; do + echo "%%attr(600,freeside,freeside) %{freeside_conf}/secrets" > %{name}-%{version}-%{release}-$DBTYPE-filelist + for DIR in `echo -e "%{freeside_conf}\n%{freeside_cache}\n%{freeside_export}\n" | sort | uniq`; do + find $RPM_BUILD_ROOT$DIR -type f -print | \ + grep ":$DBTYPE:" | \ + sed "s@^$RPM_BUILD_ROOT@%%attr(640,freeside,freeside) %%config(noreplace) @g" >> %{name}-%{version}-%{release}-$DBTYPE-filelist + find $RPM_BUILD_ROOT$DIR -type d -print | \ + grep ":$DBTYPE:" | \ + sed "s@^$RPM_BUILD_ROOT@%%attr(711,freeside,freeside) %%dir @g" >> %{name}-%{version}-%{release}-$DBTYPE-filelist + done + if [ "$(cat %{name}-%{version}-%{release}-$DBTYPE-filelist)X" = "X" ] ; then + echo "ERROR: EMPTY FILE LIST" + exit 1 + fi +done + +# Make a list of the Mason files before adding self-service, etc. +echo "%attr(-,freeside,freeside) %{freeside_conf}/handler.pl" > %{name}-%{version}-%{release}-mason-filelist +find $RPM_BUILD_ROOT%{freeside_document_root} -type f -print | \ + sed "s@^$RPM_BUILD_ROOT@@g" >> %{name}-%{version}-%{release}-mason-filelist +if [ "$(cat %{name}-%{version}-%{release}-mason-filelist)X" = "X" ] ; then + echo "ERROR: EMPTY FILE LIST" + exit 1 +fi + +# Install all the miscellaneous binaries into /usr/share or similar +%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/bin +%{__install} bin/* $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/bin + +%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +%{__install} %{rpmfiles}/freeside.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} + +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root} +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/images +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/misc +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/php +%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/templates +%{__install} fs_selfservice/FS-SelfService/cgi/{*.cgi,*.html,*.gif} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi +%{__install} fs_selfservice/FS-SelfService/cgi/images/* $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/images +%{__install} fs_selfservice/FS-SelfService/cgi/misc/* $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/misc +%{__install} fs_selfservice/php/* $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/php +%{__install} fs_selfservice/FS-SelfService/*.template $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/templates + +# Install the main billing server Perl files +cd FS +eval `perl '-V:installarchlib'` +%{__mkdir_p} $RPM_BUILD_ROOT$installarchlib +%makeinstall PREFIX=$RPM_BUILD_ROOT%{_prefix} +%{__rm} -f `find $RPM_BUILD_ROOT -type f -name perllocal.pod -o -name .packlist` + +[ -x %{_rpmlibdir}/brp-compress ] && %{_rpmlibdir}/brp-compress + +find $RPM_BUILD_ROOT%{_prefix} -type f -print | \ + grep -v '/etc/freeside/conf' | \ + grep -v '/etc/freeside/secrets' | \ + sed "s@^$RPM_BUILD_ROOT@@g" > %{name}-%{version}-%{release}-filelist +if [ "$(cat %{name}-%{version}-%{release}-filelist)X" = "X" ] ; then + echo "ERROR: EMPTY FILE LIST" + exit 1 +fi +cd .. + +# Install the self-service interface Perl files +cd fs_selfservice/FS-SelfService +%{__mkdir_p} $RPM_BUILD_ROOT%{_prefix}/local/bin +%makeinstall +%{__rm} -f `find $RPM_BUILD_ROOT -type f -name perllocal.pod -o -name .packlist` + +[ -x %{_rpmlibdir}/brp-compress ] && %{_rpmlibdir}/brp-compress + +find $RPM_BUILD_ROOT%{_prefix} -type f -print | \ + grep -v '/etc/freeside/conf' | \ + grep -v '/etc/freeside/secrets' | \ + sed "s@^$RPM_BUILD_ROOT@@g" > %{name}-%{version}-%{release}-temp-filelist +cat ../../FS/%{name}-%{version}-%{release}-filelist %{name}-%{version}-%{release}-temp-filelist | sort | uniq -u > %{name}-%{version}-%{release}-selfservice-core-filelist +if [ "$(cat %{name}-%{version}-%{release}-selfservice-core-filelist)X" = "X" ] ; then + echo "ERROR: EMPTY FILE LIST" + exit 1 +fi +cd ../.. + +# Install the Apache configuration file for self-service +%{__install} %{rpmfiles}/freeside-selfservice.conf $RPM_BUILD_ROOT%{apache_confdir}/%{name}-selfservice.conf +%{__perl} -pi -e "s|%%%%%%FREESIDE_SELFSERVICE_DOCUMENT_ROOT%%%%%%|%{freeside_selfservice_document_root}|g" $RPM_BUILD_ROOT%{apache_confdir}/%{name}-selfservice.conf + +# This is part of Makefile's install-texmf. The rest is in triggers. These files are not in the filelist +%{__install} -D etc/fslongtable.sty $RPM_BUILD_ROOT%{texmflocal}/tex/generic/fslongtable.sty + +%pre +if ! %{__id} freeside &>/dev/null; then +%if "%{_vendor}" == "suse" + /usr/sbin/groupadd freeside +%endif + /usr/sbin/useradd -m freeside +fi + +%pre mason +if ! %{__id} freeside &>/dev/null; then +%if "%{_vendor}" == "suse" + /usr/sbin/groupadd freeside +%endif + /usr/sbin/useradd -m freeside +fi + +%pre postgresql +if ! %{__id} freeside &>/dev/null; then +%if "%{_vendor}" == "suse" + /usr/sbin/groupadd freeside +%endif + /usr/sbin/useradd -m freeside +fi + +%pre mysql +if ! %{__id} freeside &>/dev/null; then +%if "%{_vendor}" == "suse" + /usr/sbin/groupadd freeside +%endif + /usr/sbin/useradd -m freeside +fi + +%pre selfservice-cgi +if ! %{__id} freeside &>/dev/null; then +%if "%{_vendor}" == "suse" + /usr/sbin/groupadd freeside +%endif + /usr/sbin/useradd -m freeside +fi + +%post +if [ -x /sbin/chkconfig ]; then + /sbin/chkconfig --add freeside +fi +#if [ $1 -eq 2 -a -x /usr/bin/freeside-upgrade ]; then +# /usr/bin/freeside-upgrade +#fi + +%post postgresql +if [ -f %{freeside_conf}/secrets ]; then + perl -p -i.fsbackup -e 's/^DBI:.*?:/DBI:Pg:/' %{freeside_conf}/secrets +fi + +%post mysql +if [ -f %{freeside_conf}/secrets ]; then + perl -p -i.fsbackup -e 's/^DBI:.*?:/DBI:mysql:/' %{freeside_conf}/secrets +fi + +%post mason +# Make local httpd run with User/Group = freeside +if [ -f %{apache_conffile} ]; then +%if "%{_vendor}" != "suse" + perl -p -i.fsbackup -e 's/^(User|Group) .*/$1 freeside/' %{apache_conffile} +%else + perl -p -i.fsbackup -e 's/^(User) .*/$1 freeside/' %{apache_conffile} +%endif +fi +# Fix up environment so pslatex will run +%if "%{_vendor}" == "suse" +if ! %{__grep} TEXINPUTS /etc/profile.local >/dev/null; then + echo "unset TEXINPUTS" >>/etc/profile.local +fi +if ! %{__grep} TEXINPUTS /etc/init.d/apache2 >/dev/null; then + perl -p -i.fsbackup -e 'print "unset TEXINPUTS\n\n" if /^httpd_conf\s*=\s*/;' /etc/init.d/apache2 +fi +%endif + +%triggerin -- tetex +#texhash `kpsewhich -expand-var \$TEXMFLOCAL` +texhash %{texmflocal} + +%clean +%{__rm} -rf %{buildroot} + +%files -f FS/%{name}-%{version}-%{release}-filelist +%attr(0711,root,root) %{_initrddir}/%{name} +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%defattr(-,freeside,freeside,-) +%doc README INSTALL CREDITS AGPL +%attr(-,freeside,freeside) %dir %{freeside_conf} +%attr(-,freeside,freeside) %dir %{freeside_lock} +%attr(-,freeside,freeside) %dir %{freeside_log} +%attr(0711,freeside,freeside) %config(noreplace) %{freeside_conf}/default_conf +%attr(0644,freeside,freeside) %config(noreplace) %{freeside_conf}/default_conf/* +%attr(444,root,root) %{texmflocal}/tex/generic/fslongtable.sty + +%files mason -f %{name}-%{version}-%{release}-mason-filelist +%defattr(-, freeside, freeside, 0755) +%attr(-,freeside,freeside) %{freeside_cache}/masondata +%attr(0644,root,root) %config(noreplace) %{apache_confdir}/%{name}-base%{apache_version}.conf + +%files postgresql -f %{name}-%{version}-%{release}-Pg-filelist + +%files mysql -f %{name}-%{version}-%{release}-mysql-filelist + +%files selfservice +%defattr(-, freeside, freeside, 0644) +%attr(0644,root,root) %config(noreplace) %{apache_confdir}/%{name}-selfservice.conf + +%files selfservice-core -f fs_selfservice/FS-SelfService/%{name}-%{version}-%{release}-selfservice-core-filelist +%defattr(-, freeside, freeside, 0644) +%attr(-,freeside,freeside) %dir %{freeside_socket} +%attr(-,freeside,freeside) %dir %{freeside_lock} +%attr(-,freeside,freeside) %dir %{freeside_log} + +%files selfservice-cgi +%defattr(-, freeside, freeside, 0644) +%attr(0711,freeside,freeside) %{freeside_selfservice_document_root}/cgi +%attr(0644,freeside,freeside) %{freeside_selfservice_document_root}/templates + +%files selfservice-php +%defattr(-, freeside, freeside, 0644) +%attr(0755,freeside,freeside) %{freeside_selfservice_document_root}/php + +%changelog +* Thu Jun 11 2009 Richard Siddall <richard.siddall@elirion.net> - 1.9-8 +- Since configuration is now kept in the RDBMS, don't install a configuration folder + +* Mon Dec 22 2008 Richard Siddall <richard.siddall@elirion.net> - 1.9-5 +- Modifications to make self-service work if you really insist on installing it on the same machine as Freeside + +* Tue Dec 9 2008 Richard Siddall <richard.siddall@elirion.net> - 1.9-4 +- Cleaning up after rpmlint + +* Tue Aug 26 2008 Richard Siddall <richard.siddall@elirion.net> - 1.9-3 +- More revisions for self-service interface + +* Sat Aug 23 2008 Richard Siddall <richard.siddall@elirion.net> - 1.7.3-2 +- Revisions for self-service interface +- RT support is still missing + +* Sun Jul 8 2007 Richard Siddall <richard.siddall@elirion.net> - 1.7.3 +- Updated for upcoming Freeside 1.7.3 +- RT support is still missing + +* Fri Jun 29 2007 Richard Siddall <richard.siddall@elirion.net> - 1.7.2 +- Updated for Freeside 1.7.2 +- Removed support for Apache::ASP + +* Wed Oct 12 2005 Richard Siddall <richard.siddall@elirion.net> - 1.5.7 +- Added self-service package + +* Sun Feb 06 2005 Richard Siddall <richard.siddall@elirion.net> - 1.5.0pre6-1 +- Initial package diff --git a/rpm/freeside.sysconfig b/rpm/freeside.sysconfig new file mode 100644 index 000000000..baa04622c --- /dev/null +++ b/rpm/freeside.sysconfig @@ -0,0 +1,5 @@ +QUEUED_USER=fs_queue +#RADACCTD_USER= +# +SELFSERVICE_USER=fs_selfservice +#SELFSERVICE_MACHINES= diff --git a/rpm/rpm2Bundle b/rpm/rpm2Bundle new file mode 100755 index 000000000..1bc877124 --- /dev/null +++ b/rpm/rpm2Bundle @@ -0,0 +1,111 @@ +#!/usr/bin/perl -Tw +# +# Make a bundle file from an RPM +# +use strict; + +$ENV{PATH} = '/bin:/usr/bin/'; + +my $verbose = 0; + +# These are Perl dependencies that should be ignored/suppressed +my %suppress; + +foreach (qw/strict subs vars base lib warnings FS/) { + $suppress{$_} = $_; +} + +# These are Perl modules corresponding to RPM names. +# Add entries when the mapping isn't simply "remove leading 'perl-' and replace - with ::" +my %rpm2mod=( + 'DBD-MySQL' => 'DBD::mysql', +); + +## These are root packages that shouldn't be cited multiple times +## Should figure this out with CPAN +#my %rootpkgs; +# +#foreach (qw/FS/) { +# $rootpkgs{$_} = 1; +#} + +foreach my $rawrpm (@ARGV) { + $rawrpm =~ /^([-\.a-z0-9\/]+)\s*$/i; + my $rpm = $1 or next; + my @parts = split '/', $rpm; + my $name = pop @parts; + my $version = 0.01; + if ($name =~ m<([^/]+?)[-._]?v?-?([-_.\d]+[a-z]*?\d*)\.\w+\.rpm$>) { + $name = $1; + $version = $2; + } + print STDERR "rpm: $rpm ($name, $version)\n"; + my @deps = sort `rpm -qp --requires $rpm`; + + my %mods; + + foreach (@deps) { + if (/^perl\((.*?)\)\s*((>=|=|<=)\s+([\d\.]+))?$/ + || /^perl-(.*?)\s*((>=|=|<=)\s+([\d\.]+))?$/) { + my ($mod, $rel, $ver) = ($1, $3, $4); + if (/^perl-/) { + print STDERR "\"$mod\"\n" if $verbose; + $mod = $rpm2mod{$mod} if exists($rpm2mod{$mod}); + $mod =~ s/-/::/g + } + next if exists($suppress{$mod}); + my @parts = split /::/, $mod; + if (scalar @parts > 1) { + next if exists($suppress{$parts[0]}); + } + if ($verbose) { + print STDERR "$mod"; + print STDERR " $rel $ver" if $ver; + print STDERR "\n"; + } + $mods{$mod} = $ver ? $ver : undef; # Should also save $rel + } + } + + my $hdr =<<END; +# -*- perl -*- + +package Bundle::$name; + +\$VERSION = '$version'; + +1; + +__END__ + +=head1 NAME + +Bundle::$name - A bundle to install prerequisites for the $name package + +=head1 SYNOPSIS + +C<perl -MCPAN -e 'install Bundle::$name'> + +=head1 CONTENTS + +END + + my $ftr =<<END; +=head1 DESCRIPTION + +This bundle includes all prerequisites needed by the $name package. + +=cut +END + + print $hdr; + foreach (sort keys %mods) { + print "$_"; + print " $mods{$_}" if exists($mods{$_}) && $mods{$_}; + print " -\n\n"; + } + print $ftr; +} + +1; + |