autoproj 2.9.0 → 2.10.0
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +113 -0
- data/.travis.yml +0 -2
- data/Gemfile +1 -0
- data/README.md +59 -14
- data/bin/autoproj_bootstrap +21 -12
- data/bin/autoproj_bootstrap.in +2 -2
- data/bin/autoproj_install +21 -12
- data/bin/autoproj_install.in +2 -2
- data/lib/autoproj/aruba_minitest.rb +4 -4
- data/lib/autoproj/autobuild_extensions/dsl.rb +91 -70
- data/lib/autoproj/autobuild_extensions/package.rb +20 -1
- data/lib/autoproj/build_option.rb +24 -7
- data/lib/autoproj/cli/base.rb +12 -1
- data/lib/autoproj/cli/bootstrap.rb +9 -3
- data/lib/autoproj/cli/build.rb +17 -13
- data/lib/autoproj/cli/envsh.rb +1 -1
- data/lib/autoproj/cli/exec.rb +5 -7
- data/lib/autoproj/cli/main.rb +44 -9
- data/lib/autoproj/cli/main_test.rb +2 -0
- data/lib/autoproj/cli/test.rb +29 -6
- data/lib/autoproj/cli/version.rb +52 -0
- data/lib/autoproj/cli/versions.rb +4 -1
- data/lib/autoproj/cli/watch.rb +2 -1
- data/lib/autoproj/configuration.rb +49 -11
- data/lib/autoproj/default.osdeps +9 -0
- data/lib/autoproj/manifest.rb +6 -6
- data/lib/autoproj/ops/build.rb +5 -15
- data/lib/autoproj/ops/import.rb +22 -3
- data/lib/autoproj/ops/install.rb +19 -10
- data/lib/autoproj/ops/main_config_switcher.rb +12 -6
- data/lib/autoproj/ops/snapshot.rb +5 -1
- data/lib/autoproj/os_package_resolver.rb +245 -209
- data/lib/autoproj/package_selection.rb +18 -0
- data/lib/autoproj/reporter.rb +45 -31
- data/lib/autoproj/test.rb +107 -56
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +90 -72
- data/shell/completion/amake_bash +1 -0
- data/shell/completion/amake_zsh +1 -0
- data/shell/completion/autoproj_bash +2 -0
- data/shell/completion/autoproj_zsh +2 -0
- metadata +5 -3
    
        data/lib/autoproj/version.rb
    CHANGED
    
    
    
        data/lib/autoproj/workspace.rb
    CHANGED
    
    | @@ -54,11 +54,12 @@ class Workspace < Ops::Loader | |
| 54 54 | 
             
                    def initialize(root_dir,
         | 
| 55 55 | 
             
                                   os_package_resolver: OSPackageResolver.new,
         | 
| 56 56 | 
             
                                   package_managers: OSPackageInstaller::PACKAGE_MANAGERS,
         | 
| 57 | 
            -
                                   os_repository_resolver: OSRepositoryResolver.new( | 
| 57 | 
            +
                                   os_repository_resolver: OSRepositoryResolver.new(
         | 
| 58 | 
            +
                                        operating_system: os_package_resolver.operating_system),
         | 
| 58 59 | 
             
                                   os_repository_installer: OSRepositoryInstaller.new(self))
         | 
| 59 60 | 
             
                        @root_dir = root_dir
         | 
| 60 61 | 
             
                        @root_path = Pathname.new(root_dir)
         | 
| 61 | 
            -
                        @ruby_version_keyword = "ruby#{RUBY_VERSION.split('.')[0, 2].join( | 
| 62 | 
            +
                        @ruby_version_keyword = "ruby#{RUBY_VERSION.split('.')[0, 2].join('')}"
         | 
| 62 63 | 
             
                        @osdep_suffixes = Array.new
         | 
| 63 64 |  | 
| 64 65 | 
             
                        @loader = loader
         | 
| @@ -82,10 +83,8 @@ def initialize(root_dir, | |
| 82 83 | 
             
                    # @return [String,nil] the root path, or nil if one did not yet source
         | 
| 83 84 | 
             
                    #   the workspace's env.sh
         | 
| 84 85 | 
             
                    def self.autoproj_current_root
         | 
| 85 | 
            -
                        if env = ENV['AUTOPROJ_CURRENT_ROOT']
         | 
| 86 | 
            -
                             | 
| 87 | 
            -
                                env
         | 
| 88 | 
            -
                            end
         | 
| 86 | 
            +
                        if (env = ENV['AUTOPROJ_CURRENT_ROOT'])
         | 
| 87 | 
            +
                            env unless env.empty?
         | 
| 89 88 | 
             
                        end
         | 
| 90 89 | 
             
                    end
         | 
| 91 90 |  | 
| @@ -104,31 +103,35 @@ def self.from_pwd(**workspace_options) | |
| 104 103 | 
             
                    #   and the one from +dir+ mismatch
         | 
| 105 104 | 
             
                    # @raise [NotWorkspace] if dir is not within an autoproj workspace
         | 
| 106 105 | 
             
                    def self.from_dir(dir, **workspace_options)
         | 
| 107 | 
            -
                        if path = Autoproj.find_workspace_dir(dir)
         | 
| 106 | 
            +
                        if (path = Autoproj.find_workspace_dir(dir))
         | 
| 108 107 | 
             
                            Workspace.new(path, **workspace_options)
         | 
| 109 108 | 
             
                        elsif Autoproj.find_v1_workspace_dir(dir)
         | 
| 110 | 
            -
                            raise OutdatedWorkspace, "#{dir} looks like a v1 workspace,  | 
| 109 | 
            +
                            raise OutdatedWorkspace, "#{dir} looks like a v1 workspace, "\
         | 
| 110 | 
            +
                                "run autoproj upgrade before continuing"
         | 
| 111 111 | 
             
                        else
         | 
| 112 112 | 
             
                            raise NotWorkspace, "not in a Autoproj installation"
         | 
| 113 113 | 
             
                        end
         | 
| 114 114 | 
             
                    end
         | 
| 115 115 |  | 
| 116 116 | 
             
                    def self.from_environment(**workspace_options)
         | 
| 117 | 
            -
                        if path = Autoproj.find_workspace_dir
         | 
| 117 | 
            +
                        if (path = Autoproj.find_workspace_dir)
         | 
| 118 118 | 
             
                            from_dir(path, **workspace_options)
         | 
| 119 119 | 
             
                        elsif Autoproj.find_v1_workspace_dir(dir = Autoproj.default_find_base_dir)
         | 
| 120 | 
            -
                            raise OutdatedWorkspace, "#{dir} looks like a v1 workspace,  | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 120 | 
            +
                            raise OutdatedWorkspace, "#{dir} looks like a v1 workspace, "\
         | 
| 121 | 
            +
                                "run autoproj upgrade before continuing"
         | 
| 122 | 
            +
                        elsif (envvar = ENV['AUTOPROJ_CURRENT_ROOT'])
         | 
| 123 | 
            +
                            raise NotWorkspace, "AUTOPROJ_CURRENT_ROOT is currently set "\
         | 
| 124 | 
            +
                                "to #{envvar}, but that is not an Autoproj workspace"
         | 
| 123 125 | 
             
                        else
         | 
| 124 | 
            -
                            raise NotWorkspace, "not in an Autoproj installation,  | 
| 126 | 
            +
                            raise NotWorkspace, "not in an Autoproj installation, "\
         | 
| 127 | 
            +
                                "and no env.sh has been loaded so far"
         | 
| 125 128 | 
             
                        end
         | 
| 126 129 | 
             
                    end
         | 
| 127 130 |  | 
| 128 131 | 
             
                    # Tests whether the given path is under a directory tree managed by
         | 
| 129 132 | 
             
                    # autoproj
         | 
| 130 133 | 
             
                    def self.in_autoproj_project?(path)
         | 
| 131 | 
            -
                         | 
| 134 | 
            +
                        Autoproj.find_workspace_dir(path)
         | 
| 132 135 | 
             
                    end
         | 
| 133 136 |  | 
| 134 137 | 
             
                    # Returns the default workspace
         | 
| @@ -141,15 +144,19 @@ def self.in_autoproj_project?(path) | |
| 141 144 | 
             
                    # directory
         | 
| 142 145 | 
             
                    def self.default(**workspace_options)
         | 
| 143 146 | 
             
                        ws = from_environment(**workspace_options)
         | 
| 144 | 
            -
                         | 
| 145 | 
            -
             | 
| 147 | 
            +
                        from_pwd = Autoproj.find_workspace_dir(Dir.pwd)
         | 
| 148 | 
            +
                        if from_pwd && (from_pwd != ws.root_dir)
         | 
| 149 | 
            +
                            raise MismatchingWorkspace, "the current environment points to "\
         | 
| 150 | 
            +
                                "#{ws.root_dir}, but you are in #{from_pwd}, make sure you "\
         | 
| 151 | 
            +
                                "are loading the right #{ENV_FILENAME} script !"
         | 
| 146 152 | 
             
                        end
         | 
| 147 153 | 
             
                        ws
         | 
| 148 154 | 
             
                    end
         | 
| 149 155 |  | 
| 150 156 | 
             
                    def load(*args)
         | 
| 151 157 | 
             
                        set_as_main_workspace
         | 
| 152 | 
            -
                        flag | 
| 158 | 
            +
                        flag = Autoproj.warn_deprecated_level
         | 
| 159 | 
            +
                        Autoproj.warn_deprecated_level = 1
         | 
| 153 160 | 
             
                        super
         | 
| 154 161 | 
             
                    ensure
         | 
| 155 162 | 
             
                        Autoproj.warn_deprecated_level = flag
         | 
| @@ -227,7 +234,7 @@ def log_dir | |
| 227 234 | 
             
                        File.join(prefix_dir, 'log')
         | 
| 228 235 | 
             
                    end
         | 
| 229 236 |  | 
| 230 | 
            -
                    OVERRIDES_DIR = "overrides.d"
         | 
| 237 | 
            +
                    OVERRIDES_DIR = "overrides.d".freeze
         | 
| 231 238 |  | 
| 232 239 | 
             
                    # Returns the directory containing overrides files
         | 
| 233 240 | 
             
                    #
         | 
| @@ -236,24 +243,42 @@ def overrides_dir | |
| 236 243 | 
             
                        File.join(config_dir, OVERRIDES_DIR)
         | 
| 237 244 | 
             
                    end
         | 
| 238 245 |  | 
| 246 | 
            +
                    BUILD_REPORT_BASENAME = "build_report.json"
         | 
| 247 | 
            +
             | 
| 248 | 
            +
                    # The full path to the build report
         | 
| 249 | 
            +
                    #
         | 
| 250 | 
            +
                    # @return [String]
         | 
| 251 | 
            +
                    def build_report_path
         | 
| 252 | 
            +
                        File.join(log_dir, BUILD_REPORT_BASENAME)
         | 
| 253 | 
            +
                    end
         | 
| 254 | 
            +
             | 
| 255 | 
            +
                    # Load the configuration for this workspace from
         | 
| 256 | 
            +
                    # config_file_path
         | 
| 257 | 
            +
                    #
         | 
| 258 | 
            +
                    # @param [Boolean] reset Set to true to replace the configuration object,
         | 
| 259 | 
            +
                    #   set to false to load into the existing
         | 
| 260 | 
            +
                    # @return [Configuration] configuration object
         | 
| 239 261 | 
             
                    def load_config(reconfigure = false)
         | 
| 240 | 
            -
                        @config = Configuration.new(config_file_path)
         | 
| 241 262 | 
             
                        if File.file?(config_file_path)
         | 
| 242 | 
            -
                            config. | 
| 243 | 
            -
                             | 
| 244 | 
            -
             | 
| 245 | 
            -
             | 
| 246 | 
            -
             | 
| 247 | 
            -
             | 
| 248 | 
            -
             | 
| 263 | 
            +
                            config.reset
         | 
| 264 | 
            +
                            config.load(path: config_file_path, reconfigure: reconfigure)
         | 
| 265 | 
            +
                            manifest.vcs =
         | 
| 266 | 
            +
                                if (raw_vcs = config.get('manifest_source', nil))
         | 
| 267 | 
            +
                                    VCSDefinition.from_raw(raw_vcs)
         | 
| 268 | 
            +
                                else
         | 
| 269 | 
            +
                                    VCSDefinition.from_raw(type: 'local', url: config_dir)
         | 
| 270 | 
            +
                                end
         | 
| 249 271 |  | 
| 250 272 | 
             
                            if config.source_dir && Pathname.new(config.source_dir).absolute?
         | 
| 251 273 | 
             
                                raise ConfigError, 'source dir path configuration must be relative'
         | 
| 252 274 | 
             
                            end
         | 
| 253 275 |  | 
| 254 | 
            -
                            os_package_resolver.prefer_indep_over_os_packages = | 
| 255 | 
            -
             | 
| 256 | 
            -
                             | 
| 276 | 
            +
                            os_package_resolver.prefer_indep_over_os_packages =
         | 
| 277 | 
            +
                                config.prefer_indep_over_os_packages?
         | 
| 278 | 
            +
                            os_package_resolver.operating_system ||=
         | 
| 279 | 
            +
                                config.get('operating_system', nil)
         | 
| 280 | 
            +
                            os_repository_resolver.operating_system ||=
         | 
| 281 | 
            +
                                config.get('operating_system', nil)
         | 
| 257 282 | 
             
                        end
         | 
| 258 283 | 
             
                        @config
         | 
| 259 284 | 
             
                    end
         | 
| @@ -271,7 +296,8 @@ def autodetect_operating_system(force: false) | |
| 271 296 | 
             
                                os_package_resolver.operating_system = [names, versions]
         | 
| 272 297 | 
             
                                os_repository_resolver.operating_system = [names, versions]
         | 
| 273 298 | 
             
                                Autobuild.progress :operating_system_autodetection,
         | 
| 274 | 
            -
                                    "operating system: #{(names - ['default']).join( | 
| 299 | 
            +
                                    "operating system: #{(names - ['default']).join(',')} -"\
         | 
| 300 | 
            +
                                    " #{(versions - ['default']).join(',')}"
         | 
| 275 301 | 
             
                            ensure
         | 
| 276 302 | 
             
                                Autobuild.progress_done :operating_system_autodetection
         | 
| 277 303 | 
             
                            end
         | 
| @@ -289,9 +315,7 @@ def supported_operating_system? | |
| 289 315 |  | 
| 290 316 | 
             
                    def setup_os_package_installer
         | 
| 291 317 | 
             
                        autodetect_operating_system
         | 
| 292 | 
            -
                        os_package_installer.each_manager | 
| 293 | 
            -
                            pkg_mng.initialize_environment
         | 
| 294 | 
            -
                        end
         | 
| 318 | 
            +
                        os_package_installer.each_manager(&:initialize_environment)
         | 
| 295 319 | 
             
                        os_package_resolver.load_default
         | 
| 296 320 | 
             
                        os_package_installer.define_osdeps_mode_option
         | 
| 297 321 | 
             
                        os_package_installer.osdeps_mode
         | 
| @@ -318,9 +342,7 @@ def setup | |
| 318 342 | 
             
                        config.each_reused_autoproj_installation do |p|
         | 
| 319 343 | 
             
                            manifest.reuse(p)
         | 
| 320 344 | 
             
                        end
         | 
| 321 | 
            -
                        if File.exist?(manifest_file_path)
         | 
| 322 | 
            -
                            manifest.load(manifest_file_path)
         | 
| 323 | 
            -
                        end
         | 
| 345 | 
            +
                        manifest.load(manifest_file_path) if File.exist?(manifest_file_path)
         | 
| 324 346 |  | 
| 325 347 | 
             
                        Autobuild.prefix = prefix_dir
         | 
| 326 348 | 
             
                        FileUtils.mkdir_p File.join(prefix_dir, '.autoproj')
         | 
| @@ -330,7 +352,7 @@ def setup | |
| 330 352 |  | 
| 331 353 | 
             
                        Autobuild.srcdir = source_dir
         | 
| 332 354 | 
             
                        Autobuild.logdir = log_dir
         | 
| 333 | 
            -
                        if cache_dir = config.importer_cache_dir
         | 
| 355 | 
            +
                        if (cache_dir = config.importer_cache_dir)
         | 
| 334 356 | 
             
                            Autobuild::Importer.default_cache_dirs = cache_dir
         | 
| 335 357 | 
             
                        end
         | 
| 336 358 | 
             
                        setup_os_package_installer
         | 
| @@ -339,7 +361,7 @@ def setup | |
| 339 361 |  | 
| 340 362 | 
             
                    def install_ruby_shims
         | 
| 341 363 | 
             
                        install_suffix = ""
         | 
| 342 | 
            -
                        if match = /ruby(.*)$/.match(RbConfig::CONFIG['RUBY_INSTALL_NAME'])
         | 
| 364 | 
            +
                        if (match = /ruby(.*)$/.match(RbConfig::CONFIG['RUBY_INSTALL_NAME']))
         | 
| 343 365 | 
             
                            install_suffix = match[1]
         | 
| 344 366 | 
             
                        end
         | 
| 345 367 |  | 
| @@ -351,9 +373,9 @@ def install_ruby_shims | |
| 351 373 | 
             
                            io.puts "#! /bin/sh"
         | 
| 352 374 | 
             
                            io.puts "exec #{config.ruby_executable} \"$@\""
         | 
| 353 375 | 
             
                        end
         | 
| 354 | 
            -
                        FileUtils.chmod  | 
| 376 | 
            +
                        FileUtils.chmod 0o755, File.join(bindir, 'ruby')
         | 
| 355 377 |  | 
| 356 | 
            -
                        [ | 
| 378 | 
            +
                        %w[gem irb testrb].each do |name|
         | 
| 357 379 | 
             
                            # Look for the corresponding gem program
         | 
| 358 380 | 
             
                            prg_name = "#{name}#{install_suffix}"
         | 
| 359 381 | 
             
                            if File.file?(prg_path = File.join(RbConfig::CONFIG['bindir'], prg_name))
         | 
| @@ -361,7 +383,7 @@ def install_ruby_shims | |
| 361 383 | 
             
                                    io.puts "#! #{config.ruby_executable}"
         | 
| 362 384 | 
             
                                    io.puts "exec \"#{prg_path}\", *ARGV"
         | 
| 363 385 | 
             
                                end
         | 
| 364 | 
            -
                                FileUtils.chmod  | 
| 386 | 
            +
                                FileUtils.chmod 0o755, File.join(bindir, name)
         | 
| 365 387 | 
             
                            end
         | 
| 366 388 | 
             
                        end
         | 
| 367 389 | 
             
                    end
         | 
| @@ -386,9 +408,7 @@ def update_autoproj(restart_on_update: true) | |
| 386 408 |  | 
| 387 409 | 
             
                        # This is a guard to avoid infinite recursion in case the user is
         | 
| 388 410 | 
             
                        # running autoproj osdeps --force
         | 
| 389 | 
            -
                        if ENV['AUTOPROJ_RESTARTING'] == '1'
         | 
| 390 | 
            -
                            return
         | 
| 391 | 
            -
                        end
         | 
| 411 | 
            +
                        return if ENV['AUTOPROJ_RESTARTING'] == '1'
         | 
| 392 412 |  | 
| 393 413 | 
             
                        gemfile  = File.join(dot_autoproj_dir, 'Gemfile')
         | 
| 394 414 | 
             
                        binstubs = File.join(dot_autoproj_dir, 'bin')
         | 
| @@ -420,15 +440,16 @@ def update_autoproj(restart_on_update: true) | |
| 420 440 | 
             
                            config.save
         | 
| 421 441 | 
             
                            ENV['AUTOPROJ_RESTARTING'] = '1'
         | 
| 422 442 | 
             
                            require 'rbconfig'
         | 
| 423 | 
            -
                            exec(config.ruby_executable, $ | 
| 443 | 
            +
                            exec(config.ruby_executable, $PROGRAM_NAME, *ARGV)
         | 
| 424 444 | 
             
                        end
         | 
| 425 445 | 
             
                    end
         | 
| 426 446 |  | 
| 427 447 | 
             
                    def run(*args, &block)
         | 
| 428 | 
            -
                         | 
| 429 | 
            -
                             | 
| 430 | 
            -
             | 
| 431 | 
            -
             | 
| 448 | 
            +
                        options =
         | 
| 449 | 
            +
                            if args.last.kind_of?(Hash)
         | 
| 450 | 
            +
                                args.pop
         | 
| 451 | 
            +
                            else Hash.new
         | 
| 452 | 
            +
                            end
         | 
| 432 453 | 
             
                        options_env = options.fetch(:env, Hash.new)
         | 
| 433 454 | 
             
                        options[:env] = env.resolved_env.merge(options_env)
         | 
| 434 455 | 
             
                        Autobuild::Subprocess.run(*args, options, &block)
         | 
| @@ -438,7 +459,8 @@ def migrate_bundler_and_autoproj_gem_layout | |
| 438 459 | 
             
                        if !File.directory?(File.join(dot_autoproj_dir, 'autoproj'))
         | 
| 439 460 | 
             
                            return
         | 
| 440 461 | 
             
                        else
         | 
| 441 | 
            -
                             | 
| 462 | 
            +
                            config_path = File.join(dot_autoproj_dir, 'config.yml')
         | 
| 463 | 
            +
                            config = YAML.safe_load(File.read(config_path))
         | 
| 442 464 | 
             
                            return if config['gems_install_path']
         | 
| 443 465 | 
             
                        end
         | 
| 444 466 |  | 
| @@ -519,7 +541,7 @@ def self.find_user_cache_path(xdg_path, home_path = xdg_path) | |
| 519 541 | 
             
                    def self.registered_workspaces
         | 
| 520 542 | 
             
                        path = find_user_data_path('workspaces.yml')
         | 
| 521 543 | 
             
                        if File.file?(path)
         | 
| 522 | 
            -
                            yaml = (YAML. | 
| 544 | 
            +
                            yaml = (YAML.safe_load(File.read(path)) || [])
         | 
| 523 545 | 
             
                            fields = RegisteredWorkspace.members.map(&:to_s)
         | 
| 524 546 | 
             
                            yaml.map do |h|
         | 
| 525 547 | 
             
                                values = h.values_at(*fields)
         | 
| @@ -572,9 +594,7 @@ def load_package_sets(only_local: false, | |
| 572 594 | 
             
                                          mainline: nil,
         | 
| 573 595 | 
             
                                          reset: false,
         | 
| 574 596 | 
             
                                          retry_count: nil)
         | 
| 575 | 
            -
                         | 
| 576 | 
            -
                            return
         | 
| 577 | 
            -
                        end
         | 
| 597 | 
            +
                        return unless File.file?(manifest_file_path) # empty install, just return
         | 
| 578 598 |  | 
| 579 599 | 
             
                        Ops::Configuration.new(self).
         | 
| 580 600 | 
             
                            load_package_sets(only_local: only_local,
         | 
| @@ -585,7 +605,7 @@ def load_package_sets(only_local: false, | |
| 585 605 | 
             
                                              mainline: mainline)
         | 
| 586 606 | 
             
                    end
         | 
| 587 607 |  | 
| 588 | 
            -
                    def load_packages(selection = manifest.default_packages(false), options =  | 
| 608 | 
            +
                    def load_packages(selection = manifest.default_packages(false), options = {})
         | 
| 589 609 | 
             
                        options = Hash[warn_about_ignored_packages: true, checkout_only: true].
         | 
| 590 610 | 
             
                            merge(options)
         | 
| 591 611 | 
             
                        ops = Ops::Import.new(self)
         | 
| @@ -602,7 +622,7 @@ def setup_all_package_directories | |
| 602 622 | 
             
                        manifest.reused_installations.each do |imported_manifest|
         | 
| 603 623 | 
             
                            imported_manifest.each do |imported_pkg|
         | 
| 604 624 | 
             
                                imported_packages << imported_pkg.name
         | 
| 605 | 
            -
                                if pkg = manifest.find_package_definition(imported_pkg.name)
         | 
| 625 | 
            +
                                if (pkg = manifest.find_package_definition(imported_pkg.name))
         | 
| 606 626 | 
             
                                    pkg.autobuild.srcdir = imported_pkg.srcdir
         | 
| 607 627 | 
             
                                    pkg.autobuild.prefix = imported_pkg.prefix
         | 
| 608 628 | 
             
                                end
         | 
| @@ -612,6 +632,7 @@ def setup_all_package_directories | |
| 612 632 | 
             
                        manifest.each_package_definition do |pkg_def|
         | 
| 613 633 | 
             
                            pkg = pkg_def.autobuild
         | 
| 614 634 | 
             
                            next if imported_packages.include?(pkg_def.name)
         | 
| 635 | 
            +
             | 
| 615 636 | 
             
                            setup_package_directories(pkg)
         | 
| 616 637 | 
             
                        end
         | 
| 617 638 | 
             
                    end
         | 
| @@ -626,7 +647,7 @@ def setup_package_directories(pkg) | |
| 626 647 | 
             
                            end
         | 
| 627 648 |  | 
| 628 649 | 
             
                        srcdir =
         | 
| 629 | 
            -
                            if target = manifest.moved_packages[pkg_name]
         | 
| 650 | 
            +
                            if (target = manifest.moved_packages[pkg_name])
         | 
| 630 651 | 
             
                                File.join(layout, target)
         | 
| 631 652 | 
             
                            else
         | 
| 632 653 | 
             
                                File.join(layout, pkg_name)
         | 
| @@ -641,9 +662,7 @@ def setup_package_directories(pkg) | |
| 641 662 |  | 
| 642 663 | 
             
                        pkg = manifest.find_autobuild_package(pkg_name)
         | 
| 643 664 | 
             
                        pkg.srcdir = File.join(source_dir, srcdir)
         | 
| 644 | 
            -
                        if pkg.respond_to?(:builddir)
         | 
| 645 | 
            -
                            pkg.builddir = compute_builddir(pkg)
         | 
| 646 | 
            -
                        end
         | 
| 665 | 
            +
                        pkg.builddir = compute_builddir(pkg) if pkg.respond_to?(:builddir)
         | 
| 647 666 |  | 
| 648 667 | 
             
                        pkg.prefix = File.join(prefix_dir, prefixdir)
         | 
| 649 668 | 
             
                        pkg.doc_target_dir = File.join(prefix_dir, 'doc', pkg_name)
         | 
| @@ -682,7 +701,7 @@ def finalize_package_setup | |
| 682 701 | 
             
                        end
         | 
| 683 702 |  | 
| 684 703 | 
             
                        main_package_set = manifest.main_package_set
         | 
| 685 | 
            -
                        Dir.glob(File.join( | 
| 704 | 
            +
                        Dir.glob(File.join(overrides_dir, "*.rb")).sort.each do |file|
         | 
| 686 705 | 
             
                            load main_package_set, file
         | 
| 687 706 | 
             
                        end
         | 
| 688 707 | 
             
                    end
         | 
| @@ -693,9 +712,7 @@ def finalize_package_setup | |
| 693 712 | 
             
                    # have been properly set up (a.k.a. after package import)
         | 
| 694 713 | 
             
                    def finalize_setup
         | 
| 695 714 | 
             
                        # Finally, disable all ignored packages on the autobuild side
         | 
| 696 | 
            -
                        manifest.each_ignored_package | 
| 697 | 
            -
                            pkg.disable
         | 
| 698 | 
            -
                        end
         | 
| 715 | 
            +
                        manifest.each_ignored_package(&:disable)
         | 
| 699 716 |  | 
| 700 717 | 
             
                        # We now have processed the process setup blocks. All configuration
         | 
| 701 718 | 
             
                        # should be done and we can save the configuration data.
         | 
| @@ -719,6 +736,7 @@ def export_installation_manifest | |
| 719 736 | 
             
                        # Update the new entries
         | 
| 720 737 | 
             
                        manifest.each_package_set do |pkg_set|
         | 
| 721 738 | 
             
                            next if pkg_set.main?
         | 
| 739 | 
            +
             | 
| 722 740 | 
             
                            install_manifest.add_package_set(pkg_set)
         | 
| 723 741 | 
             
                        end
         | 
| 724 742 | 
             
                        selected_packages.each do |pkg_name|
         | 
| @@ -741,14 +759,14 @@ def full_env | |
| 741 759 | 
             
                    # Export the workspace's env.sh file
         | 
| 742 760 | 
             
                    #
         | 
| 743 761 | 
             
                    # @return [Boolean] true if the environment has been changed, false otherwise
         | 
| 744 | 
            -
                    def export_env_sh( | 
| 762 | 
            +
                    def export_env_sh(_package_names = nil, shell_helpers: true)
         | 
| 745 763 | 
             
                        full_env = self.full_env
         | 
| 746 764 | 
             
                        changed = save_cached_env(full_env)
         | 
| 747 765 | 
             
                        full_env.export_env_sh(shell_helpers: shell_helpers)
         | 
| 748 766 | 
             
                        changed
         | 
| 749 767 | 
             
                    end
         | 
| 750 768 |  | 
| 751 | 
            -
                    def save_cached_env(env =  | 
| 769 | 
            +
                    def save_cached_env(env = full_env)
         | 
| 752 770 | 
             
                        Ops.save_cached_env(root_dir, env)
         | 
| 753 771 | 
             
                    end
         | 
| 754 772 |  | 
| @@ -801,7 +819,8 @@ def install_os_repositories | |
| 801 819 | 
             
                    # @param [Proc,nil] block a setup block that should be called to
         | 
| 802 820 | 
             
                    #   configure the package
         | 
| 803 821 | 
             
                    # @return [PackageDefinition]
         | 
| 804 | 
            -
                    def define_package(package_type, package_name, block = nil, | 
| 822 | 
            +
                    def define_package(package_type, package_name, block = nil,
         | 
| 823 | 
            +
                                       package_set = manifest.main_package_set, file = nil)
         | 
| 805 824 | 
             
                        autobuild_package = Autobuild.send(package_type, package_name)
         | 
| 806 825 | 
             
                        register_package(autobuild_package, block, package_set, file)
         | 
| 807 826 | 
             
                    end
         | 
| @@ -816,7 +835,8 @@ def define_package(package_type, package_name, block = nil, package_set = manife | |
| 816 835 | 
             
                    # @param [Proc,nil] block a setup block that should be called to
         | 
| 817 836 | 
             
                    #   configure the package
         | 
| 818 837 | 
             
                    # @return [PackageDefinition]
         | 
| 819 | 
            -
                    def register_package(package, block = nil, | 
| 838 | 
            +
                    def register_package(package, block = nil,
         | 
| 839 | 
            +
                                         package_set = manifest.main_package_set, file = nil)
         | 
| 820 840 | 
             
                        pkg = manifest.register_package(package, block, package_set, file)
         | 
| 821 841 | 
             
                        pkg.autobuild.ws = self
         | 
| 822 842 | 
             
                        pkg
         | 
| @@ -834,7 +854,7 @@ def register_package(package, block = nil, package_set = manifest.main_package_s | |
| 834 854 | 
             
                    # @return [String] the resolved program
         | 
| 835 855 | 
             
                    # @raise [ExecutableNotFound] if an executable file named `cmd` cannot
         | 
| 836 856 | 
             
                    #   be found
         | 
| 837 | 
            -
                    def which(cmd,  | 
| 857 | 
            +
                    def which(cmd, _path_entries: nil)
         | 
| 838 858 | 
             
                        Ops.which(cmd, path_entries: -> { full_env.value('PATH') || Array.new })
         | 
| 839 859 | 
             
                    end
         | 
| 840 860 | 
             
                end
         | 
| @@ -845,9 +865,7 @@ def self.workspace | |
| 845 865 |  | 
| 846 866 | 
             
                def self.workspace=(ws)
         | 
| 847 867 | 
             
                    @workspace = ws
         | 
| 848 | 
            -
                     | 
| 849 | 
            -
                        self.root_dir = ws.root_dir
         | 
| 850 | 
            -
                    end
         | 
| 868 | 
            +
                    self.root_dir = ws&.root_dir
         | 
| 851 869 | 
             
                end
         | 
| 852 870 |  | 
| 853 871 | 
             
                def self.env
         | 
    
        data/shell/completion/amake_bash
    CHANGED
    
    
    
        data/shell/completion/amake_zsh
    CHANGED
    
    | @@ -20,6 +20,7 @@ __amake() { | |
| 20 20 | 
             
                {--auto-exclude,--no-auto-exclude}'[if true, packages that fail to import will be excluded from the build]' \
         | 
| 21 21 | 
             
                {--tool,--no-tool}'[act as a build tool, transparently passing the subcommand''s outputs to STDOUT]' \
         | 
| 22 22 | 
             
                {--confirm,--no-confirm}'[--force and --rebuild will ask confirmation if applied to the whole workspace. Use --no-confirm to disable this confirmation]' \
         | 
| 23 | 
            +
                --not'[do not build the packages listed]' \
         | 
| 23 24 | 
             
                '*:arg:_autoproj_installed_packages'
         | 
| 24 25 | 
             
            }
         | 
| 25 26 |  | 
| @@ -666,6 +666,7 @@ __autoproj_build() { | |
| 666 666 | 
             
                    --no-tool
         | 
| 667 667 | 
             
                    --confirm
         | 
| 668 668 | 
             
                    --no-confirm
         | 
| 669 | 
            +
                    --not
         | 
| 669 670 | 
             
                "
         | 
| 670 671 |  | 
| 671 672 | 
             
                case "$cur" in
         | 
| @@ -1061,6 +1062,7 @@ __autoproj_versions() { | |
| 1061 1062 | 
             
                    --local
         | 
| 1062 1063 | 
             
                    --no-local
         | 
| 1063 1064 | 
             
                    --save
         | 
| 1065 | 
            +
                    --fingerprint
         | 
| 1064 1066 | 
             
                "
         | 
| 1065 1067 |  | 
| 1066 1068 | 
             
                case "$cur" in
         | 
| @@ -471,6 +471,7 @@ __autoproj_build() { | |
| 471 471 | 
             
                {--auto-exclude,--no-auto-exclude}'[if true, packages that fail to import will be excluded from the build]' \
         | 
| 472 472 | 
             
                {--tool,--no-tool}'[act as a build tool, transparently passing the subcommand''s outputs to STDOUT]' \
         | 
| 473 473 | 
             
                {--confirm,--no-confirm}'[--force and --rebuild will ask confirmation if applied to the whole workspace. Use --no-confirm to disable this confirmation]' \
         | 
| 474 | 
            +
                --not'[do not build the packages listed]' \
         | 
| 474 475 | 
             
                '*:arg:_autoproj_installed_packages'
         | 
| 475 476 | 
             
            }
         | 
| 476 477 |  | 
| @@ -697,6 +698,7 @@ __autoproj_versions() { | |
| 697 698 | 
             
                {--deps,--no-deps}'[whether both packages and their dependencies should be versioned, or only the selected packages (the latter is the default)]' \
         | 
| 698 699 | 
             
                {--local,--no-local}'[whether we should access the remote server to verify that the snapshotted state is present]' \
         | 
| 699 700 | 
             
                --save'[save to the given file instead of displaying it on the standard output]' \
         | 
| 701 | 
            +
                --fingerprint'[calculate unique fingerprint for each package]' \
         | 
| 700 702 | 
             
                '*:arg:_autoproj_installed_packages'
         | 
| 701 703 | 
             
            }
         | 
| 702 704 |  |