summaryrefslogtreecommitdiff
path: root/rpm/build
diff options
context:
space:
mode:
Diffstat (limited to 'rpm/build')
-rw-r--r--rpm/build/BOOTSTRAP146
-rwxr-xr-xrpm/build/build-freeside192
-rwxr-xr-xrpm/build/buildsysrc14
-rwxr-xr-xrpm/build/cvs-check-and-build45
-rwxr-xr-xrpm/build/enrpm178
-rwxr-xr-xrpm/build/expect-addsign8
-rwxr-xr-xrpm/build/expect-signrepo9
-rw-r--r--rpm/build/mock/centos-5-i386.cfg87
-rw-r--r--rpm/build/mock/centos-5-x86_64.cfg88
-rw-r--r--rpm/build/mock/defaults.cfg39
-rw-r--r--rpm/build/mock/logging.ini84
-rw-r--r--rpm/build/mock/site-defaults.cfg98
-rw-r--r--rpm/build/mock/sles-10-i386.cfg59
-rw-r--r--rpm/build/mock/sles-10-x86_64.cfg59
-rw-r--r--rpm/build/native/Ovid.diff30
-rwxr-xr-xrpm/build/native/build-from-cvs75
-rwxr-xr-xrpm/build/native/freeside-cvs2
-rwxr-xr-xrpm/build/native/makesrpm5
-rw-r--r--rpm/build/native/ovid-0.12-1.x86_64.rpmbin0 -> 16220 bytes
-rwxr-xr-xrpm/build/native/ovid2flute141
-rwxr-xr-xrpm/build/ovid2flute139
-rwxr-xr-xrpm/build/refresh-repo164
22 files changed, 1662 insertions, 0 deletions
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
new file mode 100644
index 000000000..363e08922
--- /dev/null
+++ b/rpm/build/native/ovid-0.12-1.x86_64.rpm
Binary files differ
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