From: <jh...@us...> - 2009-11-14 18:20:06
|
Revision: 164 http://etch.svn.sourceforge.net/etch/?rev=164&view=rev Author: jheiss Date: 2009-11-14 18:19:58 +0000 (Sat, 14 Nov 2009) Log Message: ----------- Re-tagging 3.12 release Modified Paths: -------------- tags/release-3.12/VERSION Added Paths: ----------- tags/release-3.12/ tags/release-3.12/client/Portfile tags/release-3.12/client/Rakefile Removed Paths: ------------- tags/release-3.12/client/Portfile tags/release-3.12/client/Rakefile Modified: tags/release-3.12/VERSION =================================================================== --- trunk/VERSION 2009-11-14 17:58:54 UTC (rev 159) +++ tags/release-3.12/VERSION 2009-11-14 18:19:58 UTC (rev 164) @@ -1 +1 @@ -trunk +3.12 Deleted: tags/release-3.12/client/Portfile =================================================================== --- trunk/client/Portfile 2009-11-14 17:58:54 UTC (rev 159) +++ tags/release-3.12/client/Portfile 2009-11-14 18:19:58 UTC (rev 164) @@ -1,50 +0,0 @@ -# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 -# $Id$ - -PortSystem 1.0 - -name etch -version 3.11 -categories sysutils -maintainers aput.net:jheiss openmaintainer - -description Etch is a system configuration management tool. - -long_description Etch is a tool for managing the configuration of \ - Unix systems. Etch can manage text or binary \ - files, links and directories. The contents of \ - files can be supplied from static files or \ - generated on the fly by scripts or templates. \ - Permissions and ownership as well as any pre or \ - post commands to run when updating the file are \ - configured in simple XML files. - -homepage http://etch.sourceforge.net/ -platforms darwin - -master_sites sourceforge - -checksums md5 e462d44552ce628b2a2e121eb5825b62 \ - sha1 0cee484b291e89adaa46b1fccc763e14ccb41f90 \ - rmd160 5221532a9bba2b93274a8fd419dc4da6ec965e5e - -depends_build port:rb-rake -depends_run port:ruby \ - port:facter - -PortGroup ruby 1.0 - -# fetch -# extract -# patch -# configure -# build -# destroot - -use_configure no -build {} -test.run no -destroot.cmd cd client && rake -destroot.target install\[${destroot}\] -destroot.destdir "" - Copied: tags/release-3.12/client/Portfile (from rev 161, trunk/client/Portfile) =================================================================== --- tags/release-3.12/client/Portfile (rev 0) +++ tags/release-3.12/client/Portfile 2009-11-14 18:19:58 UTC (rev 164) @@ -0,0 +1,50 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# $Id$ + +PortSystem 1.0 + +name etch +version %VER% +categories sysutils +maintainers aput.net:jheiss openmaintainer + +description Etch is a system configuration management tool. + +long_description Etch is a tool for managing the configuration of \ + Unix systems. Etch can manage text or binary \ + files, links and directories. The contents of \ + files can be supplied from static files or \ + generated on the fly by scripts or templates. \ + Permissions and ownership as well as any pre or \ + post commands to run when updating the file are \ + configured in simple XML files. + +homepage http://etch.sourceforge.net/ +platforms darwin + +master_sites sourceforge + +checksums md5 e462d44552ce628b2a2e121eb5825b62 \ + sha1 0cee484b291e89adaa46b1fccc763e14ccb41f90 \ + rmd160 5221532a9bba2b93274a8fd419dc4da6ec965e5e + +depends_build port:rb-rake +depends_run port:ruby \ + port:facter + +PortGroup ruby 1.0 + +# fetch +# extract +# patch +# configure +# build +# destroot + +use_configure no +build {} +test.run no +destroot.cmd cd client && rake +destroot.target install\[${destroot}\] +destroot.destdir "" + Deleted: tags/release-3.12/client/Rakefile =================================================================== --- trunk/client/Rakefile 2009-11-14 17:58:54 UTC (rev 159) +++ tags/release-3.12/client/Rakefile 2009-11-14 18:19:58 UTC (rev 164) @@ -1,426 +0,0 @@ -require 'rbconfig' -require 'tempfile' -require 'tmpdir' - -ETCHVER = IO.read('../VERSION').chomp - -BUILDROOT = '/var/tmp/etch-client-buildroot' - -# Copies the etch client files to destdir. Appropriate subdirectories will be -# composed unless specified via options. -# options: -# :bindir -# :libdir -# :etcdir -# :mandir -# :crondir (note no default here, crontab will not be copied if not specified) -# :ruby (#! lines in scripts will be changed to specified ruby) -# :installbase (base directory where files will end up) -def copy_etch_files(destdir, options={}) - bindir = nil - if options[:bindir] - bindir = File.join(destdir, options[:bindir]) - else - bindir = File.join(destdir, 'bin') - end - mkdir_p(bindir) - binapps = ['etch', 'etch_to_trunk', 'etch_cron_wrapper'] - binapps.each do |binapp| - if options[:ruby] - # Change #! line - File.open(File.join(bindir, binapp), 'w') do |newfile| - File.open(binapp) do |oldfile| - # Modify the first line - firstline = oldfile.gets - # Preserve any options. I.e. #!/usr/bin/ruby -w - shebang, shebangopts = firstline.split(' ', 2) - newfile.puts "#!#{options[:ruby]} #{shebangopts}" - # Then dump in the rest of the file - newfile.write(oldfile.read) - end - end - else - cp(binapp, bindir, :preserve => true) - end - chmod(0555, File.join(bindir, binapp)) - end - - libdir = nil - if options[:libdir] - libdir = File.join(destdir, options[:libdir]) - else - libdir = File.join(destdir, 'lib') - end - mkdir_p(libdir) - clientlibs = ['etchclient.rb'] - clientlibs.each do |clientlib| - cp(clientlib, libdir, :preserve => true) - end - serverlibs = ['etch.rb', 'versiontype.rb'] - serverlibs.each do |serverlib| - cp(File.join('..', 'server', 'lib', serverlib), libdir, :preserve => true) - end - clientlibs + serverlibs.each do |lib| - chmod(0444, File.join(libdir, lib)) - end - - mandir = nil - if options[:mandir] - mandir = File.join(destdir, options[:mandir]) - else - mandir = File.join(destdir, 'man') - end - man8dir = File.join(mandir, 'man8') - mkdir_p(man8dir) - cp('etch.8', man8dir, :preserve => true) - chmod(0444, File.join(man8dir, 'etch.8')) - - etcdir = nil - realetcdir = nil - if options[:etcdir] - realetcdir = options[:etcdir] - else - realetcdir = '/etc' - end - etcdir = File.join(destdir, realetcdir) - mkdir_p(etcdir) - etcfiles = ['ca.pem', 'dhparams'] - etcfiles.each do |etcfile| - cp(etcfile, etcdir, :preserve => true) - chmod(0644, File.join(etcdir, etcfile)) - end - - if options[:crondir] - crondir = File.join(destdir, options[:crondir]) - mkdir_p(crondir) - # Note file renamed to 'etch' here. Filename is different in the repo for - # clarity and to avoid conflict with the main executable. - cp('etch_cron', File.join(crondir, 'etch'), :preserve => true) - chmod(0444, File.join(crondir, 'etch')) - end - - # Substitute ETCHVER into etchclient.rb - # Substitute proper path into CONFIGDIR in etchclient.rb if appropriate - newetchclient = File.join(libdir, 'etchclient.rb.new') - etchclient = File.join(libdir, 'etchclient.rb') - File.open(newetchclient, 'w') do |newfile| - IO.foreach(etchclient) do |line| - if line =~ /^\s*VERSION/ - line.sub!(/=.*/, "= '#{ETCHVER}'") - end - if options[:installbase] && line =~ /^\s*CONFIGDIR/ - line.sub!(/=.*/, "= #{realetcdir}") - end - newfile.write(line) - end - end - mv(newetchclient, etchclient) - chmod(0444, etchclient) -end - -desc 'Build an etch client RPM on a Red Hat box' -task :redhat => [:redhatprep, :rpm] -desc 'Prep a Red Hat box for building an RPM' -task :redhatprep do - # Install the package which contains the rpmbuild command - system('rpm --quiet -q rpm-build || sudo yum install rpm-build') -end -desc 'Build an etch client RPM' -task :rpm do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - sbindir = File.join('usr', 'sbin') - libdir = File.join('usr', 'lib', 'ruby', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = File.join('etc', 'etch') - crondir = File.join('etc', 'cron.d') - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, :crondir => crondir, - :installbase => '/') - - # - # Prep spec file - # - - spec = Tempfile.new('etchrpm') - IO.foreach('etch-client.spec') do |line| - line.sub!('%VER%', ETCHVER) - spec.puts(line) - end - - # - # Build the package - # - - system("rpmbuild -bb --buildroot #{BUILDROOT} #{spec.path}") - - # - # Cleanup - # - - rm_rf(BUILDROOT) -end - -desc 'Build an etch client deb' -task :deb do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - mkdir_p(File.join(BUILDROOT, 'DEBIAN')) - File.open(File.join(BUILDROOT, 'DEBIAN', 'control'), 'w') do |control| - IO.foreach('control') do |line| - next if line =~ /^\s*#/ # Remove comments - line.sub!('%VER%', ETCHVER) - control.puts(line) - end - end - - sbindir = File.join('usr', 'sbin') - libdir = File.join('usr', 'local', 'lib', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = File.join('etc', 'etch') - crondir = File.join('etc', 'cron.d') - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, :crondir => crondir, - :installbase => '/') - - # - # Set permissions - # - - system("sudo chown -R 0:0 #{BUILDROOT}") - - # - # Build the package - # - - system("dpkg --build #{BUILDROOT} etch-client-#{ETCHVER}.deb") - - # - # Cleanup - # - - rm_rf(BUILDROOT) -end - -desc 'Build etch client SysV packages for Solaris' -task :solaris => [:sysvpkg, :sysvpkgsparc] -desc 'Build an etch client SysV package' -task :sysvpkg do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - sbindir = File.join('usr', 'sbin') - libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = File.join('etc', 'etch') - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, - :ruby => '/opt/csw/bin/ruby', :installbase => '/') - - # - # Prep packaging files - # - - rm_rf('solbuild') - mkdir('solbuild') - File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| - IO.foreach('pkginfo') do |line| - line.sub!('%VER%', ETCHVER) - pkginfo.puts(line) - end - end - File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| - prototype.puts("i pkginfo=./pkginfo") - cp('depend', 'solbuild/depend') - prototype.puts("i depend=./depend") - cp('postinstall', 'solbuild/postinstall') - prototype.puts("i postinstall=./postinstall") - cp('postremove', 'solbuild/postremove') - prototype.puts("i postremove=./postremove") - # The tail +2 removes the first line, which is the base directory - # and doesn't need to be included in the package. - IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| - pipe.each do |line| - # Clean up the directory names - line.sub!(BUILDROOT, '') - # Don't force our permissions on directories - if line =~ /^d/ - line.sub!(/\S+ \S+ \S+$/, '? ? ?') - end - prototype.write(line) - end - end - end - - # - # Build the package - # - - system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") - system("pkgtrans solbuild ../YPCetch-#{ETCHVER}.pkg YPCetch") - - # - # Cleanup - # - - rm_rf('solbuild') - rm_rf(BUILDROOT) -end - -# On Sparc systems we're having problems with the CSW/Blastwave ruby core -# dumping when running etch. The Sunfreeware ruby seems to work. Sunfreeware -# doesn't play well with pkg-get, so we create a bit of a hybrid. We still -# express all the dependencies against CSW, and put our library file -# (etchclient.rb) into /opt/csw. We modify etch to use the Sunfreeware ruby -# in /usr/local/bin, but then tell it to also look in the /opt/csw directory -# for libraries. Users will have to manually install the Sunfreeware ruby -# package. -desc 'Build an etch client SysV package with hybrid CSW/Sunfreeware dependencies' -task :sysvpkgsparc do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - - sbindir = File.join('usr', 'sbin') - libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') - mandir = File.join('usr', 'share', 'man') - etcdir = File.join('etc', 'etch') - copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, - :mandir => mandir, :etcdir => etcdir, - :ruby => '/usr/local/bin/ruby', :installbase => '/') - - # Since we're using the Sunfreeware ruby but CSW libraries we need to add - # the CSW ruby library directory to the search path - newetch = File.join(BUILDROOT, 'usr', 'sbin', 'etch.new') - etch = File.join(BUILDROOT, 'usr', 'sbin', 'etch') - File.open(newetch, 'w') do |newfile| - IO.foreach(etch) do |line| - if line =~ /unshift.*__FILE__/ - line << "$:.unshift('/opt/csw/lib/ruby/site_ruby/1.8')\n" - end - newfile.write(line) - end - end - mv(newetch, etch) - chmod(0555, etch) - - # - # Prep packaging files - # - - rm_rf('solbuild') - mkdir('solbuild') - File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| - IO.foreach('pkginfo') do |line| - line.sub!('%VER%', ETCHVER) - pkginfo.puts(line) - end - end - File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| - prototype.puts("i pkginfo=./pkginfo") - cp('depend', 'solbuild/depend') - prototype.puts("i depend=./depend") - cp('postinstall', 'solbuild/postinstall') - prototype.puts("i postinstall=./postinstall") - cp('postremove', 'solbuild/postremove') - prototype.puts("i postremove=./postremove") - # The tail +2 removes the first line, which is the base directory - # and doesn't need to be included in the package. - IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| - pipe.each do |line| - # Clean up the directory names - line.sub!(BUILDROOT, '') - # Don't force our permissions on directories - if line =~ /^d/ - line.sub!(/\S+ \S+ \S+$/, '? ? ?') - end - prototype.write(line) - end - end - end - - # - # Build the package - # - - system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") - system("pkgtrans solbuild ../YPCetch-#{ETCHVER}-sparc.pkg YPCetch") - - # - # Cleanup - # - - rm_rf('solbuild') - rm_rf(BUILDROOT) -end - -# Install based on Config::CONFIG paths -task :install, :destdir do |t, args| - destdir = nil - if args.destdir - destdir = args.destdir - else - destdir = '/' - end - copy_etch_files(destdir, - :bindir => Config::CONFIG['sbindir'], - :libdir => Config::CONFIG['sitelibdir'], - :mandir => Config::CONFIG['mandir'], - :etcdir => Config::CONFIG['sysconfdir'], - # Can't find a better way to get the path to the current ruby - :ruby => File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']), - :installbase => '/') -end - -task :gem do - # - # Create package file structure in build root - # - - rm_rf(BUILDROOT) - copy_etch_files(BUILDROOT) - - # - # Prep gemspec - # - File.open(File.join(BUILDROOT, 'Rakefile'), 'w') do |gemspec| - IO.foreach('gemspec') do |line| - line.sub!('%VER%', ETCHVER) - gemspec.puts(line) - end - end - - # - # Build the package - # - - system("cd #{BUILDROOT} && rake gem") - gemglob = File.join(BUILDROOT, 'pkg', '*.gem') - gemfile = Dir.glob(gemglob).first - if gemfile - mv(gemfile, Dir.tmpdir) - puts "Gem is #{File.join(Dir.tmpdir, File.basename(gemfile))}" - else - warn "Gem file #{gemglob} not found!" - end - - # - # Cleanup - # - - rm_rf(BUILDROOT) -end - Copied: tags/release-3.12/client/Rakefile (from rev 161, trunk/client/Rakefile) =================================================================== --- tags/release-3.12/client/Rakefile (rev 0) +++ tags/release-3.12/client/Rakefile 2009-11-14 18:19:58 UTC (rev 164) @@ -0,0 +1,439 @@ +require 'rbconfig' +require 'tempfile' +require 'tmpdir' + +ETCHVER = IO.read('../VERSION').chomp + +BUILDROOT = '/var/tmp/etch-client-buildroot' + +# Copies the etch client files to destdir. Appropriate subdirectories will be +# composed unless specified via options. +# options: +# :bindir +# :libdir +# :etcdir +# :mandir +# :crondir (note no default here, crontab will not be copied if not specified) +# :ruby (#! lines in scripts will be changed to specified ruby) +# :installbase (base directory where files will end up) +def copy_etch_files(destdir, options={}) + bindir = nil + if options[:bindir] + bindir = File.join(destdir, options[:bindir]) + else + bindir = File.join(destdir, 'bin') + end + mkdir_p(bindir) + binapps = ['etch', 'etch_to_trunk', 'etch_cron_wrapper'] + binapps.each do |binapp| + if options[:ruby] + # Change #! line + File.open(File.join(bindir, binapp), 'w') do |newfile| + File.open(binapp) do |oldfile| + # Modify the first line + firstline = oldfile.gets + # Preserve any options. I.e. #!/usr/bin/ruby -w + shebang, shebangopts = firstline.split(' ', 2) + newfile.puts "#!#{options[:ruby]} #{shebangopts}" + # Then dump in the rest of the file + newfile.write(oldfile.read) + end + end + else + cp(binapp, bindir, :preserve => true) + end + chmod(0555, File.join(bindir, binapp)) + end + + libdir = nil + if options[:libdir] + libdir = File.join(destdir, options[:libdir]) + else + libdir = File.join(destdir, 'lib') + end + mkdir_p(libdir) + clientlibs = ['etchclient.rb'] + clientlibs.each do |clientlib| + cp(clientlib, libdir, :preserve => true) + end + serverlibs = ['etch.rb', 'versiontype.rb'] + serverlibs.each do |serverlib| + cp(File.join('..', 'server', 'lib', serverlib), libdir, :preserve => true) + end + clientlibs + serverlibs.each do |lib| + chmod(0444, File.join(libdir, lib)) + end + + mandir = nil + if options[:mandir] + mandir = File.join(destdir, options[:mandir]) + else + mandir = File.join(destdir, 'man') + end + man8dir = File.join(mandir, 'man8') + mkdir_p(man8dir) + cp('etch.8', man8dir, :preserve => true) + chmod(0444, File.join(man8dir, 'etch.8')) + + etcdir = nil + realetcdir = nil + if options[:etcdir] + realetcdir = options[:etcdir] + else + realetcdir = '/etc' + end + etcdir = File.join(destdir, realetcdir) + mkdir_p(etcdir) + etcfiles = ['ca.pem', 'dhparams'] + etcfiles.each do |etcfile| + cp(etcfile, etcdir, :preserve => true) + chmod(0644, File.join(etcdir, etcfile)) + end + + if options[:crondir] + crondir = File.join(destdir, options[:crondir]) + mkdir_p(crondir) + # Note file renamed to 'etch' here. Filename is different in the repo for + # clarity and to avoid conflict with the main executable. + cp('etch_cron', File.join(crondir, 'etch'), :preserve => true) + chmod(0444, File.join(crondir, 'etch')) + end + + # Substitute ETCHVER into etchclient.rb + # Substitute proper path into CONFIGDIR in etchclient.rb if appropriate + newetchclient = File.join(libdir, 'etchclient.rb.new') + etchclient = File.join(libdir, 'etchclient.rb') + File.open(newetchclient, 'w') do |newfile| + IO.foreach(etchclient) do |line| + if line =~ /^\s*VERSION/ + line.sub!(/=.*/, "= '#{ETCHVER}'") + end + if options[:installbase] && line =~ /^\s*CONFIGDIR/ + line.sub!(/=.*/, "= #{realetcdir}") + end + newfile.write(line) + end + end + mv(newetchclient, etchclient) + chmod(0444, etchclient) +end + +desc 'Build an etch client RPM on a Red Hat box' +task :redhat => [:redhatprep, :rpm] +desc 'Prep a Red Hat box for building an RPM' +task :redhatprep do + # Install the package which contains the rpmbuild command + system('rpm --quiet -q rpm-build || sudo yum install rpm-build') +end +desc 'Build an etch client RPM' +task :rpm do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + sbindir = File.join('usr', 'sbin') + libdir = File.join('usr', 'lib', 'ruby', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = File.join('etc', 'etch') + crondir = File.join('etc', 'cron.d') + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, :crondir => crondir, + :installbase => '/') + + # + # Prep spec file + # + + spec = Tempfile.new('etchrpm') + IO.foreach('etch-client.spec') do |line| + line.sub!('%VER%', ETCHVER) + spec.puts(line) + end + + # + # Build the package + # + + system("rpmbuild -bb --buildroot #{BUILDROOT} #{spec.path}") + + # + # Cleanup + # + + rm_rf(BUILDROOT) +end + +desc 'Build an etch client deb' +task :deb do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + mkdir_p(File.join(BUILDROOT, 'DEBIAN')) + File.open(File.join(BUILDROOT, 'DEBIAN', 'control'), 'w') do |control| + IO.foreach('control') do |line| + next if line =~ /^\s*#/ # Remove comments + line.sub!('%VER%', ETCHVER) + control.puts(line) + end + end + + sbindir = File.join('usr', 'sbin') + libdir = File.join('usr', 'local', 'lib', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = File.join('etc', 'etch') + crondir = File.join('etc', 'cron.d') + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, :crondir => crondir, + :installbase => '/') + + # + # Set permissions + # + + system("sudo chown -R 0:0 #{BUILDROOT}") + + # + # Build the package + # + + system("dpkg --build #{BUILDROOT} etch-client-#{ETCHVER}.deb") + + # + # Cleanup + # + + rm_rf(BUILDROOT) +end + +desc 'Build etch client SysV packages for Solaris' +task :solaris => [:sysvpkg, :sysvpkgsparc] +desc 'Build an etch client SysV package' +task :sysvpkg do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + sbindir = File.join('usr', 'sbin') + libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = File.join('etc', 'etch') + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, + :ruby => '/opt/csw/bin/ruby', :installbase => '/') + + # + # Prep packaging files + # + + rm_rf('solbuild') + mkdir('solbuild') + File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| + IO.foreach('pkginfo') do |line| + line.sub!('%VER%', ETCHVER) + pkginfo.puts(line) + end + end + File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| + prototype.puts("i pkginfo=./pkginfo") + cp('depend', 'solbuild/depend') + prototype.puts("i depend=./depend") + cp('postinstall', 'solbuild/postinstall') + prototype.puts("i postinstall=./postinstall") + cp('postremove', 'solbuild/postremove') + prototype.puts("i postremove=./postremove") + # The tail +2 removes the first line, which is the base directory + # and doesn't need to be included in the package. + IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| + pipe.each do |line| + # Clean up the directory names + line.sub!(BUILDROOT, '') + # Don't force our permissions on directories + if line =~ /^d/ + line.sub!(/\S+ \S+ \S+$/, '? ? ?') + end + prototype.write(line) + end + end + end + + # + # Build the package + # + + system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") + system("pkgtrans solbuild ../YPCetch-#{ETCHVER}.pkg YPCetch") + + # + # Cleanup + # + + rm_rf('solbuild') + rm_rf(BUILDROOT) +end + +# On Sparc systems we're having problems with the CSW/Blastwave ruby core +# dumping when running etch. The Sunfreeware ruby seems to work. Sunfreeware +# doesn't play well with pkg-get, so we create a bit of a hybrid. We still +# express all the dependencies against CSW, and put our library file +# (etchclient.rb) into /opt/csw. We modify etch to use the Sunfreeware ruby +# in /usr/local/bin, but then tell it to also look in the /opt/csw directory +# for libraries. Users will have to manually install the Sunfreeware ruby +# package. +desc 'Build an etch client SysV package with hybrid CSW/Sunfreeware dependencies' +task :sysvpkgsparc do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + + sbindir = File.join('usr', 'sbin') + libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8') + mandir = File.join('usr', 'share', 'man') + etcdir = File.join('etc', 'etch') + copy_etch_files(BUILDROOT, :bindir => sbindir, :libdir => libdir, + :mandir => mandir, :etcdir => etcdir, + :ruby => '/usr/local/bin/ruby', :installbase => '/') + + # Since we're using the Sunfreeware ruby but CSW libraries we need to add + # the CSW ruby library directory to the search path + newetch = File.join(BUILDROOT, 'usr', 'sbin', 'etch.new') + etch = File.join(BUILDROOT, 'usr', 'sbin', 'etch') + File.open(newetch, 'w') do |newfile| + IO.foreach(etch) do |line| + if line =~ /unshift.*__FILE__/ + line << "$:.unshift('/opt/csw/lib/ruby/site_ruby/1.8')\n" + end + newfile.write(line) + end + end + mv(newetch, etch) + chmod(0555, etch) + + # + # Prep packaging files + # + + rm_rf('solbuild') + mkdir('solbuild') + File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo| + IO.foreach('pkginfo') do |line| + line.sub!('%VER%', ETCHVER) + pkginfo.puts(line) + end + end + File.open(File.join('solbuild', 'prototype'), 'w') do |prototype| + prototype.puts("i pkginfo=./pkginfo") + cp('depend', 'solbuild/depend') + prototype.puts("i depend=./depend") + cp('postinstall', 'solbuild/postinstall') + prototype.puts("i postinstall=./postinstall") + cp('postremove', 'solbuild/postremove') + prototype.puts("i postremove=./postremove") + # The tail +2 removes the first line, which is the base directory + # and doesn't need to be included in the package. + IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe| + pipe.each do |line| + # Clean up the directory names + line.sub!(BUILDROOT, '') + # Don't force our permissions on directories + if line =~ /^d/ + line.sub!(/\S+ \S+ \S+$/, '? ? ?') + end + prototype.write(line) + end + end + end + + # + # Build the package + # + + system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild") + system("pkgtrans solbuild ../YPCetch-#{ETCHVER}-sparc.pkg YPCetch") + + # + # Cleanup + # + + rm_rf('solbuild') + rm_rf(BUILDROOT) +end + +# Install based on Config::CONFIG paths +task :install, :destdir do |t, args| + destdir = nil + if args.destdir + destdir = args.destdir + else + destdir = '/' + end + copy_etch_files(destdir, + :bindir => Config::CONFIG['sbindir'], + :libdir => Config::CONFIG['sitelibdir'], + :mandir => Config::CONFIG['mandir'], + :etcdir => Config::CONFIG['sysconfdir'], + # Can't find a better way to get the path to the current ruby + :ruby => File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']), + :installbase => '/') +end + +desc 'Prepare portfile for submission to MacPorts' +task :macport do + portfile = File.join(Dir.tmpdir, 'Portfile') + rm_f(portfile) + File.open(portfile, 'w') do |newfile| + IO.foreach('Portfile') do |line| + line.sub!('%VER%', ETCHVER) + newfile.puts(line) + end + end + puts "Portfile is #{portfile}" +end + +task :gem do + # + # Create package file structure in build root + # + + rm_rf(BUILDROOT) + copy_etch_files(BUILDROOT) + + # + # Prep gemspec + # + File.open(File.join(BUILDROOT, 'Rakefile'), 'w') do |gemspec| + IO.foreach('gemspec') do |line| + line.sub!('%VER%', ETCHVER) + gemspec.puts(line) + end + end + + # + # Build the package + # + + system("cd #{BUILDROOT} && rake gem") + gemglob = File.join(BUILDROOT, 'pkg', '*.gem') + gemfile = Dir.glob(gemglob).first + if gemfile + mv(gemfile, Dir.tmpdir) + puts "Gem is #{File.join(Dir.tmpdir, File.basename(gemfile))}" + else + warn "Gem file #{gemglob} not found!" + end + + # + # Cleanup + # + + rm_rf(BUILDROOT) +end + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |