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
data/bin/packo
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#--
|
4
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
5
|
+
#
|
6
|
+
# This file is part of packo.
|
7
|
+
#
|
8
|
+
# packo is free software: you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU Affero General Public License as published
|
10
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# packo is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU Affero General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU Affero General Public License
|
19
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
20
|
+
#++
|
21
|
+
|
22
|
+
commands = Dir.glob('/usr/bin/packo-*').map {|path|
|
23
|
+
File.basename(path).sub('packo-', '')
|
24
|
+
}
|
25
|
+
|
26
|
+
descriptions = {
|
27
|
+
:base => 'Manage packages in the system',
|
28
|
+
:files => 'Manage various informations about package contents',
|
29
|
+
:build => 'Manage packø building system',
|
30
|
+
:select => 'Manage various configurations',
|
31
|
+
:repository => 'Manage packø repositories',
|
32
|
+
:env => 'Manage packø environment',
|
33
|
+
:db => 'Manage packø databases',
|
34
|
+
:profile => 'Manage packø profiles',
|
35
|
+
}
|
36
|
+
|
37
|
+
trusted = [:base, :select, :db, :profile]
|
38
|
+
|
39
|
+
if commands.member?(ARGV.first)
|
40
|
+
command = ARGV.shift
|
41
|
+
sandbox = false
|
42
|
+
fakeroot = false
|
43
|
+
|
44
|
+
ENV['PATH'].split(':').each {|folder|
|
45
|
+
sandbox = File.executable?("#{folder}/sandbox") if !sandbox
|
46
|
+
fakeroot = File.executable?("#{folder}/fakeroot") if !fakeroot
|
47
|
+
}
|
48
|
+
|
49
|
+
warn "sandbox isn't installed" if !sandbox
|
50
|
+
warn "fakeroot isn't installed" if !fakeroot
|
51
|
+
|
52
|
+
exit system(*([((!trusted.include?(command.to_sym)) ? 'sandbox' : nil), 'fakeroot', "packo-#{command}"] + ARGV).compact)
|
53
|
+
end
|
54
|
+
|
55
|
+
require 'rubygems' unless defined?(Gem)
|
56
|
+
|
57
|
+
require 'packo'
|
58
|
+
require 'packo/cli/base'
|
59
|
+
|
60
|
+
class Application < Packo::CLI::Base
|
61
|
+
class_option :help, :type => :boolean, :desc => 'Show help usage'
|
62
|
+
|
63
|
+
desc 'version', 'Show current version'
|
64
|
+
map '-v' => :version, '--version' => :version
|
65
|
+
def version
|
66
|
+
puts "packø v. #{Packo.version}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
commands.each {|command|
|
71
|
+
Application.class_eval %{
|
72
|
+
desc '#{command} [ARGUMENTS...]', '#{descriptions[command.to_sym] || '...'}'
|
73
|
+
def #{command} (*arguments)
|
74
|
+
end
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
Application.start(ARGV)
|
data/bin/packo-base
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/base'
|
24
|
+
Packo::CLI::Base.start(ARGV)
|
data/bin/packo-build
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/build'
|
24
|
+
Packo::CLI::Build.start(ARGV)
|
data/bin/packo-db
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/database'
|
24
|
+
Packo::CLI::Database.start(ARGV)
|
data/bin/packo-env
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/environment'
|
24
|
+
Packo::CLI::Environment.start(ARGV)
|
data/bin/packo-files
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/files'
|
24
|
+
Packo::CLI::Files.start(ARGV)
|
data/bin/packo-profile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/profile'
|
24
|
+
Packo::CLI::Profile.start(ARGV)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/repository'
|
24
|
+
Packo::CLI::Repository.start(ARGV)
|
data/bin/packo-select
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyleft meh. [http://meh.doesntexist.org | meh@paranoici.org]
|
4
|
+
#
|
5
|
+
# This file is part of packo.
|
6
|
+
#
|
7
|
+
# packo is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published
|
9
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# packo is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Affero General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'rubygems' unless defined?(Gem)
|
22
|
+
|
23
|
+
require 'packo/cli/select'
|
24
|
+
Packo::CLI::Select.start(ARGV)
|
data/lib/packo.rb
ADDED
@@ -0,0 +1,186 @@
|
|
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 'ostruct'
|
21
|
+
|
22
|
+
module Packo
|
23
|
+
def self.sh (*cmd, &block)
|
24
|
+
options = (Hash === cmd.last) ? cmd.pop : {}
|
25
|
+
|
26
|
+
if !block_given?
|
27
|
+
show_command = cmd.join(' ')
|
28
|
+
show_command = show_command[0, 42] + '...' unless $trace
|
29
|
+
|
30
|
+
block = lambda {|ok, status|
|
31
|
+
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}] in {#{Dir.pwd}}"
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
if options[:silent]
|
36
|
+
options[:out] = '/dev/null'
|
37
|
+
options[:err] = '/dev/null'
|
38
|
+
else
|
39
|
+
print "#{cmd.first} "
|
40
|
+
cmd[1 .. cmd.length].each {|cmd|
|
41
|
+
if cmd.match(/[ \$'`]/)
|
42
|
+
print %Q{"#{cmd}" }
|
43
|
+
else
|
44
|
+
print "#{cmd} "
|
45
|
+
end
|
46
|
+
}
|
47
|
+
print "\n"
|
48
|
+
end
|
49
|
+
|
50
|
+
options.delete :silent
|
51
|
+
|
52
|
+
result = Kernel.system(options[:env] || {}, *cmd, options)
|
53
|
+
status = $?
|
54
|
+
|
55
|
+
block.call(result, status)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.debug (argument, options={})
|
59
|
+
if !Packo.const_defined?(:System) || (!System.env[:DEBUG] && !options[:force])
|
60
|
+
return
|
61
|
+
end
|
62
|
+
|
63
|
+
if System.env[:DEBUG].to_i < (options[:level] || 1) && !options[:force]
|
64
|
+
return
|
65
|
+
end
|
66
|
+
|
67
|
+
output = "[#{Time.new}] From: #{caller[0, options[:deep] || 1].join("\n")}\n"
|
68
|
+
|
69
|
+
if argument.is_a?(Exception)
|
70
|
+
output << "#{argument.class}: #{argument.message}\n"
|
71
|
+
output << argument.backtrace.collect {|stack|
|
72
|
+
stack
|
73
|
+
}.join("\n")
|
74
|
+
output << "\n\n"
|
75
|
+
elsif argument.is_a?(String)
|
76
|
+
output << "#{argument}\n"
|
77
|
+
else
|
78
|
+
output << "#{argument.inspect}\n"
|
79
|
+
end
|
80
|
+
|
81
|
+
if options[:separator]
|
82
|
+
output << options[:separator]
|
83
|
+
end
|
84
|
+
|
85
|
+
puts output
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.load (path, options={})
|
89
|
+
if !File.readable? path
|
90
|
+
raise LoadError.new("no such file to load -- #{path}")
|
91
|
+
end
|
92
|
+
|
93
|
+
eval("#{options[:before]}#{File.read(path, encoding: 'utf-8').split(/^__END__$/).first}#{options[:after]}", options[:binding] || binding, path, 1)
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.loadPackage (path, package=nil)
|
97
|
+
options = {
|
98
|
+
before: 'module ::Packo::RBuild;',
|
99
|
+
after: ';end'
|
100
|
+
}
|
101
|
+
|
102
|
+
files = {}
|
103
|
+
|
104
|
+
if package
|
105
|
+
if File.exists?("#{path}/digest.xml") && (digest = Nokogiri::XML.parse(File.read("#{path}/digest.xml")))
|
106
|
+
features = digest.xpath("//build[@version = '#{package.version}'][@slot = '#{package.slot}']/features").first
|
107
|
+
|
108
|
+
if features
|
109
|
+
features.text.split(' ').each {|feature|
|
110
|
+
next if RBuild::Features::Default[feature.to_sym]
|
111
|
+
|
112
|
+
(package.environment || Environment.new).profiles.each {|profile|
|
113
|
+
begin
|
114
|
+
Packo.load "#{profile.features}/#{feature}", options
|
115
|
+
rescue LoadError
|
116
|
+
rescue Exception => e
|
117
|
+
CLI.warn "Something went wrong while loading #{feature} feature." if System.env[:VERBOSE]
|
118
|
+
Packo.debug e
|
119
|
+
end
|
120
|
+
}
|
121
|
+
}
|
122
|
+
end
|
123
|
+
|
124
|
+
# FIXME: maybe check slot too?
|
125
|
+
digest.xpath("//build[@version = '#{package.version}']/files/file").each {|file|
|
126
|
+
tmp = OpenStruct.new(
|
127
|
+
name: file['name'],
|
128
|
+
url: file['url'],
|
129
|
+
digest: file.text
|
130
|
+
)
|
131
|
+
|
132
|
+
files[file['name']] = tmp
|
133
|
+
files[file['url']] = tmp
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
begin
|
138
|
+
Packo.load "#{path}/#{package.name}.rbuild", options
|
139
|
+
|
140
|
+
if (pkg = RBuild::Package.last) && (tmp = File.read("#{path}/#{package.name}.rbuild").split(/^__END__$/)).length > 1
|
141
|
+
pkg.filesystem.parse(tmp.last.lstrip)
|
142
|
+
end
|
143
|
+
rescue Exception => e
|
144
|
+
Packo.debug e
|
145
|
+
end
|
146
|
+
|
147
|
+
Packo.load "#{path}/#{package.name}-#{package.version}.rbuild", options
|
148
|
+
|
149
|
+
if RBuild::Package.last.name == package.name && RBuild::Package.last.version == package.version
|
150
|
+
RBuild::Package.last.filesystem.merge!(pkg.filesystem)
|
151
|
+
|
152
|
+
if (tmp = File.read("#{path}/#{package.name}-#{package.version}.rbuild").split(/^__END__$/)).length > 1
|
153
|
+
RBuild::Package.last.filesystem.parse(tmp.last.lstrip)
|
154
|
+
end
|
155
|
+
|
156
|
+
if File.directory?("#{path}/data")
|
157
|
+
RBuild::Package.last.filesystem.load("#{path}/data")
|
158
|
+
end
|
159
|
+
|
160
|
+
RBuild::Package.last.digests = files
|
161
|
+
|
162
|
+
return RBuild::Package.last
|
163
|
+
end
|
164
|
+
else
|
165
|
+
begin
|
166
|
+
Packo.load path, options
|
167
|
+
|
168
|
+
if (pkg = RBuild::Package.last) && (tmp = File.read(path).split(/^__END__$/)).length > 1
|
169
|
+
pkg.filesystem.parse(tmp.last.lstrip)
|
170
|
+
end
|
171
|
+
rescue Exception => e
|
172
|
+
Packo.debug e
|
173
|
+
end
|
174
|
+
|
175
|
+
return RBuild::Package.last
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
require 'packo/version'
|
181
|
+
require 'packo/extensions'
|
182
|
+
require 'packo/system'
|
183
|
+
require 'packo/do'
|
184
|
+
require 'packo/cli'
|
185
|
+
require 'packo/repository'
|
186
|
+
require 'packo/package'
|