Michael Stahnke wrote: > srpm task builds a srpm without deps so it can be built using mock > or some other formal build system tool.
Nice. Worth noting is that without the definitions set on Fedora (and
RHEL 6) systems or by a build tool like mock, certains conditional
bits in the package will not be set properly during a local build. We
could (and probably should) either guess them based on the host or
allow them to be passed in as variables/options.
> rpm builds the binary and srouce rpm locally and of course will
> require all of the rpmbuild lity set and whatever puppet requires to
> be built.
s/srouce/source ;)
I don't understand the phrase "all of the rpmbuild lity set."
> diff --git a/tasks/rake/rpm.rake b/tasks/rake/rpm.rake
> new file mode 100644
> index 0000000..c4f4fc8
> --- /dev/null
> +++ b/tasks/rake/rpm.rake
> @@ -0,0 +1,80 @@
> +PWD=`pwd`.strip!
> +RPM_DEFINES = " --define \"_specdir #{PWD}/rpmsetup/SPECS\" --define
> \"_rpmdir #{PWD}/rpmsetup/RPMS\" --define \"_sourcedir
> #{PWD}/rpmsetup/SOURCES\" --define \" _srcrpmdir #{PWD}/rpmsetup/SRPMS\"
> --define \"_builddir #{PWD}/rpmsetup/BUILD\""
Would it be nicer to just use #{PWD}/rpmsetup for all these values and
not both with seperate subdirs? For someone spitting out a single
package, having multiple dirs seems less useful. But that might just
be me.
Ahh, I see you move them to #{PWD} later. Any reason not to just use
that directly?
> +
> +def rpmbuild_setup
> + # Ensure we're on linux and that rpm exists
> + unless File.exists?('/usr/bin/rpm') or RUBY_PLATFORM.downcase != "linux"
> + puts "Not an rpm based linux system"
> + exit 1
> + end
> + # Ensure rpmsetup is available
> + rpmbuil = %x{which rpmbuild}
Is this intentional? Looks like it doesn't matter, since the variable
isn't ever used. Just jumped out as odd at a glance.
> + # Remove the .sign as a required source because this is not an official
> release with a .sign file
Though it would be if building from a release tarball, wouldn't it?
We could test whether there's a .git dir perhaps. Catching rc
tarballs is tougher, since PUPPETVERSION doesn't contain the rcN tag
(since gem chokes on that -- somebody please tell the gem folks to fix
their toy packaging system please? ;)
> +desc "Create a SRPM"
> +task :srpm => :puppetpackages do
> + sign = rpmbuild_setup
> + if sign == 'md5'
> + sh "rpmbuild-md5 #{RPM_DEFINES} -bs --nodeps
> #{PWD}/rpmsetup/SPECS/puppet.spec"
> + else
> + sh "rpmbuild #{RPM_DEFINES} -bs --nodeps
> #{PWD}/rpmsetup/SPECS/puppet.spec"
> + end
So sign is set to md5 only when run on EL < 6. In that case,
rpmbuild will use the proper signing algoritm anyway. It only matters
if you're building packages on Fedora or EL-6 that you intend to use
on an older EL release that you have to bother with rpmbuild-md5. Or
is that part of the grander plan, to allow specifying the target?
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Liberty is always dangerous, but it is the safest thing we have.
-- Harry Emerson Fosdick
pgpv9a7ssmVMm.pgp
Description: PGP signature
