packo 0.0.1.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/packo +78 -0
- data/bin/packo-base +24 -0
- data/bin/packo-build +24 -0
- data/bin/packo-db +24 -0
- data/bin/packo-env +24 -0
- data/bin/packo-files +24 -0
- data/bin/packo-profile +24 -0
- data/bin/packo-repository +24 -0
- data/bin/packo-select +24 -0
- data/lib/packo.rb +186 -0
- data/lib/packo/cli.rb +79 -0
- data/lib/packo/cli/base.rb +554 -0
- data/lib/packo/cli/build.rb +488 -0
- data/lib/packo/cli/database.rb +55 -0
- data/lib/packo/cli/database/definition.rb +65 -0
- data/lib/packo/cli/database/helpers.rb +20 -0
- data/lib/packo/cli/environment.rb +45 -0
- data/lib/packo/cli/files.rb +153 -0
- data/lib/packo/cli/profile.rb +31 -0
- data/lib/packo/cli/repository.rb +561 -0
- data/lib/packo/cli/repository/binary.rb +74 -0
- data/lib/packo/cli/repository/helpers.rb +20 -0
- data/lib/packo/cli/repository/repository.rb +48 -0
- data/lib/packo/cli/repository/source.rb +91 -0
- data/lib/packo/cli/repository/virtual.rb +53 -0
- data/lib/packo/cli/select.rb +61 -0
- data/lib/packo/do.rb +249 -0
- data/lib/packo/environment.rb +269 -0
- data/lib/packo/extensions.rb +70 -0
- data/lib/packo/flags.rb +64 -0
- data/lib/packo/host.rb +121 -0
- data/lib/packo/models.rb +171 -0
- data/lib/packo/models/installed_package.rb +190 -0
- data/lib/packo/models/installed_package/content.rb +50 -0
- data/lib/packo/models/installed_package/dependency.rb +39 -0
- data/lib/packo/models/repository.rb +209 -0
- data/lib/packo/models/repository/binary.rb +32 -0
- data/lib/packo/models/repository/binary/mirror.rb +35 -0
- data/lib/packo/models/repository/package.rb +73 -0
- data/lib/packo/models/repository/package/binary.rb +34 -0
- data/lib/packo/models/repository/package/binary/build.rb +36 -0
- data/lib/packo/models/repository/package/source.rb +36 -0
- data/lib/packo/models/repository/package/source/feature.rb +36 -0
- data/lib/packo/models/repository/package/source/flavor.rb +36 -0
- data/lib/packo/models/repository/package/virtual.rb +32 -0
- data/lib/packo/models/repository/source.rb +30 -0
- data/lib/packo/models/repository/virtual.rb +30 -0
- data/lib/packo/models/selector.rb +34 -0
- data/lib/packo/models/tag.rb +30 -0
- data/lib/packo/package.rb +239 -0
- data/lib/packo/package/blocker.rb +100 -0
- data/lib/packo/package/blockers.rb +40 -0
- data/lib/packo/package/dependencies.rb +40 -0
- data/lib/packo/package/dependency.rb +100 -0
- data/lib/packo/package/feature.rb +55 -0
- data/lib/packo/package/features.rb +105 -0
- data/lib/packo/package/flavor.rb +101 -0
- data/lib/packo/package/tags.rb +60 -0
- data/lib/packo/package/tags/expression.rb +130 -0
- data/lib/packo/package/tags/expression/group.rb +28 -0
- data/lib/packo/package/tags/expression/logic.rb +48 -0
- data/lib/packo/package/tags/expression/name.rb +28 -0
- data/lib/packo/profile.rb +174 -0
- data/lib/packo/rbuild.rb +22 -0
- data/lib/packo/rbuild/behaviors.rb +20 -0
- data/lib/packo/rbuild/behaviors/default.rb +27 -0
- data/lib/packo/rbuild/feature.rb +64 -0
- data/lib/packo/rbuild/features.rb +65 -0
- data/lib/packo/rbuild/flavor.rb +67 -0
- data/lib/packo/rbuild/module.rb +40 -0
- data/lib/packo/rbuild/modules.rb +27 -0
- data/lib/packo/rbuild/modules/building.rb +24 -0
- data/lib/packo/rbuild/modules/building/autotools.rb +315 -0
- data/lib/packo/rbuild/modules/building/cmake.rb +38 -0
- data/lib/packo/rbuild/modules/building/patch.rb +84 -0
- data/lib/packo/rbuild/modules/building/rake.rb +74 -0
- data/lib/packo/rbuild/modules/building/strip.rb +41 -0
- data/lib/packo/rbuild/modules/misc.rb +26 -0
- data/lib/packo/rbuild/modules/misc/fetcher.rb +177 -0
- data/lib/packo/rbuild/modules/misc/fetching.rb +22 -0
- data/lib/packo/rbuild/modules/misc/fetching/git.rb +57 -0
- data/lib/packo/rbuild/modules/misc/fetching/github.rb +31 -0
- data/lib/packo/rbuild/modules/misc/fetching/gnu.rb +59 -0
- data/lib/packo/rbuild/modules/misc/fetching/mercurial.rb +51 -0
- data/lib/packo/rbuild/modules/misc/fetching/sourceforge.rb +47 -0
- data/lib/packo/rbuild/modules/misc/fetching/subversion.rb +51 -0
- data/lib/packo/rbuild/modules/misc/fetching/wget.rb +57 -0
- data/lib/packo/rbuild/modules/misc/unpacker.rb +70 -0
- data/lib/packo/rbuild/modules/misc/unpacking.rb +23 -0
- data/lib/packo/rbuild/modules/misc/unpacking/lzma.rb +34 -0
- data/lib/packo/rbuild/modules/misc/unpacking/tar.rb +35 -0
- data/lib/packo/rbuild/modules/misc/unpacking/xz.rb +34 -0
- data/lib/packo/rbuild/modules/misc/unpacking/zip.rb +26 -0
- data/lib/packo/rbuild/modules/packaging.rb +20 -0
- data/lib/packo/rbuild/modules/packaging/pko.rb +78 -0
- data/lib/packo/rbuild/package.rb +281 -0
- data/lib/packo/rbuild/package/manifest.rb +169 -0
- data/lib/packo/rbuild/stages.rb +171 -0
- data/lib/packo/rbuild/stages/callbacks.rb +96 -0
- data/lib/packo/rbuild/stages/stage.rb +50 -0
- data/lib/packo/repository.rb +95 -0
- data/lib/packo/repository/binary.rb +116 -0
- data/lib/packo/repository/source.rb +77 -0
- data/lib/packo/repository/virtual.rb +66 -0
- data/lib/packo/system.rb +53 -0
- data/lib/packo/version.rb +26 -0
- metadata +276 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of packo.
|
5
|
+
#
|
6
|
+
# packo is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# packo is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Packo; module RBuild; module Modules; module Building
|
21
|
+
|
22
|
+
class CMake < Module
|
23
|
+
def initialize (package)
|
24
|
+
super(package)
|
25
|
+
|
26
|
+
package.stages.add :generate, self.method(:generate), before: :configure
|
27
|
+
end
|
28
|
+
|
29
|
+
def finalize
|
30
|
+
package.stages.delete :generate, self.method(:generate)
|
31
|
+
end
|
32
|
+
|
33
|
+
def generate
|
34
|
+
Packo.sh 'cmake', package.cmake || 'CMakeLists.txt'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end; end; end; end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of packo.
|
5
|
+
#
|
6
|
+
# packo is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# packo is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Packo; module RBuild; module Modules; module Building
|
21
|
+
|
22
|
+
class Patch < Module
|
23
|
+
def self.do (patch, options={})
|
24
|
+
return unless patch
|
25
|
+
|
26
|
+
begin
|
27
|
+
if patch.is_a?(FFFS::File) || options[:stream]
|
28
|
+
temp = Tempfile.new('patch')
|
29
|
+
temp.write patch.to_s
|
30
|
+
temp.flush
|
31
|
+
|
32
|
+
Packo.sh "patch -f -p#{options[:level] || 0} < '#{temp.path}'", silent: options[:silent]
|
33
|
+
|
34
|
+
temp.close(true)
|
35
|
+
else
|
36
|
+
Packo.sh "patch -f -p#{options[:level] || 0} < '#{patch}'", silent: options[:silent]
|
37
|
+
end
|
38
|
+
rescue Exception => e
|
39
|
+
Packo.debug e unless options[:silent]
|
40
|
+
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
|
44
|
+
return true
|
45
|
+
end
|
46
|
+
|
47
|
+
def initialize (package)
|
48
|
+
super(package)
|
49
|
+
|
50
|
+
package.stages.add :patch, self.method(:patch), after: :fetch, priority: -1
|
51
|
+
|
52
|
+
before :initialize do |package|
|
53
|
+
package.define_singleton_method :patch, &Patch.method(:do)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def finalize
|
58
|
+
package.stages.delete :patch, self.method(:patch)
|
59
|
+
end
|
60
|
+
|
61
|
+
def patch
|
62
|
+
package.stages.callbacks(:patch).do(package) {
|
63
|
+
package.filesystem.patches.each {|name, file|
|
64
|
+
_patch(file)
|
65
|
+
}
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def _patch (what)
|
72
|
+
if what.is_a?(FFFS::Directory)
|
73
|
+
what.sort.each {|(name, file)|
|
74
|
+
Do.cd(what.name) {
|
75
|
+
_patch(file)
|
76
|
+
}
|
77
|
+
}
|
78
|
+
else
|
79
|
+
package.patch(what) rescue nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end; end; end; end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of packo.
|
5
|
+
#
|
6
|
+
# packo is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# packo is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Packo; module RBuild; module Modules; module Building
|
21
|
+
|
22
|
+
class Rake < Module
|
23
|
+
def initialize (package)
|
24
|
+
super(package)
|
25
|
+
|
26
|
+
package.stages.add :compile, self.method(:compile), after: :fetch
|
27
|
+
package.stages.add :install, self.method(:install), after: :compile
|
28
|
+
|
29
|
+
package.before :build do
|
30
|
+
package.environment[:RUBYOPT] = ''
|
31
|
+
end
|
32
|
+
|
33
|
+
package.rake = Class.new(Module::Helper) {
|
34
|
+
def initialize (package)
|
35
|
+
super(package)
|
36
|
+
end
|
37
|
+
|
38
|
+
def do (*args)
|
39
|
+
package.environment.sandbox {
|
40
|
+
Packo.sh 'rake', *args
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def install (*args)
|
45
|
+
package.environment.sandbox {
|
46
|
+
self.do 'install', *args
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def version (name, slot=nil)
|
51
|
+
slot ? @versions[name.to_sym] = slot : @versions[name.to_sym]
|
52
|
+
end
|
53
|
+
}.new(package)
|
54
|
+
end
|
55
|
+
|
56
|
+
def finalize
|
57
|
+
package.stages.delete :compile, self.method(:compile)
|
58
|
+
package.stages.delete :install, self.method(:install)
|
59
|
+
end
|
60
|
+
|
61
|
+
def compile
|
62
|
+
package.stages.callbacks(:compile).do(@configuration) {
|
63
|
+
package.rake.do
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
def install
|
68
|
+
package.stages.callbacks(:install).do(@configuration) {
|
69
|
+
package.rake.install
|
70
|
+
}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end; end; end; end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of packo.
|
5
|
+
#
|
6
|
+
# packo is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# packo is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Packo; module RBuild; module Modules; module Building
|
21
|
+
|
22
|
+
class Strip < Module
|
23
|
+
def initialize (package)
|
24
|
+
super(package)
|
25
|
+
|
26
|
+
package.stages.add :strip, self.method(:strip), before: :pack
|
27
|
+
end
|
28
|
+
|
29
|
+
def strip
|
30
|
+
package.stages.callbacks(:strip).do {
|
31
|
+
next if package.env[:NO_STRIP]
|
32
|
+
|
33
|
+
Find.find(package.distdir) {|file|
|
34
|
+
Packo.sh 'strip', file, silent: true rescue nil
|
35
|
+
}
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end; end; end; end
|
41
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of packo.
|
5
|
+
#
|
6
|
+
# packo is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# packo is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'packo/rbuild/modules/misc/fetcher'
|
21
|
+
require 'packo/rbuild/modules/misc/unpacker'
|
22
|
+
|
23
|
+
# Bleeding edge stuff
|
24
|
+
require 'packo/rbuild/modules/misc/fetching/git'
|
25
|
+
require 'packo/rbuild/modules/misc/fetching/mercurial'
|
26
|
+
require 'packo/rbuild/modules/misc/fetching/subversion'
|
@@ -0,0 +1,177 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of packo.
|
5
|
+
#
|
6
|
+
# packo is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# packo is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'uri'
|
21
|
+
require 'digest/sha1'
|
22
|
+
|
23
|
+
module Packo; module RBuild; module Modules; module Misc
|
24
|
+
|
25
|
+
class Fetcher < Module
|
26
|
+
@@wrappers = {}
|
27
|
+
|
28
|
+
def self.register (name, &block)
|
29
|
+
@@wrappers[name.to_sym] = block
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.url (url, package)
|
33
|
+
whole, scheme, url = url.to_s.match(%r{^(.+?)://(.+)$}).to_a
|
34
|
+
|
35
|
+
raise ArgumentError.new('Invalid URI passed') unless whole
|
36
|
+
|
37
|
+
if ['https', 'http', 'ftp'].member?(scheme)
|
38
|
+
"#{scheme}://#{url.interpolate(package)}"
|
39
|
+
elsif @@wrappers[scheme.to_sym]
|
40
|
+
@@wrappers[scheme.to_sym].call(url, package)
|
41
|
+
else
|
42
|
+
raise ArgumentError.new('Scheme not supported')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.fetch (url, to)
|
47
|
+
if !System.env[:FETCHER]
|
48
|
+
raise RuntimeError.new('Set a FETCHER variable.')
|
49
|
+
end
|
50
|
+
|
51
|
+
Packo.sh System.env[:FETCHER].interpolate(OpenStruct.new(
|
52
|
+
source: Fetcher.url(url, self),
|
53
|
+
output: to
|
54
|
+
)).gsub('%o', to).gsub('%u', Fetcher.url(url, self)), silent: !System.env[:VERBOSE]
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.filename (text)
|
58
|
+
return unless text
|
59
|
+
|
60
|
+
File.basename(text).sub(/\?.*$/, '')
|
61
|
+
end
|
62
|
+
|
63
|
+
def initialize (package)
|
64
|
+
super(package)
|
65
|
+
|
66
|
+
package.stages.add :fetch, self.method(:fetch), after: :beginning
|
67
|
+
package.stages.add :digest, self.method(:digest), after: :fetch, strict: true
|
68
|
+
|
69
|
+
after :initialize do |result, package|
|
70
|
+
package.define_singleton_method :fetch, &Fetcher.method(:fetch)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def finalize
|
75
|
+
package.stages.delete :fetch, self.method(:fetch)
|
76
|
+
package.stages.delete :digest, self.method(:digest)
|
77
|
+
end
|
78
|
+
|
79
|
+
def url (text)
|
80
|
+
text.interpolate(package)
|
81
|
+
end
|
82
|
+
|
83
|
+
def filename (text)
|
84
|
+
Fetcher.filename(url(text))
|
85
|
+
end
|
86
|
+
|
87
|
+
def fetch
|
88
|
+
if package.source.is_a?(Hash)
|
89
|
+
package.distfiles = {}
|
90
|
+
|
91
|
+
sources = Hash[package.source.map {|(name, source)|
|
92
|
+
next if package.digests[url(source)] && (Do.digest("#{package.fetchdir}/#{package.digests[url(source)].name}") rescue false) == package.digests[url(source)].digest
|
93
|
+
|
94
|
+
url = Fetcher.url(source, package) or fail "Failed to get the real URL for: #{source}"
|
95
|
+
|
96
|
+
[name, (
|
97
|
+
if url.is_a?(Array) && url.length == 2
|
98
|
+
url + [source]
|
99
|
+
else
|
100
|
+
([url] + [nil, source]).flatten
|
101
|
+
end
|
102
|
+
)]
|
103
|
+
}.compact]
|
104
|
+
|
105
|
+
package.stages.callbacks(:fetch).do(sources) {
|
106
|
+
sources.each {|name, (source, output, original)|
|
107
|
+
package.distfiles[name] = OpenStruct.new(
|
108
|
+
path: "#{package.fetchdir}/#{output || filename(source)}",
|
109
|
+
url: url(original)
|
110
|
+
)
|
111
|
+
|
112
|
+
package.fetch source, package.distfiles[name].path
|
113
|
+
}
|
114
|
+
|
115
|
+
package.source.each {|name, source|
|
116
|
+
next if package.distfiles[name]
|
117
|
+
|
118
|
+
package.distfiles[name] = OpenStruct.new(
|
119
|
+
path: "#{package.fetchdir}/#{package.digests[url(source)].name}",
|
120
|
+
url: url(source)
|
121
|
+
)
|
122
|
+
}
|
123
|
+
}
|
124
|
+
else
|
125
|
+
package.distfiles = []
|
126
|
+
|
127
|
+
sources = [package.source].flatten.compact.map {|source|
|
128
|
+
next if package.digests[url(source)] && (Do.digest("#{package.fetchdir}/#{package.digests[url(source)].name}") rescue false) == package.digests[url(source)].digest
|
129
|
+
|
130
|
+
url = Fetcher.url(source, package) or fail "Failed to get the real URL for: #{source}"
|
131
|
+
|
132
|
+
if url.is_a?(Array) && url.length == 2
|
133
|
+
url + [source]
|
134
|
+
else
|
135
|
+
([url] + [nil, source]).flatten
|
136
|
+
end
|
137
|
+
}.compact
|
138
|
+
|
139
|
+
package.stages.callbacks(:fetch).do(sources) {
|
140
|
+
sources.each {|(source, output, original)|
|
141
|
+
package.distfiles << OpenStruct.new(
|
142
|
+
path: "#{package.fetchdir}/#{output || filename(source)}",
|
143
|
+
url: url(original)
|
144
|
+
)
|
145
|
+
|
146
|
+
package.fetch source, package.distfiles.last.path
|
147
|
+
}
|
148
|
+
|
149
|
+
[package.source].flatten.compact.select {|source|
|
150
|
+
!!package.digests[url(source)]
|
151
|
+
}.each {|source|
|
152
|
+
package.distfiles << OpenStruct.new(
|
153
|
+
path: "#{package.fetchdir}/#{package.digests[url(source)].name}",
|
154
|
+
url: url(source)
|
155
|
+
)
|
156
|
+
}
|
157
|
+
}
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def digest
|
162
|
+
package.stages.callbacks(:digest).do(package.distfiles) {
|
163
|
+
package.distfiles.each {|name, file|
|
164
|
+
file ||= name
|
165
|
+
|
166
|
+
original = package.digests[file.url].digest or next
|
167
|
+
digest = Do.digest(file.path) or next
|
168
|
+
|
169
|
+
if digest != original
|
170
|
+
raise ArgumentError.new("#{File.basename(file.path)} digest is #{digest} but should be #{original}")
|
171
|
+
end
|
172
|
+
}
|
173
|
+
}
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
end; end; end; end
|