packo 0.0.1.alpha.1 → 0.0.1.alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/packo +13 -2
- data/lib/packo.rb +16 -52
- data/lib/packo/cli.rb +9 -3
- data/lib/packo/cli/base.rb +65 -66
- data/lib/packo/cli/build.rb +124 -128
- data/lib/packo/cli/files.rb +7 -7
- data/lib/packo/cli/repository.rb +40 -26
- data/lib/packo/do.rb +106 -73
- data/lib/packo/environment.rb +2 -2
- data/lib/packo/extensions.rb +20 -6
- data/lib/packo/host.rb +10 -0
- data/lib/packo/models.rb +8 -2
- data/lib/packo/models/repository.rb +17 -14
- data/lib/packo/package.rb +9 -3
- data/lib/packo/profile.rb +2 -2
- data/lib/packo/rbuild.rb +0 -2
- data/lib/packo/rbuild/behaviors/default.rb +3 -2
- data/lib/packo/rbuild/{modules/misc/fetching.rb → behaviors/python.rb} +8 -3
- data/lib/packo/rbuild/modules.rb +2 -3
- data/lib/packo/rbuild/modules/building.rb +5 -2
- data/lib/packo/rbuild/modules/building/autotools.rb +11 -11
- data/lib/packo/rbuild/modules/building/rake.rb +71 -7
- data/lib/packo/rbuild/modules/building/scons.rb +128 -0
- data/lib/packo/rbuild/modules/{misc/fetcher.rb → fetcher.rb} +5 -5
- data/lib/packo/rbuild/modules/fetching.rb +29 -0
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/git.rb +15 -9
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/github.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/gnu.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/mercurial.rb +11 -7
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/sourceforge.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/subversion.rb +23 -5
- data/lib/packo/rbuild/modules/misc.rb +0 -8
- data/lib/packo/rbuild/modules/packager.rb +63 -0
- data/lib/packo/rbuild/modules/packaging.rb +2 -0
- data/lib/packo/rbuild/modules/packaging/pko.rb +24 -44
- data/lib/packo/rbuild/modules/{misc/unpacker.rb → unpacker.rb} +2 -2
- data/lib/packo/rbuild/modules/{misc/unpacking.rb → unpacking.rb} +6 -4
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/lzma.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/tar.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/xz.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/zip.rb +1 -1
- data/lib/packo/rbuild/package.rb +17 -8
- data/lib/packo/repository.rb +1 -1
- data/lib/packo/repository/virtual.rb +16 -0
- data/lib/packo/utils.rb +106 -0
- data/lib/packo/version.rb +1 -1
- metadata +39 -25
- data/lib/packo/rbuild/modules/misc/fetching/wget.rb +0 -57
@@ -20,7 +20,7 @@
|
|
20
20
|
require 'uri'
|
21
21
|
require 'digest/sha1'
|
22
22
|
|
23
|
-
module Packo; module RBuild; module Modules
|
23
|
+
module Packo; module RBuild; module Modules
|
24
24
|
|
25
25
|
class Fetcher < Module
|
26
26
|
@@wrappers = {}
|
@@ -89,7 +89,7 @@ class Fetcher < Module
|
|
89
89
|
package.distfiles = {}
|
90
90
|
|
91
91
|
sources = Hash[package.source.map {|(name, source)|
|
92
|
-
next if package.digests[url(source)] && (
|
92
|
+
next if package.digests[url(source)] && (Packo.digest("#{package.fetchdir}/#{package.digests[url(source)].name}") rescue false) == package.digests[url(source)].digest
|
93
93
|
|
94
94
|
url = Fetcher.url(source, package) or fail "Failed to get the real URL for: #{source}"
|
95
95
|
|
@@ -125,7 +125,7 @@ class Fetcher < Module
|
|
125
125
|
package.distfiles = []
|
126
126
|
|
127
127
|
sources = [package.source].flatten.compact.map {|source|
|
128
|
-
next if package.digests[url(source)] && (
|
128
|
+
next if package.digests[url(source)] && (Packo.digest("#{package.fetchdir}/#{package.digests[url(source)].name}") rescue false) == package.digests[url(source)].digest
|
129
129
|
|
130
130
|
url = Fetcher.url(source, package) or fail "Failed to get the real URL for: #{source}"
|
131
131
|
|
@@ -164,7 +164,7 @@ class Fetcher < Module
|
|
164
164
|
file ||= name
|
165
165
|
|
166
166
|
original = package.digests[file.url].digest or next
|
167
|
-
digest =
|
167
|
+
digest = Packo.digest(file.path) or next
|
168
168
|
|
169
169
|
if digest != original
|
170
170
|
raise ArgumentError.new("#{File.basename(file.path)} digest is #{digest} but should be #{original}")
|
@@ -174,4 +174,4 @@ class Fetcher < Module
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
-
end; end; end
|
177
|
+
end; end; end
|
@@ -0,0 +1,29 @@
|
|
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/fetcher'
|
21
|
+
|
22
|
+
require 'packo/rbuild/modules/fetching/gnu'
|
23
|
+
require 'packo/rbuild/modules/fetching/sourceforge'
|
24
|
+
require 'packo/rbuild/modules/fetching/github'
|
25
|
+
|
26
|
+
# Bleeding edge stuff
|
27
|
+
require 'packo/rbuild/modules/fetching/git'
|
28
|
+
require 'packo/rbuild/modules/fetching/subversion'
|
29
|
+
require 'packo/rbuild/modules/fetching/mercurial'
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
module Packo; module RBuild; module Modules; module
|
20
|
+
module Packo; module RBuild; module Modules; module Fetching
|
21
21
|
|
22
22
|
class Git < Module
|
23
23
|
def initialize (package)
|
@@ -26,32 +26,38 @@ class Git < Module
|
|
26
26
|
package.avoid [Fetcher, Unpacker]
|
27
27
|
|
28
28
|
package.stages.add :fetch, self.method(:fetch), after: :beginning
|
29
|
+
|
30
|
+
package.after :initialize do
|
31
|
+
package.dependencies << 'vcs/git!'
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def finalize
|
32
36
|
package.stages.delete :fetch, self.method(:fetch)
|
33
37
|
end
|
34
38
|
|
39
|
+
def git (*args)
|
40
|
+
Packo.sh 'git', *args
|
41
|
+
end
|
42
|
+
|
35
43
|
def fetch
|
36
44
|
package.stages.callbacks(:fetch).do {
|
37
|
-
whole, url, branch, commit = package.source.match(%r[^(\w+://.*?)(?::(.*?))?(?:@(.*?))?$]).to_a
|
38
|
-
|
39
45
|
package.clean!
|
40
46
|
package.create!
|
41
47
|
|
42
48
|
options = []
|
43
|
-
options << '--branch' << branch if branch
|
44
|
-
options << '--depth' << '1'
|
49
|
+
options << '--branch' << package.git[:branch].to_s.interpolate(package) if package.git[:branch]
|
50
|
+
options << '--depth' << '1' unless package.git[:commit]
|
45
51
|
|
46
|
-
|
52
|
+
git :clone, *options, package.git[:repository].to_s.interpolate(package), package.workdir
|
47
53
|
|
48
54
|
Do.cd package.workdir
|
49
55
|
|
50
|
-
if commit
|
51
|
-
|
56
|
+
if package.git[:commit] || package.git[:tag]
|
57
|
+
git 'checkout', (package.git[:commit] || package.git[:tag]).to_s.interpolate(package)
|
52
58
|
end
|
53
59
|
}
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
57
|
-
end; end; end; end
|
63
|
+
end; end; end; end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
module Packo; module RBuild; module Modules; module
|
20
|
+
module Packo; module RBuild; module Modules; module Fetching
|
21
21
|
|
22
22
|
Fetcher.register :github do |url, package|
|
23
23
|
whole, user, project, file = url.interpolate(package).match(%r{^(.*?)/(.*?)/(.*?)$}).to_a
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
require 'net/http'
|
21
21
|
|
22
|
-
module Packo; module RBuild; module Modules; module
|
22
|
+
module Packo; module RBuild; module Modules; module Fetching
|
23
23
|
|
24
24
|
Fetcher.register :gnu do |url, package|
|
25
25
|
whole, name, version = url.interpolate(package).match(%r{^(.*?)/(.*?)$}).to_a
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
module Packo; module RBuild; module Modules; module
|
20
|
+
module Packo; module RBuild; module Modules; module Fetching
|
21
21
|
|
22
22
|
class Mercurial < Module
|
23
23
|
def initialize (package)
|
@@ -26,26 +26,30 @@ class Mercurial < Module
|
|
26
26
|
package.avoid [Fetcher, Unpacker]
|
27
27
|
|
28
28
|
package.stages.add :fetch, self.method(:fetch), after: :beginning
|
29
|
+
|
30
|
+
package.after :initialize do
|
31
|
+
package.dependencies << 'vcs/mercurial!'
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def finalize
|
32
36
|
package.stages.delete :fetch, self.method(:fetch)
|
33
37
|
end
|
34
38
|
|
39
|
+
def hg (*args)
|
40
|
+
Packo.sh 'hg', *args
|
41
|
+
end
|
42
|
+
|
35
43
|
def fetch
|
36
44
|
package.stages.callbacks(:fetch).do {
|
37
|
-
whole, url = package.source.match(%r[^(\w+://.*?)$]).to_a
|
38
|
-
|
39
45
|
package.clean!
|
40
46
|
package.create!
|
41
47
|
|
42
|
-
|
43
|
-
|
44
|
-
Packo.sh 'hg', 'clone', *options, url, package.workdir
|
48
|
+
hg :clone, package.mercurial[:repository].to_s.interpolate(package), package.workdir
|
45
49
|
|
46
50
|
Do.cd package.workdir
|
47
51
|
}
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
51
|
-
end; end; end; end
|
55
|
+
end; end; end; end
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
require 'net/http'
|
21
21
|
|
22
|
-
module Packo; module RBuild; module Modules; module
|
22
|
+
module Packo; module RBuild; module Modules; module Fetching
|
23
23
|
|
24
24
|
Fetcher.register :sourceforge, do |url, package|
|
25
25
|
whole, project, path = url.interpolate(package).match(%r{^(.*?)/(.*?)$}).to_a
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
module Packo; module RBuild; module Modules; module
|
20
|
+
module Packo; module RBuild; module Modules; module Fetching
|
21
21
|
|
22
22
|
class Subversion < Module
|
23
23
|
def initialize (package)
|
@@ -26,26 +26,44 @@ class Subversion < Module
|
|
26
26
|
package.avoid [Fetcher, Unpacker]
|
27
27
|
|
28
28
|
package.stages.add :fetch, self.method(:fetch), after: :beginning
|
29
|
+
|
30
|
+
package.after :initialize do
|
31
|
+
package.dependencies << 'vcs/subversion!'
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def finalize
|
32
36
|
package.stages.delete :fetch, self.method(:fetch)
|
33
37
|
end
|
34
38
|
|
39
|
+
def svn (*args)
|
40
|
+
Packo.sh 'svn', *args
|
41
|
+
end
|
42
|
+
|
35
43
|
def fetch
|
36
44
|
package.stages.callbacks(:fetch).do {
|
37
|
-
whole, url = package.source.match(%r[^(\w+://.*?)$]).to_a
|
38
|
-
|
39
45
|
package.clean!
|
40
46
|
package.create!
|
41
47
|
|
48
|
+
repository = package.subversion[:repository].to_s.interpolate(package)
|
49
|
+
|
42
50
|
options = []
|
43
51
|
|
44
|
-
|
52
|
+
if package.subversion[:revision]
|
53
|
+
options << '--revision' << package.subversion[:revision].to_s.interpolate(package)
|
54
|
+
end
|
55
|
+
|
56
|
+
if package.subversion[:tag]
|
57
|
+
svn 'checkout', *options, "#{repository}/tags/#{package.subversion[:tag].to_s.interpolate(package)}", package.workdir
|
58
|
+
elsif package.subversion[:branch]
|
59
|
+
svn 'checkout', *options, "#{repository}/branches/#{package.subversion[:branch].to_s.interpolate(package)}", package.workdir
|
60
|
+
else
|
61
|
+
svn 'checkout', *options, "#{repository}/trunk", package.workdir
|
62
|
+
end
|
45
63
|
|
46
64
|
Do.cd package.workdir
|
47
65
|
}
|
48
66
|
end
|
49
67
|
end
|
50
68
|
|
51
|
-
end; end; end; end
|
69
|
+
end; end; end; end
|
@@ -16,11 +16,3 @@
|
|
16
16
|
# You should have received a copy of the GNU Affero General Public License
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
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,63 @@
|
|
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
|
21
|
+
|
22
|
+
class Packager < Module
|
23
|
+
@@formats = {}
|
24
|
+
|
25
|
+
def self.register (type, &block)
|
26
|
+
@@formats[type] = block
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.do (package, to=nil)
|
30
|
+
|
31
|
+
block = @@formats.find {|extension, block|
|
32
|
+
(to || '.pko').end_with?(extension)
|
33
|
+
}.last rescue nil
|
34
|
+
|
35
|
+
if block
|
36
|
+
block.call(package, to)
|
37
|
+
else
|
38
|
+
Packo.debug 'Package format unsupported'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def initialize (package)
|
43
|
+
super(package)
|
44
|
+
|
45
|
+
package.stages.add :pack, self.method(:pack), at: :end, strict: true
|
46
|
+
|
47
|
+
before :initialize do |package|
|
48
|
+
package.define_singleton_method :pack, &Packager.method(:do)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def finalize
|
53
|
+
package.stages.delete :pack, self.method(:pack)
|
54
|
+
end
|
55
|
+
|
56
|
+
def pack
|
57
|
+
package.stages.callbacks(:pack).do {
|
58
|
+
Packager.do(package)
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end; end; end
|
@@ -19,60 +19,40 @@
|
|
19
19
|
|
20
20
|
module Packo; module RBuild; module Modules; module Packaging
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.unpack (name, to)
|
28
|
-
FileUtils.mkpath(to) rescue nil
|
29
|
-
|
30
|
-
Packo.sh 'tar', 'xJf', name, '-C', to, '--preserve', silent: true
|
31
|
-
end
|
32
|
-
|
33
|
-
def initialize (package)
|
34
|
-
super(package)
|
35
|
-
|
36
|
-
package.stages.add :pack, self.method(:pack), at: :end, strict: true
|
37
|
-
end
|
38
|
-
|
39
|
-
def finalize
|
40
|
-
package.stages.delete :pack, self.method(:pack)
|
41
|
-
end
|
22
|
+
pack = lambda do |name, *files|
|
23
|
+
Packo.sh 'tar', 'cJf', name, *files, '--preserve', silent: true
|
24
|
+
end
|
42
25
|
|
43
|
-
|
44
|
-
|
45
|
-
path = "#{package.to_s(:package)}.pko"
|
26
|
+
Packager.register('.pko') do |package, to=nil|
|
27
|
+
path = to || "#{package.to_s(:package)}.pko"
|
46
28
|
|
47
|
-
|
29
|
+
Dir.chdir package.directory
|
48
30
|
|
49
|
-
|
31
|
+
FileUtils.mkpath "#{package.directory}/pre"
|
50
32
|
|
51
|
-
|
52
|
-
|
53
|
-
|
33
|
+
package.filesystem.pre.each {|name, file|
|
34
|
+
File.write("pre/#{name}", file.content, 0777)
|
35
|
+
}
|
54
36
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
37
|
+
FileUtils.mkpath "#{package.directory}/post"
|
38
|
+
package.filesystem.post.each {|name, file|
|
39
|
+
File.write("post/#{name}", file.content, 0777)
|
40
|
+
}
|
59
41
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
42
|
+
FileUtils.mkpath "#{package.directory}/selectors"
|
43
|
+
package.filesystem.selectors.each {|name, file|
|
44
|
+
File.write("selectors/#{name}", file.content, 0777)
|
45
|
+
}
|
64
46
|
|
65
|
-
|
47
|
+
Package::Manifest.new(package).save('manifest.xml')
|
66
48
|
|
67
|
-
|
68
|
-
|
49
|
+
package.stages.callbacks(:packing).do {
|
50
|
+
Do.clean(package.distdir)
|
69
51
|
|
70
|
-
|
71
|
-
|
52
|
+
pack.call(path, 'dist/', 'pre/', 'post/', 'selectors/', 'manifest.xml')
|
53
|
+
}
|
72
54
|
|
73
|
-
|
74
|
-
}
|
75
|
-
end
|
55
|
+
path
|
76
56
|
end
|
77
57
|
|
78
58
|
end; end; end; end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
module Packo; module RBuild; module Modules
|
20
|
+
module Packo; module RBuild; module Modules
|
21
21
|
|
22
22
|
class Unpacker < Module
|
23
23
|
@@formats = {}
|
@@ -67,4 +67,4 @@ class Unpacker < Module
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
end; end; end
|
70
|
+
end; end; end
|
@@ -17,7 +17,9 @@
|
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
require 'packo/rbuild/modules/
|
21
|
-
|
22
|
-
require 'packo/rbuild/modules/
|
23
|
-
require 'packo/rbuild/modules/
|
20
|
+
require 'packo/rbuild/modules/unpacker'
|
21
|
+
|
22
|
+
require 'packo/rbuild/modules/unpacking/tar'
|
23
|
+
require 'packo/rbuild/modules/unpacking/zip'
|
24
|
+
require 'packo/rbuild/modules/unpacking/lzma'
|
25
|
+
require 'packo/rbuild/modules/unpacking/xz'
|