summaryrefslogtreecommitdiff
path: root/rpm/build/native
diff options
context:
space:
mode:
authorivan <ivan>2010-07-08 09:32:14 +0000
committerivan <ivan>2010-07-08 09:32:14 +0000
commitb80e996959d9492e07ada4936e566f4b97dd5808 (patch)
tree799ebb4bfac16b7e6230fa379668987a7153bcf5 /rpm/build/native
parentb87e4baaaafca4040c13f1bac4ca22bacc3e668e (diff)
checking in more of the rpm build system (is that it?)
Diffstat (limited to 'rpm/build/native')
-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
6 files changed, 253 insertions, 0 deletions
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..5e26711d5
--- /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/rsiddall/work/redhat/SPECS";
+$specfiledir = "/home/rsiddall/redhat/SPECS" if ! -d $specfiledir;
+my $srpmdir="/home/rsiddall/work/redhat/SRPMS";
+$srpmdir = "/home/rsiddall/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/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";
+}
+