From 6e6336f2a202ddfc2687d874f9b6d00dcd14f8f5 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 23 Oct 2024 14:24:04 -0300 Subject: [PATCH 1/2] chore: remove flavor-related sanity checks --- overrides.rb | 31 ------------------------------- rock/git_hook.rb | 21 --------------------- 2 files changed, 52 deletions(-) delete mode 100644 rock/git_hook.rb diff --git a/overrides.rb b/overrides.rb index 66556c7c..9f12e50f 100644 --- a/overrides.rb +++ b/overrides.rb @@ -1,41 +1,10 @@ Rock.flavors.finalize -wrong_branch = Rock.flavors.find_all_overriden_flavored_branches - -wrong_branch = wrong_branch.find_all { |pkg| pkg.importer.branch != 'rock-rc' } -if !wrong_branch.empty? - pkgs = wrong_branch.map { |pkg| "#{pkg.name}(#{pkg.importer.branch})" }.join(", ") - - Autoproj.warn "" - Autoproj.warn "the following packages are using a different branch than the current flavor" - Autoproj.warn "it is assumed that it is intentional" - Autoproj.warn " #{pkgs}" -end Autoproj.env_add_path 'ROCK_BUNDLE_PATH', File.join(Autobuild.prefix, 'share', 'rock') Autoproj.env_add_path 'ROCK_BUNDLE_PATH', File.join(Autoproj.root_dir, 'bundles') -require File.join(__dir__, 'rock', 'git_hook') require File.join(__dir__, 'rock', 'cmake_build_type') Autoproj.manifest.each_autobuild_package do |pkg| - case pkg.importer - when Autobuild::Git - if ENV['ROCK_DISABLE_CROSS_FLAVOR_CHECKS'] != '1' - # Finally, verify that when pkg A from flavor X depends on pkg B, - # then B needs to be available in flavor X as well - Rock.flavors.verify_cross_flavor_dependencies(pkg) - end - - # Do the git hook setup in a separate setup block since we must do it - # post-import - pkg.post_import do - if pkg.importer.branch == "next" || pkg.importer.branch == "stable" - Rock.install_git_hook pkg, 'git_do_not_commit_hook', 'pre-commit' - else - Rock.remove_git_hook pkg, 'pre-commit' - end - end - end - # NOTE: do not use a case/when to dispatch the package types. # Autobuild::Orogen is a subclass of Autobuild::CMake - and therefore needs # to get through both ifs. It's not the case with Autobuild::Ruby, but I diff --git a/rock/git_hook.rb b/rock/git_hook.rb deleted file mode 100644 index 605ffe48..00000000 --- a/rock/git_hook.rb +++ /dev/null @@ -1,21 +0,0 @@ -module Rock - def self.install_git_hook(pkg, source_file, target_hook) - if !File.directory?(pkg.srcdir) - raise ArgumentError, "cannot install the git hooks for a non-checked out package" - end - - hook_source_path = File.join( - File.expand_path(File.dirname(__FILE__)), - source_file) - hook_dest_path = File.join(pkg.srcdir, '.git', 'hooks', target_hook) - FileUtils.mkdir_p File.dirname(hook_dest_path) - FileUtils.cp hook_source_path, hook_dest_path - end - def self.remove_git_hook(pkg, target_hook) - if !File.directory?(pkg.srcdir) - raise ArgumentError, "cannot remove the git hooks for a non-checked out package" - end - hook_dest_path = File.join(pkg.srcdir, '.git', 'hooks', target_hook) - FileUtils.rm_f hook_dest_path - end -end From 8dbdaf92309af1796af4451b9011a788ef15385d Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Tue, 12 Nov 2024 13:58:10 +0100 Subject: [PATCH 2/2] chore: Also remove no longer referenced git hook script --- rock/git_do_not_commit_hook | 8 -------- 1 file changed, 8 deletions(-) delete mode 100755 rock/git_do_not_commit_hook diff --git a/rock/git_do_not_commit_hook b/rock/git_do_not_commit_hook deleted file mode 100755 index 4d3fb074..00000000 --- a/rock/git_do_not_commit_hook +++ /dev/null @@ -1,8 +0,0 @@ -branch=`git symbolic-ref HEAD` - -if test "x$ROCK_UPDATE_NEXT" != "x1" && (test "$branch" = "refs/heads/next" || test "$branch" = "refs/heads/stable"); then - echo "You are currently on the next or stable branch of this package. Committing is forbidden" - echo "You should switch to either master or a custom branch first" - echo "If you mean to update next and/or stable, set the ROCK_UPDATE_NEXT environment variable to 1" - exit 1 -fi