autoproj 1.7.12.rc2 → 1.7.12

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -3,6 +3,22 @@
3
3
  * fixed error if config.yml is empty
4
4
  * fixed issues with implicitly selecting ignored or excluded packages on the
5
5
  command line
6
+ * fixed handling of overrides that change the VCS type
7
+ If a package 'A' is normally under git and has an explicit branch, as e.g.
8
+
9
+ - test:
10
+ type: git
11
+ url: my/url.git
12
+ branch: master
13
+
14
+ Then an override of
15
+
16
+ - test:
17
+ type: archive
18
+ url: http://other/url.tar.bz2
19
+
20
+ would fail as the 'branch' git option was passed to the archive importer.
21
+ This is handled well now.
6
22
  * added metapackage support. One can now "group" packages under a certain name,
7
23
  said name being used in the manifest' layout, exclude_packgaes and/or
8
24
  ignore_packages.
data/Manifest.txt CHANGED
@@ -6,6 +6,8 @@ bin/amake
6
6
  bin/aup
7
7
  bin/autolocate
8
8
  bin/autoproj
9
+ bin/autoproj-locate
10
+ bin/autoproj-query
9
11
  bin/autoproj_bootstrap
10
12
  bin/autoproj_stress_test
11
13
  lib/autoproj.rb
@@ -17,6 +19,7 @@ lib/autoproj/gitorious.rb
17
19
  lib/autoproj/manifest.rb
18
20
  lib/autoproj/options.rb
19
21
  lib/autoproj/osdeps.rb
22
+ lib/autoproj/query.rb
20
23
  lib/autoproj/system.rb
21
24
  lib/autoproj/version.rb
22
25
  samples/autoproj/README.txt
@@ -0,0 +1,84 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'autoproj'
4
+ require 'autoproj/cmdline'
5
+
6
+ Autoproj.silent = true
7
+ root_dir = Autoproj::CmdLine.initialize_root_directory
8
+ selection = Autoproj::CmdLine.initialize_and_load(ARGV)
9
+ if selection.empty?
10
+ puts root_dir
11
+ exit 0
12
+ elsif selection.size > 1
13
+ STDERR.puts Autoproj.console.color("more than one name given on the command line", :red)
14
+ exit 1
15
+ end
16
+ selection = selection.first
17
+
18
+ selection_rx = Regexp.new(Regexp.quote(selection))
19
+ candidates = []
20
+ Autoproj.manifest.each_package do |pkg|
21
+ name = pkg.name
22
+ next if !Autoproj.manifest.package_enabled?(name)
23
+
24
+ srcdir = Autobuild::Package[name].srcdir
25
+ if name == selection
26
+ puts srcdir
27
+ exit(0)
28
+ elsif name =~ selection_rx
29
+ candidates << srcdir
30
+ end
31
+ end
32
+
33
+ if candidates.empty?
34
+ # Try harder. Match directory prefixes
35
+ directories = selection.split('/')
36
+ rx = directories.
37
+ map { |d| "#{Regexp.quote(d)}\\w*" }.
38
+ join("/")
39
+ rx = Regexp.new(rx)
40
+
41
+ rx_strict = directories[0..-2].
42
+ map { |d| "#{Regexp.quote(d)}\\w*" }.
43
+ join("/")
44
+ rx_strict = Regexp.new("#{rx_strict}/#{Regexp.quote(directories.last)}$")
45
+
46
+ candidates_strict = []
47
+ Autoproj.manifest.each_package do |pkg|
48
+ name = pkg.name
49
+ next if !Autoproj.manifest.package_enabled?(name)
50
+
51
+ srcdir = Autobuild::Package[name].srcdir
52
+ if name =~ rx
53
+ candidates << srcdir
54
+ end
55
+ if name =~ rx_strict
56
+ candidates_strict << srcdir
57
+ end
58
+ end
59
+
60
+ if candidates.size > 1 && candidates_strict.size == 1
61
+ candidates = candidates_strict
62
+ end
63
+ end
64
+
65
+ if candidates.size > 1
66
+ # If there is more than one candidate, check if there are some that are not
67
+ # present on disk
68
+ present = candidates.find_all { |dir| File.directory?(dir) }
69
+ if present.size == 1
70
+ candidates = present
71
+ end
72
+ end
73
+
74
+ if candidates.empty?
75
+ STDERR.puts Autoproj.console.color("cannot find #{selection} in the current autoproj installation", :bold, :red)
76
+ exit 1
77
+ elsif candidates.size > 1
78
+ STDERR.puts Autoproj.console.color("multiple packages match #{selection} in the current autoproj installation: #{candidates.join(", ")}", :bold, :red)
79
+ exit 1
80
+ else
81
+ puts candidates.first
82
+ exit(0)
83
+ end
84
+
@@ -0,0 +1,73 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'autoproj'
4
+ require 'autoproj/cmdline'
5
+
6
+ Autoproj.silent = true
7
+ display_all = false
8
+ display_format = "$NAME"
9
+ search_all = false
10
+
11
+ parser = OptionParser.new do |opt|
12
+ opt.banner = "autoproj query <query_string>
13
+ Finds packages that match query_string and displays information about them (one per line)
14
+ By default, only the package name is displayed. It can be customized with the --format option
15
+
16
+ FORMAT SPECIFICATION
17
+
18
+ The format is a string in which special values can be expanded using a $VARNAME format. The following variables are accepted:
19
+ NAME: the package name
20
+ SRCDIR: the full path to the package source directory
21
+ PREFIX: the full path to the package installation directory"
22
+
23
+ opt.on('--search-all', "search in all defined packages instead of only in those selected selected in the layout") do
24
+ search_all = true
25
+ end
26
+ opt.on('--format FORMAT', String, "customize what should be displayed. See FORMAT SPECIFICATION above") do |format|
27
+ display_format = format
28
+ end
29
+ end
30
+ remaining = parser.parse(ARGV)
31
+
32
+ root_dir = Autoproj::CmdLine.initialize_root_directory
33
+ selection = Autoproj::CmdLine.initialize_and_load(remaining)
34
+ if selection.empty?
35
+ STDERR.puts Autoproj.console.color("no query given on the command line", :red)
36
+ exit 1
37
+ elsif selection.size > 1
38
+ STDERR.puts Autoproj.console.color("more than one query given on the command line", :red)
39
+ exit 1
40
+ end
41
+ selection = selection.first
42
+ query = Autoproj::Query.parse_query(selection)
43
+
44
+ packages =
45
+ if search_all
46
+ Autoproj.manifest.packages.find_all do |name, pkg_def|
47
+ !Autoproj.manifest.package_selected?(name)
48
+ end
49
+ else
50
+ Autoproj.manifest.all_selected_packages.map do |pkg_name|
51
+ [pkg_name, Autoproj.manifest.packages[pkg_name]]
52
+ end
53
+ end
54
+
55
+ matches = packages.map do |name, pkg_def|
56
+ if priority = query.match(pkg_def)
57
+ [priority, name]
58
+ end
59
+ end.compact
60
+
61
+ fields = Hash.new
62
+ matches = matches.sort
63
+ matches.each do |priority, name|
64
+ pkg = Autobuild::Package[name]
65
+ fields['SRCDIR'] = pkg.srcdir
66
+ fields['PREFIX'] = pkg.prefix
67
+ fields['NAME'] = name
68
+ fields['PRIORITY'] = priority
69
+
70
+ value = Autoproj.expand(display_format, fields)
71
+ puts value
72
+ end
73
+
@@ -411,7 +411,6 @@ module Autoproj
411
411
  # dependencies that are provided by the operating system (.osdeps file).
412
412
  class PackageSet
413
413
  attr_reader :manifest
414
-
415
414
  # The VCSDefinition object that defines the version control holding
416
415
  # information for this source. Local package sets (i.e. the ones that are not
417
416
  # under version control) use the 'local' version control name. For them,
@@ -0,0 +1,124 @@
1
+ module Autoproj
2
+ class Query
3
+ ALLOWED_FIELDS = [
4
+ 'autobuild.name',
5
+ 'autobuild.srcdir',
6
+ 'autobuild.class.name',
7
+ 'vcs.type',
8
+ 'vcs.url',
9
+ 'package_set.name'
10
+ ]
11
+ DEFAULT_FIELDS = {
12
+ 'class' => 'autobuild.class.name',
13
+ 'autobuild' => 'autobuild.name',
14
+ 'vcs' => 'vcs.url',
15
+ 'package_set' => 'package_set.name'
16
+ }
17
+
18
+ # Match priorities
19
+ EXACT = 4
20
+ PARTIAL = 3
21
+ DIR_PREFIX_STRONG = 2
22
+ DIR_PREFIX_WEAK = 1
23
+
24
+ attr_reader :fields
25
+ attr_reader :value
26
+ attr_predicate :use_dir_prefix?
27
+
28
+ def initialize(fields, value)
29
+ @fields = fields
30
+ @value = value
31
+ @value_rx = Regexp.new(Regexp.quote(value), true)
32
+
33
+ directories = value.split('/')
34
+ if !directories.empty?
35
+ @use_dir_prefix = true
36
+ rx = directories.
37
+ map { |d| "#{Regexp.quote(d)}\\w*" }.
38
+ join("/")
39
+ rx = Regexp.new(rx, true)
40
+ @dir_prefix_weak_rx = rx
41
+
42
+ rx_strict = directories[0..-2].
43
+ map { |d| "#{Regexp.quote(d)}\\w*" }.
44
+ join("/")
45
+ rx_strict = Regexp.new("#{rx_strict}/#{Regexp.quote(directories.last)}$", true)
46
+ @dir_prefix_strong_rx = rx_strict
47
+ end
48
+ end
49
+
50
+ def match(pkg)
51
+ pkg_value = fields.inject(pkg) { |v, field_name| v.send(field_name) }
52
+ pkg_value = pkg_value.to_s
53
+
54
+ if pkg_value == value
55
+ return EXACT
56
+ elsif pkg_value =~ @value_rx
57
+ return PARTIAL
58
+ end
59
+
60
+ # Special match for directories: match directory prefixes
61
+ if use_dir_prefix?
62
+ if pkg_value =~ @dir_prefix_strong_rx
63
+ return DIR_PREFIX_STRONG
64
+ elsif pkg_value =~ @dir_prefix_weak_rx
65
+ return DIR_PREFIX_WEAK
66
+ end
67
+ end
68
+ end
69
+
70
+ def self.parse(str)
71
+ field, value = str.split('=')
72
+ if DEFAULT_FIELDS[field]
73
+ field = DEFAULT_FIELDS[field]
74
+ end
75
+
76
+ # Validate the query key
77
+ if !ALLOWED_FIELDS.include?(field)
78
+ raise ArgumentError, "#{field} is not a known query key"
79
+ end
80
+
81
+ fields = field.split('.')
82
+ new(fields, value)
83
+ end
84
+
85
+ def self.parse_query(query)
86
+ query = query.split(':')
87
+ query = query.map do |str|
88
+ if str !~ /=/
89
+ match_name = Query.parse("autobuild.name=#{str}")
90
+ match_dir = Query.parse("autobuild.srcdir=#{str}")
91
+ Or.new([match_name, match_dir])
92
+ else
93
+ Query.parse(str)
94
+ end
95
+ end
96
+ And.new(query)
97
+ end
98
+ end
99
+
100
+ class Or
101
+ def initialize(submatches)
102
+ @submatches = submatches
103
+ end
104
+ def match(pkg)
105
+ @submatches.map { |m| m.match(pkg) }.compact.max
106
+ end
107
+ end
108
+
109
+ class And
110
+ def initialize(submatches)
111
+ @submatches = submatches
112
+ end
113
+ def match(pkg)
114
+ matches = @submatches.map do |m|
115
+ if p = m.match(pkg)
116
+ p
117
+ else return
118
+ end
119
+ end
120
+ matches.min
121
+ end
122
+ end
123
+ end
124
+
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "1.7.12.rc2"
2
+ VERSION = "1.7.12"
3
3
  end
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoproj
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424033
5
- prerelease: 7
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
9
  - 12
10
- - rc
11
- - 2
12
- version: 1.7.12.rc2
10
+ version: 1.7.12
13
11
  platform: ruby
14
12
  authors:
15
13
  - Sylvain Joyeux
@@ -17,7 +15,7 @@ autorequire:
17
15
  bindir: bin
18
16
  cert_chain: []
19
17
 
20
- date: 2011-08-05 00:00:00 Z
18
+ date: 2011-08-08 00:00:00 Z
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
23
21
  name: autobuild
@@ -179,6 +177,8 @@ executables:
179
177
  - aup
180
178
  - autolocate
181
179
  - autoproj
180
+ - autoproj-locate
181
+ - autoproj-query
182
182
  - autoproj_bootstrap
183
183
  - autoproj_stress_test
184
184
  extensions: []
@@ -197,6 +197,8 @@ files:
197
197
  - bin/aup
198
198
  - bin/autolocate
199
199
  - bin/autoproj
200
+ - bin/autoproj-locate
201
+ - bin/autoproj-query
200
202
  - bin/autoproj_bootstrap
201
203
  - bin/autoproj_stress_test
202
204
  - lib/autoproj.rb
@@ -208,6 +210,7 @@ files:
208
210
  - lib/autoproj/manifest.rb
209
211
  - lib/autoproj/options.rb
210
212
  - lib/autoproj/osdeps.rb
213
+ - lib/autoproj/query.rb
211
214
  - lib/autoproj/system.rb
212
215
  - lib/autoproj/version.rb
213
216
  - samples/autoproj/README.txt
@@ -244,14 +247,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
247
  required_rubygems_version: !ruby/object:Gem::Requirement
245
248
  none: false
246
249
  requirements:
247
- - - ">"
250
+ - - ">="
248
251
  - !ruby/object:Gem::Version
249
- hash: 25
252
+ hash: 3
250
253
  segments:
251
- - 1
252
- - 3
253
- - 1
254
- version: 1.3.1
254
+ - 0
255
+ version: "0"
255
256
  requirements: []
256
257
 
257
258
  rubyforge_project: autobuild