[freeside-commits] freeside/rpm/build/native Ovid.diff, NONE, 1.1 build-from-cvs, NONE, 1.1 freeside-cvs, NONE, 1.1 makesrpm, NONE, 1.1 ovid-0.12-1.x86_64.rpm, NONE, 1.1 ovid2flute, NONE, 1.1

Ivan,,, ivan at wavetail.420.am
Thu Jul 8 02:32:16 PDT 2010


Update of /home/cvs/cvsroot/freeside/rpm/build/native
In directory wavetail.420.am:/tmp/cvs-serv32484/native

Added Files:
	Ovid.diff build-from-cvs freeside-cvs makesrpm 
	ovid-0.12-1.x86_64.rpm ovid2flute 
Log Message:
checking in more of the rpm build system (is that it?)

--- NEW FILE: build-from-cvs ---
#!/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

--- NEW FILE: ovid-0.12-1.x86_64.rpm ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: freeside-cvs ---
export CVSROOT=":pserver:anonymous:anonymous at cvs.freeside.biz:/home/cvs/cvsroot"
export CVS_RSH="ssh"

--- NEW FILE: ovid2flute ---
#!/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 at 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";
}


--- NEW FILE: makesrpm ---
#!/bin/sh

cpanflute2 --just-spec --noperlreqs --email='Ivan Kohler <ivan at 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

--- NEW FILE: Ovid.diff ---
--- 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




More information about the freeside-commits mailing list