Check-in [b94bab615e]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | - solaris package building works. Big thanks to Ben Rockwood for giving me access to a Joyent Solaris system so I could make this happen. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b94bab615e59417c95a11c5dc64354da |
User & Date: | jls@semicomplete.com 2011-06-15 07:05:24 |
Context
2011-06-15
| ||
07:20 | - only wrap system() if we're in debug mode - fix a bug in dir target regarding handling "." and "./" - clean up some verbosity - solaris: parse pkgproto output ourselves check-in: bdbe0c598b user: jls@semicomplete.com tags: trunk | |
07:05 | - solaris package building works. Big thanks to Ben Rockwood for giving me access to a Joyent Solaris system so I could make this happen. check-in: b94bab615e user: jls@semicomplete.com tags: trunk | |
06:20 | - Start working on a solaris package type. - md5sums aren't needed by most packages, disable it by default. In the future, should move the md5sums generator to the .deb package target and keep it away from other stuff. check-in: a0fa7fcf65 user: jls@semicomplete.com tags: trunk | |
Changes
Changes to lib/fpm/source.rb.
︙ | ︙ | |||
92 93 94 95 96 97 98 99 100 101 102 103 | # Why? tar and some package managers sometimes fail if the tar is created # like: [ "/opt/fizz", "/opt" ] # dpkg -i will fail if /opt doesn't exist, sorting it by length ensures # /opt is created before /opt/fizz. dirs.sort! { |a,b| a.size <=> b.size } paths.sort! { |a,b| a.size <=> b.size } excludes = self[:exclude].map { |e| ["--exclude", e] }.flatten # TODO(sissel): To properly implement excludes as regexps, we # will need to find files ourselves. That may be more work # than it is worth. For now, rely on tar's --exclude. | > > > > > > > > > > > > > | | > > > > > > > > > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | # Why? tar and some package managers sometimes fail if the tar is created # like: [ "/opt/fizz", "/opt" ] # dpkg -i will fail if /opt doesn't exist, sorting it by length ensures # /opt is created before /opt/fizz. dirs.sort! { |a,b| a.size <=> b.size } paths.sort! { |a,b| a.size <=> b.size } # Solaris's tar is pretty neutered, so implement --exclude and such # ourselves. # TODO(sissel): May need to implement our own tar file generator # so we can enforce file ownership. Again, solaris' tar doesn't support # --owner, etc. #paths = [] #dirs.each do |dir| #Dir.glob(File.join(dir, "**", "*")).each do |path| #next if excludesFile.fnmatch?( #end #end excludes = self[:exclude].map { |e| ["--exclude", e] }.flatten # TODO(sissel): To properly implement excludes as regexps, we # will need to find files ourselves. That may be more work # than it is worth. For now, rely on tar's --exclude. dir_tar = [tar_cmd, "--owner=root", "--group=root" ] \ + excludes \ + ["-cf", output, "--no-recursion" ] \ + dirs ::Dir.chdir(chdir) do system(*dir_tar) if dirs.any? end files_tar = [ tar_cmd ] \ + excludes \ + [ "--owner=root", "--group=root", "-rf", output ] \ + paths ::Dir.chdir(chdir) do system(*files_tar) end end # def tar def tar_cmd # Rely on gnu tar for solaris. case %x{uname -s}.chomp when "SunOS" return "gtar" else return "tar" end end # def tar_cmd end # class FPM::Source |
Added lib/fpm/target/solaris.rb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | require "erb" require "fpm/namespace" require "fpm/package" require "fpm/errors" # TODO(sissel): Add dependency checking support. # IIRC this has to be done as a 'checkinstall' step. class FPM::Target::Solaris < FPM::Package def architecture case @architecture when nil, "native" @architecture = %x{uname -p}.chomp end # "all" is a valid arch according to # http://www.bolthole.com/solaris/makeapackage.html return @architecture end # def architecture def specfile(builddir) "#{builddir}/pkginfo" end def build!(params) self.scripts.each do |name, path| case name when "pre-install" system("cp #{path} ./preinstall") File.chmod(0755, "./preinstall") when "post-install" system("cp #{path} ./postinstall") File.chmod(0755, "./postinstall") when "pre-uninstall" raise FPM::InvalidPackageConfiguration.new( "pre-uninstall is not supported by Solaris packages" ) when "post-uninstall" raise FPM::InvalidPackageConfiguration.new( "post-uninstall is not supported by Solaris packages" ) end # case name end # self.scripts.each # Unpack data.tar.gz so we can build a package from it. Dir.mkdir("data") system("gzip -d data.tar.gz"); Dir.chdir("data") do system("tar -vxf ../data.tar"); end system("(echo 'i pkginfo'; pkgproto data=/) > Prototype") # Generate the package 'Prototype' file # TODO(sissel): allow setting default file owner. #File.open("Prototype", "w") do |prototype| #IO.popen("tar -tf data.tar | pkgproto").each_line do |line| #type, klass, path, mode, user, group = line.split ## Override pkgproto #user = "root" #group = "root" #prototype.puts([type, klass, "/#{path}", mode, user, group].join(" ")) #end #end # Should create a directory named by the package name. system("pkgmk -o -d .") # Convert the 'package directory' built above to a real solaris package. system("pkgtrans -s . #{params[:output]} #{name}") end # def build def default_output v = version v = "#{epoch}:#{v}" if epoch if iteration "#{name}_#{v}-#{iteration}_#{architecture}.#{type}" else "#{name}_#{v}_#{architecture}.#{type}" end end # def default_output end # class FPM::Deb |
Added templates/solaris.erb.
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | CLASSES=none BASEDIR=/usr/local TZ=PST PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin PKG=<%= name %> NAME=<%= name %> ARCH=<%= architecture %> VERSION=<%= version %><%= iteration && "-" + iteration.to_s %> CATEGORY=application <%# pkginfo(4) says DESC is max 256 characters %> DESC=<%= description.split("\n").first[0..255] or "no description given" %> VENDOR=<%= maintainer %> <%# Take maintainer of "Foo <bar@baz.com>" and use "bar@baz.com" %> EMAIL=<%= maintainer[/<.+>/].gsub(/[<>]/, "") %> |