Check-in [338a1e5234]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | - improve cpan support (now with tests) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
338a1e523463a01b4eabdf31efcef405 |
User & Date: | jls@semicomplete.com 2013-05-07 06:51:12 |
Context
2013-05-07
| ||
06:56 | Merge pull request #424 from adamcstephens/master add RPM autoreqprov option(s) check-in: 46a4c2e5a9 user: jls@semicomplete.com tags: trunk | |
06:51 | - improve cpan support (now with tests) check-in: 338a1e5234 user: jls@semicomplete.com tags: trunk | |
2013-05-03
| ||
03:18 | - tune post-merge of #426 check-in: 6afabba2ce user: jls@semicomplete.com tags: trunk | |
Changes
Changes to lib/fpm/package/cpan.rb.
1 2 3 4 5 6 7 8 9 10 11 | require "fpm/namespace" require "fpm/package" require "fpm/util" require "fileutils" class FPM::Package::CPAN < FPM::Package # Flags '--foo' will be accessable as attributes[:npm_foo] option "--perl-bin", "PERL_EXECUTABLE", "The path to the perl executable you wish to run.", :default => "perl" option "--cpanm-bin", "CPANM_EXECUTABLE", "The path to the cpanm executable you wish to run.", :default => "cpanm" | > | 1 2 3 4 5 6 7 8 9 10 11 12 | require "fpm/namespace" require "fpm/package" require "fpm/util" require "fileutils" require "find" class FPM::Package::CPAN < FPM::Package # Flags '--foo' will be accessable as attributes[:npm_foo] option "--perl-bin", "PERL_EXECUTABLE", "The path to the perl executable you wish to run.", :default => "perl" option "--cpanm-bin", "CPANM_EXECUTABLE", "The path to the cpanm executable you wish to run.", :default => "cpanm" |
︙ | ︙ | |||
36 37 38 39 40 41 42 | self.version = metadata["version"] self.description = metadata["abstract"] self.license = case metadata["license"] when Array; metadata["license"].first else; metadata["license"] end | > > > > > > > > | > | > | > > > > > | > > | > > > | | | | | | > | 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 | self.version = metadata["version"] self.description = metadata["abstract"] self.license = case metadata["license"] when Array; metadata["license"].first else; metadata["license"] end if metadata.include?("distribution") @logger.info("Setting package name from 'distribution'", :distribution => metadata["distribution"]) self.name = fix_name(metadata["distribution"]) else @logger.info("Setting package name from 'name'", :name => metadata["name"]) self.name = fix_name(metadata["name"]) end # Not all things have 'author' listed. self.vendor = metadata["author"].join(", ") if metadata.include?("author") self.url = metadata["resources"]["homepage"] rescue "unknown" # TODO(sissel): figure out if this perl module compiles anything # and set the architecture appropriately. self.architecture = "all" # Install any build/configure dependencies with cpanm. # We'll install to a temporary directory. @logger.info("Installing any build or configure dependencies") safesystem(attributes[:cpan_cpanm_bin], "-L", build_path("cpan"), moduledir) if !attributes[:no_auto_depends?] if metadata.include?("requires") metadata["requires"].each do |dep_name, version| # Special case for representing perl core as a version. if dep_name == "perl" self.dependencies << "#{dep_name} >= #{version}" next end dep = search(dep_name, agent) if dep.include?("distribution") name = fix_name(dep["distribution"]) else name = fix_name(dep_name) end if version.to_s == "0" # Assume 'Foo = 0' means any version? self.dependencies << "#{name}" else self.dependencies << "#{name} = #{version}" end end end end #no_auto_depends ::Dir.chdir(moduledir) do # TODO(sissel): install build and config dependencies to resolve # build/configure requirements. |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | make = [ "make" ] safesystem(*make) safesystem(*(make + ["test"])) if attributes[:cpan_test?] safesystem(*(make + ["DESTDIR=#{staging_path}", "install"])) end end def unpack(tarball) directory = build_path("module") ::Dir.mkdir(directory) args = [ "-C", directory, "-zxf", tarball, "--strip-components", "1" ] | > > > > > > > > > > > > > > | 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 | make = [ "make" ] safesystem(*make) safesystem(*(make + ["test"])) if attributes[:cpan_test?] safesystem(*(make + ["DESTDIR=#{staging_path}", "install"])) end # TODO(sissel): figure out if this perl module compiles anything # and set the architecture appropriately. self.architecture = "all" # Find any shared objects in the staging directory to set architecture as # native if found; otherwise keep the 'all' default. Find.find(staging_path) do |path| if path =~ /\.so$/ @logger.info("Found shared library, setting architecture=native", :path => path) self.architecture = "native" end end end def unpack(tarball) directory = build_path("module") ::Dir.mkdir(directory) args = [ "-C", directory, "-zxf", tarball, "--strip-components", "1" ] |
︙ | ︙ |
Added spec/fpm/command_spec.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 | require "spec_setup" require "fpm" # local require "fpm/command" # local describe FPM::Command do describe "--prefix" describe "-C" describe "-p / --package" describe "-f" describe "-n" describe "-v" describe "--iteration" describe "--epoch" describe "--license" describe "--vendor" describe "--category" describe "-d / --depends" describe "--no-depends" describe "--provides" describe "--conflicts" describe "--replaces" describe "--config-files" describe "--directories" describe "-a | --architecture" end |
Added spec/fpm/package/cpan_spec.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 | require "spec_setup" require "fpm" # local require "fpm/package/cpan" # local have_cpanm = program_in_path?("cpanm") if !have_cpanm Cabin::Channel.get("rspec") \ .warn("Skipping CPAN#input tests because 'cpanm' isn't in your PATH") end describe FPM::Package::CPAN, :if => have_cpanm do subject { FPM::Package::CPAN.new } after :each do subject.cleanup end it "should package Digest::MD5" do subject.input("Digest::MD5") insist { subject.name } == "perl-Digest-MD5" insist { subject.description } == "Perl interface to the MD-5 algorithm" insist { subject.vendor } == "Gisle Aas <gisle@activestate.com>" # TODO(sissel): Check dependencies end it "should package File::Spec" do subject.input("File::Spec") # the File::Spec module comes from the PathTools CPAN distribution insist { subject.name } == "perl-PathTools" end end # describe FPM::Package::CPAN |