autoproj 1.7.3 → 1.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +42 -15
- data/Manifest.txt +1 -0
- data/Rakefile +1 -1
- data/bin/amake +9 -0
- data/bin/autoproj +2 -1
- data/bin/autoproj_bootstrap +70 -34
- data/lib/autoproj/autobuild.rb +53 -4
- data/lib/autoproj/cmdline.rb +70 -35
- data/lib/autoproj/manifest.rb +18 -6
- data/lib/autoproj/osdeps.rb +70 -34
- data/lib/autoproj/version.rb +1 -1
- metadata +9 -7
data/History.txt
CHANGED
@@ -1,27 +1,54 @@
|
|
1
|
+
= Version 1.7.4
|
2
|
+
* add amake to the gem (forgot it in 1.7.3)
|
3
|
+
* fix some corner-cases in osdeps handling
|
4
|
+
* fix autoproj build <builddir> when <builddir> is
|
5
|
+
not the root of a package
|
6
|
+
* make autoproj build <builddir> (and amake <builddir>)
|
7
|
+
auto-add the package if it is not registered in
|
8
|
+
the current build configuration
|
9
|
+
* the --no-deps option allows to do operations without
|
10
|
+
taking the dependencies into account (for instance,
|
11
|
+
update or build a single package)
|
12
|
+
* allow version specifications for gems in the osdeps
|
13
|
+
files, e.g.
|
14
|
+
|
15
|
+
hoe:
|
16
|
+
gem: "hoe < 1.9.0"
|
17
|
+
|
18
|
+
* add the required_autoproj_version field in source.yml
|
19
|
+
to require a specific autoproj version
|
20
|
+
|
1
21
|
= Version 1.7.3
|
2
22
|
== For basic usage
|
3
|
-
* amake is a command that is a shortcut to "autoproj
|
4
|
-
|
5
|
-
|
6
|
-
* added tag support. The manifest and the autobuild
|
7
|
-
tags to packages, that
|
8
|
-
|
9
|
-
|
10
|
-
|
23
|
+
* amake is a command that is a shortcut to "autoproj
|
24
|
+
build". I.e. amake . will build the package in the
|
25
|
+
current directory and all its dependencies
|
26
|
+
* added tag support. The manifest and the autobuild
|
27
|
+
files allow to add textual tags to packages, that
|
28
|
+
will be picked up by documentation later on.
|
29
|
+
Moreover, some tags can be used to tune the build.
|
30
|
+
For instance, rock uses the 'stable' tag to set the
|
31
|
+
CMAKE_BUILD_TYPE variable on cmake packages to
|
32
|
+
either Debug (non-stable) or RelWithDebInfo
|
33
|
+
(stable).
|
11
34
|
|
12
35
|
== For advanced usage
|
13
36
|
* support ignoring/excluding OS packages
|
14
|
-
* define Package#post_import which allows to run a
|
15
|
-
has been imported, but
|
37
|
+
* define Package#post_import which allows to run a
|
38
|
+
code block after the package has been imported, but
|
39
|
+
before the build. The global
|
16
40
|
Autoproj.post_import do |pkg|
|
17
41
|
end
|
18
42
|
allows to do it for all defined packages.
|
19
|
-
* define Package#remove_obsolete_installed_file(*path)
|
20
|
-
files from the installation
|
43
|
+
* define Package#remove_obsolete_installed_file(*path)
|
44
|
+
which allows to remove files from the installation
|
45
|
+
directory. Useful for simple upgrade cases, when
|
21
46
|
files move from one package to another
|
22
|
-
* in source.yml, a package name is interpreted as a
|
23
|
-
|
24
|
-
|
47
|
+
* in source.yml, a package name is interpreted as a
|
48
|
+
regular expression only if it contains
|
49
|
+
non-alphanumeric characters. This avoids some
|
50
|
+
surprising effects if the name of package BlaBla is
|
51
|
+
a subset of the package BlaBlaBlo
|
25
52
|
|
26
53
|
= Version 1.7.2
|
27
54
|
== Quickfix release
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
data/bin/amake
ADDED
data/bin/autoproj
CHANGED
@@ -103,6 +103,7 @@ EOTEXT
|
|
103
103
|
Autobuild.do_update = Autoproj.auto_update?
|
104
104
|
end
|
105
105
|
|
106
|
+
Autoproj::CmdLine.setup_all_package_directories
|
106
107
|
resolved_selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages)
|
107
108
|
if !selected_packages.empty?
|
108
109
|
command_line_selection = resolved_selected_packages.dup
|
@@ -111,7 +112,7 @@ EOTEXT
|
|
111
112
|
end
|
112
113
|
Autoproj.manifest.explicit_selection = resolved_selected_packages
|
113
114
|
selected_packages = resolved_selected_packages
|
114
|
-
Autoproj::CmdLine.
|
115
|
+
Autoproj::CmdLine.finalize_package_setup
|
115
116
|
|
116
117
|
# If in verbose mode, or if we only update sources, list the sources
|
117
118
|
if Autoproj.verbose || Autoproj::CmdLine.display_configuration?
|
data/bin/autoproj_bootstrap
CHANGED
@@ -259,9 +259,12 @@ module Autoproj
|
|
259
259
|
return @operating_system
|
260
260
|
elsif Autoproj.has_config_key?('operating_system')
|
261
261
|
os = Autoproj.user_config('operating_system')
|
262
|
-
|
263
|
-
|
264
|
-
|
262
|
+
if os.respond_to?(:to_ary)
|
263
|
+
if os[0].respond_to?(:to_ary) && os[0].all? { |s| s.respond_to?(:to_str) } &&
|
264
|
+
os[1].respond_to?(:to_ary) && os[1].all? { |s| s.respond_to?(:to_str) }
|
265
|
+
@operating_system = os
|
266
|
+
return os
|
267
|
+
end
|
265
268
|
end
|
266
269
|
end
|
267
270
|
|
@@ -283,9 +286,9 @@ module Autoproj
|
|
283
286
|
if File.exists?('/etc/debian_version')
|
284
287
|
codenames = [File.read('/etc/debian_version').strip]
|
285
288
|
if codenames.first =~ /sid/
|
286
|
-
codenames
|
289
|
+
versions = codenames + ["unstable", "sid"]
|
287
290
|
end
|
288
|
-
[['debian'],
|
291
|
+
[['debian'], versions]
|
289
292
|
elsif File.exists?('/etc/gentoo-release')
|
290
293
|
release_string = File.read('/etc/gentoo-release').strip
|
291
294
|
release_string =~ /^.*([^\s]+)$/
|
@@ -301,9 +304,14 @@ module Autoproj
|
|
301
304
|
end
|
302
305
|
|
303
306
|
# Normalize the names to lowercase
|
304
|
-
@operating_system
|
305
|
-
|
306
|
-
|
307
|
+
names, versions = @operating_system[0], @operating_system[1]
|
308
|
+
names = names.map(&:downcase)
|
309
|
+
versions = versions.map(&:downcase)
|
310
|
+
if !versions.include?('default')
|
311
|
+
versions += ['default']
|
312
|
+
end
|
313
|
+
|
314
|
+
@operating_system = [names, versions]
|
307
315
|
Autoproj.change_option('operating_system', @operating_system, true)
|
308
316
|
@operating_system
|
309
317
|
end
|
@@ -409,7 +417,7 @@ fi
|
|
409
417
|
# Find a matching entry for the OS name
|
410
418
|
os_entry = nil
|
411
419
|
os_names.find do |os_name|
|
412
|
-
os_entry = dep_def.find do |name_list,
|
420
|
+
os_entry = dep_def.find do |name_list, _|
|
413
421
|
name_list.split(',').
|
414
422
|
map(&:downcase).
|
415
423
|
any? { |n| n == os_name }
|
@@ -426,18 +434,14 @@ fi
|
|
426
434
|
return IGNORE
|
427
435
|
end
|
428
436
|
|
437
|
+
# If data is a hash, it means we have to check the OS version as well
|
429
438
|
if data.kind_of?(Hash)
|
430
|
-
version_entry =
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
map(&:downcase).
|
436
|
-
any? do |v|
|
437
|
-
os_version.any? { |osv| Regexp.new(v) =~ osv }
|
438
|
-
end
|
439
|
+
version_entry = data.find do |version_list, _|
|
440
|
+
version_list.to_s.split(',').
|
441
|
+
map(&:downcase).
|
442
|
+
any? do |v|
|
443
|
+
os_versions.any? { |osv| Regexp.new(v) =~ osv }
|
439
444
|
end
|
440
|
-
break if version_entry
|
441
445
|
end
|
442
446
|
|
443
447
|
if !version_entry
|
@@ -447,8 +451,10 @@ fi
|
|
447
451
|
end
|
448
452
|
|
449
453
|
if data.respond_to?(:to_ary)
|
454
|
+
# List of packages
|
450
455
|
return [PACKAGES, data]
|
451
456
|
elsif data.respond_to?(:to_str)
|
457
|
+
# Single package
|
452
458
|
return [PACKAGES, [data.to_str]]
|
453
459
|
else
|
454
460
|
raise ConfigError.new, "invalid package specificiation #{data} in #{source_of(name)}"
|
@@ -522,8 +528,10 @@ fi
|
|
522
528
|
else
|
523
529
|
status
|
524
530
|
end
|
525
|
-
|
531
|
+
elsif !gemdeps.empty?
|
526
532
|
AVAILABLE
|
533
|
+
else
|
534
|
+
NO_PACKAGE
|
527
535
|
end
|
528
536
|
end
|
529
537
|
|
@@ -535,7 +543,17 @@ fi
|
|
535
543
|
# package manager, and the set of packages that have to be installed
|
536
544
|
# using Ruby's package manager, RubyGems.
|
537
545
|
#
|
538
|
-
#
|
546
|
+
# The os_packages arrays is a list of names (strings)
|
547
|
+
#
|
548
|
+
# The gem_packages arrays is a list of [name, version] pairs. +version+
|
549
|
+
# is a version string, that is set only if the package has been given
|
550
|
+
# with a =VERSION specification, e.g.
|
551
|
+
#
|
552
|
+
# gems:
|
553
|
+
# hoe=1.8.0
|
554
|
+
#
|
555
|
+
# Raises ConfigError if an error exists in the osdeps files, and returns
|
556
|
+
# empty sets if the package can't be found
|
539
557
|
def partition_packages(package_set, package_osdeps = Hash.new)
|
540
558
|
package_set = package_set.
|
541
559
|
map { |name| OSDependencies.aliases[name] || name }.
|
@@ -576,6 +594,13 @@ fi
|
|
576
594
|
end
|
577
595
|
end
|
578
596
|
end
|
597
|
+
gems.map! do |name|
|
598
|
+
if name =~ /^([^><=~]*)([><=~]+.*)$/
|
599
|
+
[$1.strip, $2.strip]
|
600
|
+
else
|
601
|
+
[name]
|
602
|
+
end
|
603
|
+
end
|
579
604
|
return osdeps, gems
|
580
605
|
end
|
581
606
|
|
@@ -616,10 +641,10 @@ fi
|
|
616
641
|
def filter_uptodate_gems(gems)
|
617
642
|
# Don't install gems that are already there ...
|
618
643
|
gems = gems.dup
|
619
|
-
gems.delete_if do |name|
|
620
|
-
version_requirements = Gem::Requirement.
|
644
|
+
gems.delete_if do |name, version|
|
645
|
+
version_requirements = Gem::Requirement.new(version || '>= 0')
|
621
646
|
installed = Gem.source_index.find_name(name, version_requirements)
|
622
|
-
if !installed.empty? && Autobuild.do_update
|
647
|
+
if (!installed.empty? && !version) && Autobuild.do_update
|
623
648
|
# Look if we can update the package ...
|
624
649
|
dep = Gem::Dependency.new(name, version_requirements)
|
625
650
|
available = gem_fetcher.find_matching(dep, false, true, OSDependencies.gem_with_prerelease)
|
@@ -675,7 +700,7 @@ to what you should install to compile the software successfully.
|
|
675
700
|
|
676
701
|
Autoproj.configuration_option 'osdeps_mode', 'string',
|
677
702
|
:default => 'ruby',
|
678
|
-
:doc =>
|
703
|
+
:doc => message,
|
679
704
|
:possible_values => %w{ruby none},
|
680
705
|
:lowercase => true
|
681
706
|
end
|
@@ -848,7 +873,7 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
848
873
|
false
|
849
874
|
end
|
850
875
|
|
851
|
-
def gems_interaction(gems,
|
876
|
+
def gems_interaction(gems, cmdlines, silent)
|
852
877
|
if OSDependencies.force_osdeps
|
853
878
|
return true
|
854
879
|
elsif osdeps_mode == HANDLE_ALL || osdeps_mode == HANDLE_RUBY
|
@@ -869,7 +894,7 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
869
894
|
|
870
895
|
The following command line can be used to install them manually
|
871
896
|
|
872
|
-
#{
|
897
|
+
#{cmdlines.map { |c| c.join(" ") }.join("\n ")}
|
873
898
|
|
874
899
|
Autoproj expects these Gems to be installed in #{Autoproj.gem_home} This can
|
875
900
|
be overriden by setting the AUTOPROJ_GEM_HOME environment variable manually
|
@@ -892,7 +917,7 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
892
917
|
|
893
918
|
osdeps, gems = partition_packages(packages, package_osdeps)
|
894
919
|
if handled_os
|
895
|
-
os_names,
|
920
|
+
os_names, _ = OSDependencies.operating_system
|
896
921
|
os_packages = resolve_os_dependencies(osdeps)
|
897
922
|
if filter_uptodate_packages
|
898
923
|
os_packages = filter_uptodate_os_packages(os_packages, os_names)
|
@@ -932,15 +957,26 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
932
957
|
if !gems.empty?
|
933
958
|
guess_gem_program
|
934
959
|
|
935
|
-
|
960
|
+
base_cmdline = [Autobuild.tool('gem'), 'install']
|
936
961
|
if Autoproj::OSDependencies.gem_with_prerelease
|
937
|
-
|
962
|
+
base_cmdline << "--prerelease"
|
963
|
+
end
|
964
|
+
with_version, without_version = gems.partition { |name, v| v }
|
965
|
+
|
966
|
+
cmdlines = []
|
967
|
+
if !without_version.empty?
|
968
|
+
cmdlines << (base_cmdline + without_version.flatten)
|
969
|
+
end
|
970
|
+
with_version.each do |name, v|
|
971
|
+
cmdlines << base_cmdline + [name, "-v", v]
|
938
972
|
end
|
939
|
-
cmdline.concat(gems)
|
940
973
|
|
941
|
-
if gems_interaction(gems,
|
942
|
-
Autobuild.progress "installing/updating RubyGems dependencies: #{gems.sort.join(", ")}"
|
943
|
-
|
974
|
+
if gems_interaction(gems, cmdlines, silent?)
|
975
|
+
Autobuild.progress "installing/updating RubyGems dependencies: #{gems.map { |g| g.join(" ") }.sort.join(", ")}"
|
976
|
+
|
977
|
+
cmdlines.each do |c|
|
978
|
+
Autobuild::Subprocess.run 'autoproj', 'osdeps', *c
|
979
|
+
end
|
944
980
|
did_something = true
|
945
981
|
end
|
946
982
|
end
|
data/lib/autoproj/autobuild.rb
CHANGED
@@ -55,10 +55,27 @@ module Autobuild
|
|
55
55
|
tags.include?(tag.to_s)
|
56
56
|
end
|
57
57
|
|
58
|
+
# Asks autoproj to remove references to the given obsolete oroGen
|
59
|
+
# package
|
60
|
+
def remove_obsolete_installed_orogen_package(name)
|
61
|
+
post_install do
|
62
|
+
path = File.join(prefix, 'lib', 'pkgconfig')
|
63
|
+
Dir.glob(File.join(path, "#{name}-*.pc")) do |pcfile|
|
64
|
+
Autoproj.progress " removing obsolete file #{pcfile}", :bold
|
65
|
+
FileUtils.rm_f pcfile
|
66
|
+
end
|
67
|
+
pcfile = File.join(path, "orogen-project-#{name}.pc")
|
68
|
+
if File.exists?(pcfile)
|
69
|
+
Autoproj.progress " removing obsolete file #{pcfile}", :bold
|
70
|
+
FileUtils.rm_f pcfile
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
58
75
|
# Asks autoproj to remove the given file in the package's installation
|
59
76
|
# prefix
|
60
77
|
def remove_obsolete_installed_file(*path)
|
61
|
-
|
78
|
+
post_install do
|
62
79
|
path = File.join(prefix, *path)
|
63
80
|
if File.exists?(path)
|
64
81
|
Autoproj.progress " removing obsolete file #{path}", :bold
|
@@ -79,6 +96,10 @@ module Autobuild
|
|
79
96
|
|
80
97
|
alias __depends_on__ depends_on
|
81
98
|
def depends_on(name)
|
99
|
+
if Autoproj::CmdLine.ignore_dependencies?
|
100
|
+
return
|
101
|
+
end
|
102
|
+
|
82
103
|
explicit_selection = Autoproj.manifest.explicitly_selected_package?(name)
|
83
104
|
osdeps_availability = Autoproj.osdeps.availability_of(name)
|
84
105
|
available_as_source = Autobuild::Package[name]
|
@@ -120,6 +141,10 @@ module Autobuild
|
|
120
141
|
end
|
121
142
|
|
122
143
|
def optional_dependency(name)
|
144
|
+
if Autoproj::CmdLine.ignore_dependencies?
|
145
|
+
return
|
146
|
+
end
|
147
|
+
|
123
148
|
optional_dependencies << name
|
124
149
|
end
|
125
150
|
|
@@ -450,6 +475,30 @@ def orogen_package(options, &block)
|
|
450
475
|
end
|
451
476
|
end
|
452
477
|
|
478
|
+
# Declare that the packages declared in the block should be built only on the
|
479
|
+
# given operating system. OS descriptions are space-separated strings containing
|
480
|
+
# OS name and version.
|
481
|
+
#
|
482
|
+
# The block will simply be ignored if run on another architecture
|
483
|
+
def only_on(*architectures)
|
484
|
+
architectures = architectures.map do |name|
|
485
|
+
if name.respond_to?(:to_str)
|
486
|
+
[name]
|
487
|
+
else name
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
os_names, os_versions = Autoproj::OSDependencies.operating_system
|
492
|
+
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
493
|
+
if matching_archs.empty?
|
494
|
+
return
|
495
|
+
elsif matching_archs.none? { |arch| !arch[1] || os_versions.include?(arch[1].downcase) }
|
496
|
+
return
|
497
|
+
end
|
498
|
+
|
499
|
+
yield
|
500
|
+
end
|
501
|
+
|
453
502
|
# Declare that the packages declared in the block should not be built in the
|
454
503
|
# given operating system. OS descriptions are space-separated strings containing
|
455
504
|
# OS name and version.
|
@@ -464,11 +513,11 @@ def not_on(*architectures)
|
|
464
513
|
end
|
465
514
|
end
|
466
515
|
|
467
|
-
|
468
|
-
matching_archs = architectures.find_all { |arch| arch[0]
|
516
|
+
os_names, os_versions = Autoproj::OSDependencies.operating_system
|
517
|
+
matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }
|
469
518
|
if matching_archs.empty?
|
470
519
|
return yield
|
471
|
-
elsif matching_archs.all? { |arch| arch[1] && !
|
520
|
+
elsif matching_archs.all? { |arch| arch[1] && !os_versions.include?(arch[1].downcase) }
|
472
521
|
return yield
|
473
522
|
end
|
474
523
|
|
data/lib/autoproj/cmdline.rb
CHANGED
@@ -148,6 +148,12 @@ module Autoproj
|
|
148
148
|
manifest = Autoproj.manifest
|
149
149
|
manifest.cache_package_sets
|
150
150
|
|
151
|
+
manifest.each_package_set(false) do |pkg_set|
|
152
|
+
if Gem::Version.new(pkg_set.required_autoproj_version) > Gem::Version.new(Autoproj::VERSION)
|
153
|
+
raise ConfigError.new(pkg_set.source_file), "the #{pkg_set.name} package set requires autoproj v#{pkg_set.required_autoproj_version} but this is v#{Autoproj::VERSION}"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
151
157
|
# Load init.rb files. each_source must not load the source.yml file, as
|
152
158
|
# init.rb may define configuration options that are used there
|
153
159
|
manifest.each_source(false) do |source|
|
@@ -238,7 +244,31 @@ module Autoproj
|
|
238
244
|
end
|
239
245
|
end
|
240
246
|
|
241
|
-
def self.
|
247
|
+
def self.setup_package_directories(pkg)
|
248
|
+
pkg_name = pkg.name
|
249
|
+
|
250
|
+
layout =
|
251
|
+
if randomize_layout?
|
252
|
+
Digest::SHA256.hexdigest(pkg_name)[0, 12]
|
253
|
+
else manifest.whereis(pkg_name)
|
254
|
+
end
|
255
|
+
|
256
|
+
place =
|
257
|
+
if target = manifest.moved_packages[pkg_name]
|
258
|
+
File.join(layout, target)
|
259
|
+
else
|
260
|
+
File.join(layout, pkg_name)
|
261
|
+
end
|
262
|
+
|
263
|
+
pkg = Autobuild::Package[pkg_name]
|
264
|
+
pkg.srcdir = File.join(Autoproj.root_dir, place)
|
265
|
+
pkg.prefix = File.join(Autoproj.build_dir, layout)
|
266
|
+
pkg.doc_target_dir = File.join(Autoproj.build_dir, 'doc', pkg_name)
|
267
|
+
pkg.logdir = File.join(pkg.prefix, "log")
|
268
|
+
end
|
269
|
+
|
270
|
+
|
271
|
+
def self.setup_all_package_directories
|
242
272
|
manifest = Autoproj.manifest
|
243
273
|
|
244
274
|
# Now starts a different stage of the whole build. Until now, we were
|
@@ -249,28 +279,11 @@ module Autoproj
|
|
249
279
|
# resolve those
|
250
280
|
manifest.packages.each_value do |pkg_def|
|
251
281
|
pkg = pkg_def.autobuild
|
252
|
-
|
253
|
-
|
254
|
-
layout =
|
255
|
-
if randomize_layout?
|
256
|
-
Digest::SHA256.hexdigest(pkg_name)[0, 12]
|
257
|
-
else manifest.whereis(pkg_name)
|
258
|
-
end
|
259
|
-
|
260
|
-
place =
|
261
|
-
if target = manifest.moved_packages[pkg_name]
|
262
|
-
File.join(layout, target)
|
263
|
-
else
|
264
|
-
File.join(layout, pkg_name)
|
265
|
-
end
|
266
|
-
|
267
|
-
pkg = Autobuild::Package[pkg_name]
|
268
|
-
pkg.srcdir = File.join(Autoproj.root_dir, place)
|
269
|
-
pkg.prefix = File.join(Autoproj.build_dir, layout)
|
270
|
-
pkg.doc_target_dir = File.join(Autoproj.build_dir, 'doc', pkg_name)
|
271
|
-
pkg.logdir = File.join(pkg.prefix, "log")
|
282
|
+
setup_package_directories(pkg)
|
272
283
|
end
|
284
|
+
end
|
273
285
|
|
286
|
+
def self.finalize_package_setup
|
274
287
|
# Now call the blocks that the user defined in the autobuild files. We do it
|
275
288
|
# now so that the various package directories are properly setup
|
276
289
|
manifest.packages.each_value do |pkg|
|
@@ -436,9 +449,29 @@ module Autoproj
|
|
436
449
|
end
|
437
450
|
selected_packages = selected_packages.to_set
|
438
451
|
|
439
|
-
selected_packages = manifest.expand_package_selection(selected_packages)
|
440
|
-
|
441
|
-
|
452
|
+
selected_packages, nonresolved = manifest.expand_package_selection(selected_packages)
|
453
|
+
|
454
|
+
# Try to auto-add stuff in nonresolved
|
455
|
+
nonresolved.delete_if do |sel|
|
456
|
+
next if !File.directory?(sel)
|
457
|
+
while sel != '/'
|
458
|
+
if handler = Autoproj.package_handler_for(sel)
|
459
|
+
Autoproj.progress " auto-adding #{sel} using the #{handler.gsub(/_package/, '')} package handler"
|
460
|
+
relative_to_root = Pathname.new(sel).relative_path_from(Pathname.new(Autoproj.root_dir))
|
461
|
+
pkg = Autoproj.in_package_set(manifest.local_package_set, manifest.file) do
|
462
|
+
send(handler, relative_to_root)
|
463
|
+
end
|
464
|
+
setup_package_directories(pkg)
|
465
|
+
selected_packages << pkg.name
|
466
|
+
break(true)
|
467
|
+
end
|
468
|
+
|
469
|
+
sel = File.dirname(sel)
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
if !nonresolved.empty?
|
474
|
+
Autoproj.progress("autoproj: wrong package selection on command line, cannot find a match for #{nonresolved.to_a.join(", ")}", :red)
|
442
475
|
exit 1
|
443
476
|
elsif Autoproj.verbose
|
444
477
|
Autoproj.progress "will install #{selected_packages.to_a.join(", ")}"
|
@@ -664,6 +697,7 @@ module Autoproj
|
|
664
697
|
def self.reconfigure?; @mode == "reconfigure" end
|
665
698
|
|
666
699
|
def self.show_statistics?; !!@show_statistics end
|
700
|
+
def self.ignore_dependencies?; @ignore_dependencies end
|
667
701
|
|
668
702
|
def self.osdeps?; @mode == "osdeps" end
|
669
703
|
def self.show_osdeps?; @mode == "osdeps" && @show_osdeps end
|
@@ -772,15 +806,12 @@ where 'mode' is one of:
|
|
772
806
|
Autobuild.ignore_errors = true
|
773
807
|
end
|
774
808
|
opts.on("--os-version", "displays the operating system as detected by autoproj") do
|
775
|
-
|
776
|
-
if !
|
809
|
+
os_names, os_versions = OSDependencies.operating_system
|
810
|
+
if !os_names
|
777
811
|
puts "no information about that OS"
|
778
812
|
else
|
779
|
-
puts "name: #{
|
780
|
-
puts "version:"
|
781
|
-
os[1].each do |version_name|
|
782
|
-
puts " #{version_name}"
|
783
|
-
end
|
813
|
+
puts "name(s): #{os_names.join(", ")}"
|
814
|
+
puts "version(s): #{os_versions.join(", ")}"
|
784
815
|
end
|
785
816
|
exit 0
|
786
817
|
end
|
@@ -794,6 +825,9 @@ where 'mode' is one of:
|
|
794
825
|
opts.on("--list-newest", "for each source directory, list what is the newest file used by autoproj for dependency tracking") do
|
795
826
|
Autoproj::CmdLine.list_newest = true
|
796
827
|
end
|
828
|
+
opts.on('-n', '--no-deps', 'completely ignore dependencies') do |value|
|
829
|
+
@ignore_dependencies = true
|
830
|
+
end
|
797
831
|
opts.on("--no-osdeps", "in build and update modes, disable osdeps handling") do |value|
|
798
832
|
@osdeps_forced_mode = 'none'
|
799
833
|
end
|
@@ -1455,9 +1489,9 @@ export PATH=$GEM_HOME/bin:$PATH
|
|
1455
1489
|
partition_packages([pkg_osdep], ospkg_to_pkg)
|
1456
1490
|
|
1457
1491
|
gems.each do |gem_name|
|
1458
|
-
mapping[gem_name][1] = true
|
1459
|
-
mapping[gem_name][2][pkg_osdep] = Autoproj.osdeps.source_of(pkg_osdep)
|
1460
|
-
mapping[gem_name][3] |= pkgs
|
1492
|
+
mapping[gem_name.join(" ")][1] = true
|
1493
|
+
mapping[gem_name.join(" ")][2][pkg_osdep] = Autoproj.osdeps.source_of(pkg_osdep)
|
1494
|
+
mapping[gem_name.join(" ")][3] |= pkgs
|
1461
1495
|
end
|
1462
1496
|
|
1463
1497
|
if Autoproj::OSDependencies.supported_operating_system?
|
@@ -1556,7 +1590,8 @@ export PATH=$GEM_HOME/bin:$PATH
|
|
1556
1590
|
Autoproj::CmdLine.update_os_dependencies = false
|
1557
1591
|
Autoproj::CmdLine.initialize
|
1558
1592
|
Autoproj::CmdLine.load_configuration
|
1559
|
-
Autoproj::CmdLine.
|
1593
|
+
Autoproj::CmdLine.setup_all_package_directories
|
1594
|
+
Autoproj::CmdLine.finalize_package_setup
|
1560
1595
|
|
1561
1596
|
# Load the manifest for packages that are already present on the
|
1562
1597
|
# file system
|
data/lib/autoproj/manifest.rb
CHANGED
@@ -396,6 +396,11 @@ module Autoproj
|
|
396
396
|
end
|
397
397
|
end
|
398
398
|
|
399
|
+
def required_autoproj_version
|
400
|
+
definition = @source_definition || raw_description_file
|
401
|
+
definition['required_autoproj_version'] || '0'
|
402
|
+
end
|
403
|
+
|
399
404
|
# Returns the source name
|
400
405
|
def name
|
401
406
|
if @name
|
@@ -1505,6 +1510,9 @@ module Autoproj
|
|
1505
1510
|
# All the packages that are available on this installation
|
1506
1511
|
all_layout_packages = self.all_selected_packages
|
1507
1512
|
|
1513
|
+
# A selection to packages map that represents the matches found
|
1514
|
+
matches = Hash.new { |h, k| h[k] = Set.new }
|
1515
|
+
|
1508
1516
|
# First, remove packages that are directly referenced by name or by
|
1509
1517
|
# package set names
|
1510
1518
|
selection.each do |sel|
|
@@ -1513,15 +1521,16 @@ module Autoproj
|
|
1513
1521
|
packages = all_layout_packages.
|
1514
1522
|
find_all { |pkg_name| pkg_name =~ sel }.
|
1515
1523
|
to_set
|
1524
|
+
matches[sel] = packages
|
1516
1525
|
expanded_packages |= packages
|
1517
1526
|
|
1518
1527
|
sources = each_source.find_all { |source| source.name =~ sel }
|
1519
1528
|
sources.each do |source|
|
1520
1529
|
packages = resolve_package_set(source.name).to_set
|
1521
|
-
|
1530
|
+
source_packages = (packages & all_layout_packages)
|
1531
|
+
matches[sel] |= source_packages
|
1532
|
+
expanded_packages |= source_packages
|
1522
1533
|
end
|
1523
|
-
|
1524
|
-
!packages.empty? || !sources.empty?
|
1525
1534
|
end
|
1526
1535
|
|
1527
1536
|
# Finally, check for package source directories
|
@@ -1533,10 +1542,13 @@ module Autoproj
|
|
1533
1542
|
if pkg_name =~ match_pkg_name || sel =~ Regexp.new("^#{Regexp.quote(pkg.srcdir)}") || pkg.srcdir =~ Regexp.new("^#{Regexp.quote(sel)}")
|
1534
1543
|
# Check-out packages that are not in the manifest only
|
1535
1544
|
# if they are explicitely selected
|
1536
|
-
if
|
1537
|
-
|
1545
|
+
if !all_layout_packages.include?(pkg.name)
|
1546
|
+
if !File.directory?(pkg.srcdir) && pkg_name != sel && pkg.srcdir != sel
|
1547
|
+
next
|
1548
|
+
end
|
1538
1549
|
end
|
1539
1550
|
|
1551
|
+
matches[sel] << pkg_name
|
1540
1552
|
expanded_packages << pkg_name
|
1541
1553
|
end
|
1542
1554
|
end
|
@@ -1544,7 +1556,7 @@ module Autoproj
|
|
1544
1556
|
|
1545
1557
|
# Remove packages that are explicitely excluded and/or ignored
|
1546
1558
|
expanded_packages.delete_if { |pkg_name| excluded?(pkg_name) || ignored?(pkg_name) }
|
1547
|
-
expanded_packages.to_set
|
1559
|
+
return expanded_packages.to_set, (selection - matches.keys)
|
1548
1560
|
end
|
1549
1561
|
|
1550
1562
|
attr_reader :moved_packages
|
data/lib/autoproj/osdeps.rb
CHANGED
@@ -160,9 +160,12 @@ module Autoproj
|
|
160
160
|
return @operating_system
|
161
161
|
elsif Autoproj.has_config_key?('operating_system')
|
162
162
|
os = Autoproj.user_config('operating_system')
|
163
|
-
|
164
|
-
|
165
|
-
|
163
|
+
if os.respond_to?(:to_ary)
|
164
|
+
if os[0].respond_to?(:to_ary) && os[0].all? { |s| s.respond_to?(:to_str) } &&
|
165
|
+
os[1].respond_to?(:to_ary) && os[1].all? { |s| s.respond_to?(:to_str) }
|
166
|
+
@operating_system = os
|
167
|
+
return os
|
168
|
+
end
|
166
169
|
end
|
167
170
|
end
|
168
171
|
|
@@ -184,9 +187,9 @@ module Autoproj
|
|
184
187
|
if File.exists?('/etc/debian_version')
|
185
188
|
codenames = [File.read('/etc/debian_version').strip]
|
186
189
|
if codenames.first =~ /sid/
|
187
|
-
codenames
|
190
|
+
versions = codenames + ["unstable", "sid"]
|
188
191
|
end
|
189
|
-
[['debian'],
|
192
|
+
[['debian'], versions]
|
190
193
|
elsif File.exists?('/etc/gentoo-release')
|
191
194
|
release_string = File.read('/etc/gentoo-release').strip
|
192
195
|
release_string =~ /^.*([^\s]+)$/
|
@@ -202,9 +205,14 @@ module Autoproj
|
|
202
205
|
end
|
203
206
|
|
204
207
|
# Normalize the names to lowercase
|
205
|
-
@operating_system
|
206
|
-
|
207
|
-
|
208
|
+
names, versions = @operating_system[0], @operating_system[1]
|
209
|
+
names = names.map(&:downcase)
|
210
|
+
versions = versions.map(&:downcase)
|
211
|
+
if !versions.include?('default')
|
212
|
+
versions += ['default']
|
213
|
+
end
|
214
|
+
|
215
|
+
@operating_system = [names, versions]
|
208
216
|
Autoproj.change_option('operating_system', @operating_system, true)
|
209
217
|
@operating_system
|
210
218
|
end
|
@@ -310,7 +318,7 @@ fi
|
|
310
318
|
# Find a matching entry for the OS name
|
311
319
|
os_entry = nil
|
312
320
|
os_names.find do |os_name|
|
313
|
-
os_entry = dep_def.find do |name_list,
|
321
|
+
os_entry = dep_def.find do |name_list, _|
|
314
322
|
name_list.split(',').
|
315
323
|
map(&:downcase).
|
316
324
|
any? { |n| n == os_name }
|
@@ -327,18 +335,14 @@ fi
|
|
327
335
|
return IGNORE
|
328
336
|
end
|
329
337
|
|
338
|
+
# If data is a hash, it means we have to check the OS version as well
|
330
339
|
if data.kind_of?(Hash)
|
331
|
-
version_entry =
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
map(&:downcase).
|
337
|
-
any? do |v|
|
338
|
-
os_version.any? { |osv| Regexp.new(v) =~ osv }
|
339
|
-
end
|
340
|
+
version_entry = data.find do |version_list, _|
|
341
|
+
version_list.to_s.split(',').
|
342
|
+
map(&:downcase).
|
343
|
+
any? do |v|
|
344
|
+
os_versions.any? { |osv| Regexp.new(v) =~ osv }
|
340
345
|
end
|
341
|
-
break if version_entry
|
342
346
|
end
|
343
347
|
|
344
348
|
if !version_entry
|
@@ -348,8 +352,10 @@ fi
|
|
348
352
|
end
|
349
353
|
|
350
354
|
if data.respond_to?(:to_ary)
|
355
|
+
# List of packages
|
351
356
|
return [PACKAGES, data]
|
352
357
|
elsif data.respond_to?(:to_str)
|
358
|
+
# Single package
|
353
359
|
return [PACKAGES, [data.to_str]]
|
354
360
|
else
|
355
361
|
raise ConfigError.new, "invalid package specificiation #{data} in #{source_of(name)}"
|
@@ -423,8 +429,10 @@ fi
|
|
423
429
|
else
|
424
430
|
status
|
425
431
|
end
|
426
|
-
|
432
|
+
elsif !gemdeps.empty?
|
427
433
|
AVAILABLE
|
434
|
+
else
|
435
|
+
NO_PACKAGE
|
428
436
|
end
|
429
437
|
end
|
430
438
|
|
@@ -436,7 +444,17 @@ fi
|
|
436
444
|
# package manager, and the set of packages that have to be installed
|
437
445
|
# using Ruby's package manager, RubyGems.
|
438
446
|
#
|
439
|
-
#
|
447
|
+
# The os_packages arrays is a list of names (strings)
|
448
|
+
#
|
449
|
+
# The gem_packages arrays is a list of [name, version] pairs. +version+
|
450
|
+
# is a version string, that is set only if the package has been given
|
451
|
+
# with a =VERSION specification, e.g.
|
452
|
+
#
|
453
|
+
# gems:
|
454
|
+
# hoe=1.8.0
|
455
|
+
#
|
456
|
+
# Raises ConfigError if an error exists in the osdeps files, and returns
|
457
|
+
# empty sets if the package can't be found
|
440
458
|
def partition_packages(package_set, package_osdeps = Hash.new)
|
441
459
|
package_set = package_set.
|
442
460
|
map { |name| OSDependencies.aliases[name] || name }.
|
@@ -477,6 +495,13 @@ fi
|
|
477
495
|
end
|
478
496
|
end
|
479
497
|
end
|
498
|
+
gems.map! do |name|
|
499
|
+
if name =~ /^([^><=~]*)([><=~]+.*)$/
|
500
|
+
[$1.strip, $2.strip]
|
501
|
+
else
|
502
|
+
[name]
|
503
|
+
end
|
504
|
+
end
|
480
505
|
return osdeps, gems
|
481
506
|
end
|
482
507
|
|
@@ -517,10 +542,10 @@ fi
|
|
517
542
|
def filter_uptodate_gems(gems)
|
518
543
|
# Don't install gems that are already there ...
|
519
544
|
gems = gems.dup
|
520
|
-
gems.delete_if do |name|
|
521
|
-
version_requirements = Gem::Requirement.
|
545
|
+
gems.delete_if do |name, version|
|
546
|
+
version_requirements = Gem::Requirement.new(version || '>= 0')
|
522
547
|
installed = Gem.source_index.find_name(name, version_requirements)
|
523
|
-
if !installed.empty? && Autobuild.do_update
|
548
|
+
if (!installed.empty? && !version) && Autobuild.do_update
|
524
549
|
# Look if we can update the package ...
|
525
550
|
dep = Gem::Dependency.new(name, version_requirements)
|
526
551
|
available = gem_fetcher.find_matching(dep, false, true, OSDependencies.gem_with_prerelease)
|
@@ -576,7 +601,7 @@ to what you should install to compile the software successfully.
|
|
576
601
|
|
577
602
|
Autoproj.configuration_option 'osdeps_mode', 'string',
|
578
603
|
:default => 'ruby',
|
579
|
-
:doc =>
|
604
|
+
:doc => message,
|
580
605
|
:possible_values => %w{ruby none},
|
581
606
|
:lowercase => true
|
582
607
|
end
|
@@ -749,7 +774,7 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
749
774
|
false
|
750
775
|
end
|
751
776
|
|
752
|
-
def gems_interaction(gems,
|
777
|
+
def gems_interaction(gems, cmdlines, silent)
|
753
778
|
if OSDependencies.force_osdeps
|
754
779
|
return true
|
755
780
|
elsif osdeps_mode == HANDLE_ALL || osdeps_mode == HANDLE_RUBY
|
@@ -770,7 +795,7 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
770
795
|
|
771
796
|
The following command line can be used to install them manually
|
772
797
|
|
773
|
-
#{
|
798
|
+
#{cmdlines.map { |c| c.join(" ") }.join("\n ")}
|
774
799
|
|
775
800
|
Autoproj expects these Gems to be installed in #{Autoproj.gem_home} This can
|
776
801
|
be overriden by setting the AUTOPROJ_GEM_HOME environment variable manually
|
@@ -793,7 +818,7 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
793
818
|
|
794
819
|
osdeps, gems = partition_packages(packages, package_osdeps)
|
795
820
|
if handled_os
|
796
|
-
os_names,
|
821
|
+
os_names, _ = OSDependencies.operating_system
|
797
822
|
os_packages = resolve_os_dependencies(osdeps)
|
798
823
|
if filter_uptodate_packages
|
799
824
|
os_packages = filter_uptodate_os_packages(os_packages, os_names)
|
@@ -833,15 +858,26 @@ with the corresponding option (--all, --ruby, --os or --none).
|
|
833
858
|
if !gems.empty?
|
834
859
|
guess_gem_program
|
835
860
|
|
836
|
-
|
861
|
+
base_cmdline = [Autobuild.tool('gem'), 'install']
|
837
862
|
if Autoproj::OSDependencies.gem_with_prerelease
|
838
|
-
|
863
|
+
base_cmdline << "--prerelease"
|
864
|
+
end
|
865
|
+
with_version, without_version = gems.partition { |name, v| v }
|
866
|
+
|
867
|
+
cmdlines = []
|
868
|
+
if !without_version.empty?
|
869
|
+
cmdlines << (base_cmdline + without_version.flatten)
|
870
|
+
end
|
871
|
+
with_version.each do |name, v|
|
872
|
+
cmdlines << base_cmdline + [name, "-v", v]
|
839
873
|
end
|
840
|
-
cmdline.concat(gems)
|
841
874
|
|
842
|
-
if gems_interaction(gems,
|
843
|
-
Autobuild.progress "installing/updating RubyGems dependencies: #{gems.sort.join(", ")}"
|
844
|
-
|
875
|
+
if gems_interaction(gems, cmdlines, silent?)
|
876
|
+
Autobuild.progress "installing/updating RubyGems dependencies: #{gems.map { |g| g.join(" ") }.sort.join(", ")}"
|
877
|
+
|
878
|
+
cmdlines.each do |c|
|
879
|
+
Autobuild::Subprocess.run 'autoproj', 'osdeps', *c
|
880
|
+
end
|
845
881
|
did_something = true
|
846
882
|
end
|
847
883
|
end
|
data/lib/autoproj/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 1.7.
|
9
|
+
- 4
|
10
|
+
version: 1.7.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sylvain Joyeux
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01
|
18
|
+
date: 2011-02-01 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 65
|
30
30
|
segments:
|
31
31
|
- 1
|
32
32
|
- 5
|
33
|
-
-
|
34
|
-
version: 1.5.
|
33
|
+
- 33
|
34
|
+
version: 1.5.33
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -174,6 +174,7 @@ description: |-
|
|
174
174
|
email:
|
175
175
|
- sylvain.joyeux@dfki.de
|
176
176
|
executables:
|
177
|
+
- amake
|
177
178
|
- autolocate
|
178
179
|
- autoproj
|
179
180
|
- autoproj_bootstrap
|
@@ -190,6 +191,7 @@ files:
|
|
190
191
|
- Manifest.txt
|
191
192
|
- README.txt
|
192
193
|
- Rakefile
|
194
|
+
- bin/amake
|
193
195
|
- bin/autolocate
|
194
196
|
- bin/autoproj
|
195
197
|
- bin/autoproj_bootstrap
|