Check-in [9cef77c028]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | - Folks gettin' angry about an abandoned prototype they mistook for functioning and supported code, so let's delete this 'fpm-npm' hackery. Someone will write proper npm package support for fpm eventually. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 9cef77c028afe864f07c15ad1a3a1ee7ee8a2b80 |
User & Date: | jls 2013-02-09 22:58:07 |
Context
2013-02-11
| ||
20:21 | Merge pull request #360 from mblair/remove_npm_ref remove fpm-npm ref in gemspec so the gem builds. check-in: 638eb0dd8c user: jls tags: trunk | |
15:36 | Fix debian dependency name mangling check-in: 13ee63f667 user: pranay.kanwar tags: trunk | |
13:54 | remove fpm-npm ref in gemspec so the gem builds. check-in: eb2bf7e2c2 user: me tags: trunk | |
13:31 | Add empty source, -s empty check-in: 18904f1b71 user: pranay.kanwar tags: trunk | |
2013-02-09
| ||
22:58 | - Folks gettin' angry about an abandoned prototype they mistook for functioning and supported code, so let's delete this 'fpm-npm' hackery. Someone will write proper npm package support for fpm eventually. check-in: 9cef77c028 user: jls tags: trunk | |
2013-02-08
| ||
23:52 | - escape the staging_path in a regexp when replacing the pear_dir paths check-in: cbc463d64f user: jls tags: trunk | |
Changes
Deleted bin/fpm-npm.
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
#!/usr/bin/env ruby require "optparse" require "ostruct" require "json" settings = OpenStruct.new opts = OptionParser.new do |opts| opts.on("-n PACKAGENAME", "--name PACKAGENAME", "What name to give to the package") do |name| settings.name = name end opts.on("-v VERSION", "--version VERSION", "version to give the package") do |version| settings.version = version end opts.on("-t OUTPUTTYPE", "--type OUTPUTTYPE", "what kind of package you want as output (deb, etc)") do |packagetype| settings.packagetype = packagetype end end args = opts.parse(ARGV) if !["deb"].include?(settings.packagetype) $stderr.puts "Unsupported output package type '#{settings.packagetype}'." \ "Only supports 'deb' right now." exit 1 end if !settings.name $stderr.puts "No npm package name given (missing -n?)" exit 1 end builddir="#{Dir.pwd}/npm2pkg" # Prefix package names with 'nodejs-' PACKAGEPREFIX = "nodejs-" Dir.mkdir(builddir) if !File.exists?(builddir) File.open("#{builddir}/.npmrc", "w") do |file| file.puts "root = #{builddir}/usr/lib/node" file.puts "binroot = #{builddir}/usr/lib/node/bin" file.puts "manroot = #{builddir}/usr/share/man" end ## Trick npm into using a custom .npmrc system("env - PATH=$PATH HOME=#{builddir} npm install #{settings.name} #{settings.version}") # Find all installed npms in builddir, make packages. Dir.glob("#{builddir}/usr/lib/node/.npm/*/*") do |path| next if File.symlink?(path) puts path # Load the package.json and glean any information from it, then invoke pkg.rb package = JSON.parse(File.new("#{path}/package/package.json").read()) # TODO(sissel): Ideally we want to say any version with the same 'release' number, like # So we'll specify deps of {v}-1 <= x <= {v}-999999.... depends = Dir.glob("#{path}/dependson/*@*") \ .collect { |p| PACKAGEPREFIX + File.basename(p) } \ .collect { |p| n,v = p.split("@"); ["#{n} (>= #{v}-1)", "#{n} (<= #{v}-99999999999999)"] }.flatten if package["author"] maintainer = package["author"] else m = package["maintainers"][0] \ rescue { "name" => "missing upstream author", "email" => ENV["USER"] } maintainer = "#{m["name"]} <#{m["email"]}>" end pkgcmd = [ "fpm", "-n", "#{PACKAGEPREFIX}#{package["name"]}", "-v", package["version"], "-m", maintainer, "-a", "all", ] depends.each do |dep| pkgcmd += ["-d", dep] end pkgcmd += ["-p", "#{PACKAGEPREFIX}#{package["name"]}-VERSION_ARCH.deb"] pkgcmd += ["-C", builddir] pkgcmd << "usr/lib/node/.npm/#{package["name"]}/active" pkgcmd << "usr/lib/node/.npm/#{package["name"]}/#{package["version"]}" pkgcmd << "usr/lib/node/#{package["name"]}" pkgcmd << "usr/lib/node/#{package["name"]}@#{package["version"]}" # Include bin files, install to usr/lib/node/bin (package["bin"] or []).each do |bin, script| pkgcmd << "usr/lib/node/bin/#{bin}" pkgcmd << "usr/lib/node/bin/#{bin}@#{package["version"]}" end # TODO(sissel): We could include manpages and docs, but I don't care right # now. If you want it, I accept patches! :) system *pkgcmd end |
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |