diff --git a/check_releasepy.bash b/check_releasepy.bash index b9a06701e..2b2af0895 100755 --- a/check_releasepy.bash +++ b/check_releasepy.bash @@ -1,9 +1,22 @@ #!/bin/bash -e -test_dir=$(mktemp -d) -mkdir -p ${test_dir}/{focal,jammy,ubuntu}/debian -export _RELEASEPY_TEST_RELEASE_REPO=${test_dir} export _RELEASEPY_DEBUG=1 +test_dir=$(mktemp -d) +export _RELEASEPY_TEST_RELEASE_REPO="${test_dir}/test-release" +mkdir -p ${_RELEASEPY_TEST_RELEASE_REPO}/{focal,jammy,ubuntu}/debian +export _RELEASEPY_TEST_SOURCE_REPO="${test_dir}/src" +mkdir -p ${_RELEASEPY_TEST_SOURCE_REPO} +# Fake packages.xml to make the vendor package script happy +cat > "${_RELEASEPY_TEST_SOURCE_REPO}/package.xml" <<-EOF + + + gz-foo + 0.0.0 + test + Testing maintainer + Foo License + +EOF exec_releasepy_test() { @@ -167,4 +180,4 @@ ros_vendor_test=$(exec_releasepy_with_real_gz gz-fuel-tools 9) expect_vendor_repo "${ros_vendor_test}" gazebo-release/gz_fuel_tools_vendor ros_vendor_test=$(exec_releasepy_with_real_gz gz-cmake 2) -expect_no_vendor "${bump_linux_test}" +expect_no_vendor "${ros_vendor_test}" diff --git a/release.py b/release.py index ad9157d4a..84dc8b01b 100755 --- a/release.py +++ b/release.py @@ -162,8 +162,6 @@ def parse_args(argv): action='store_true', default=False, help='Only process the ROS vendor package (if any).') - - args = parser.parse_args() args.package_alias = args.package @@ -589,9 +587,16 @@ def prepare_vendor_pr_temp_workspace(package_name, ws_dir) -> Tuple[str, str, st def execute_update_vendor_package_tool(vendor_tool_path, vendor_repo_path, vendor_venv) -> None: + # The source repository when releasing matches the + src_repo = os.getcwd() + try: + src_repo = os.environ['_RELEASEPY_TEST_SOURCE_REPO'] + except KeyError: + pass + run_cmd = [os.path.join(vendor_venv, 'bin', 'python3'), f"{vendor_tool_path}/create_gz_vendor_pkg/create_vendor_package.py", - 'package.xml', + f"{os.path.join(src_repo, 'package.xml')}", '--output_dir', vendor_repo_path] _, _err_run = check_call(run_cmd, IGNORE_DRY_RUN) if _err_run: @@ -636,6 +641,9 @@ def create_pr_for_vendor_package(args, repo_path, base_branch) -> str: print(_err.decode()) sys.exit(1) + if DRY_RUN: + return ' (skipped the creation on --dry-run)' + return _out.decode()