From 3b095c64a65c03da78d756ba64632386af1fd10a Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Mon, 6 Nov 2023 19:53:06 -0800 Subject: [PATCH 1/7] doc: Fixup external manual references (#777) The original links for the RPM manual that were being referred to appear to have moved. This update the links to point at the correct place. --- pkg/rpm_pfg.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/rpm_pfg.bzl b/pkg/rpm_pfg.bzl index 3240c8a1..b62fb1cb 100644 --- a/pkg/rpm_pfg.bzl +++ b/pkg/rpm_pfg.bzl @@ -913,7 +913,7 @@ pkg_rpm = rule( Corresponds to the "Conflicts" preamble tag. - See also: https://rpm.org/user_doc/dependencies.html + See also: https://rpm-software-management.github.io/rpm/manual/dependencies.html """, ), "provides": attr.string_list( @@ -921,7 +921,7 @@ pkg_rpm = rule( Corresponds to the "Provides" preamble tag. - See also: https://rpm.org/user_doc/dependencies.html + See also: https://rpm-software-management.github.io/rpm/manual/dependencies.html """, ), "requires": attr.string_list( @@ -929,7 +929,7 @@ pkg_rpm = rule( Corresponds to the "Requires" preamble tag. - See also: https://rpm.org/user_doc/dependencies.html + See also: https://rpm-software-management.github.io/rpm/manual/dependencies.html """, ), "requires_contextual": attr.string_list_dict( @@ -964,7 +964,7 @@ pkg_rpm = rule( For capabilities that are always required by packages at runtime, use the `requires` attribute instead. - See also: https://rpm.org/user_doc/more_dependencies.html + See also: https://rpm-software-management.github.io/rpm/manual/more_dependencies.html NOTE: `pkg_rpm` does not check if the keys of this dictionary are acceptable to `rpm(8)`. From e97d155ebeb20da6c6d4282d923a1d15416bcc16 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Tue, 7 Nov 2023 17:28:30 +0100 Subject: [PATCH 2/7] Don't load cc toolchain from rules_cc (#779) * Don't load cc toolchain from rules_cc The cc toolchain autoconfig is out of sync from Bazel and doesn't work with VS2022. Related: https://github.com/bazelbuild/continuous-integration/pull/1770 * Fixes centos7 --- .bazelci/examples_naming.yml | 2 +- .bazelci/examples_rich_structure.yml | 2 +- .bazelci/examples_stamping.yml | 2 +- .bazelci/tests.yml | 2 +- .bcr/presubmit.yml | 2 +- WORKSPACE | 4 +--- examples/rich_structure/WORKSPACE | 4 +--- 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.bazelci/examples_naming.yml b/.bazelci/examples_naming.yml index 7ec83f16..0f55f60b 100644 --- a/.bazelci/examples_naming.yml +++ b/.bazelci/examples_naming.yml @@ -5,7 +5,7 @@ common: &common tasks: centos7: - platform: centos7 + platform: centos7_java11_devtoolset10 <<: *common ubuntu1804: platform: ubuntu1804 diff --git a/.bazelci/examples_rich_structure.yml b/.bazelci/examples_rich_structure.yml index adbfce12..e6f2d178 100644 --- a/.bazelci/examples_rich_structure.yml +++ b/.bazelci/examples_rich_structure.yml @@ -5,7 +5,7 @@ common: &common tasks: centos7: - platform: centos7 + platform: centos7_java11_devtoolset10 <<: *common ubuntu1804: platform: ubuntu1804 diff --git a/.bazelci/examples_stamping.yml b/.bazelci/examples_stamping.yml index 59e1d9ca..0eebfaa2 100644 --- a/.bazelci/examples_stamping.yml +++ b/.bazelci/examples_stamping.yml @@ -5,7 +5,7 @@ common: &common tasks: centos7: - platform: centos7 + platform: centos7_java11_devtoolset10 <<: *common ubuntu1804: platform: ubuntu1804 diff --git a/.bazelci/tests.yml b/.bazelci/tests.yml index 90536d54..3fc01113 100644 --- a/.bazelci/tests.yml +++ b/.bazelci/tests.yml @@ -67,7 +67,7 @@ ubuntu1804: &ubuntu - "//doc_build:*" centos7: ¢os - platform: centos7 + platform: centos7_java11_devtoolset10 <<: *common <<: *default_tests_with_rpm diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index a8599e54..962b7700 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -5,7 +5,7 @@ build_targets: &build_targets - '-@rules_pkg//pkg:make_rpm' platforms: - centos7: + centos7_java11_devtoolset10: build_targets: *build_targets debian10: build_targets: *build_targets diff --git a/WORKSPACE b/WORKSPACE index b024b63d..fe06be59 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -79,8 +79,6 @@ http_archive( urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], ) -load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") rules_cc_dependencies() - -rules_cc_toolchains() diff --git a/examples/rich_structure/WORKSPACE b/examples/rich_structure/WORKSPACE index b41b3ef1..49865945 100644 --- a/examples/rich_structure/WORKSPACE +++ b/examples/rich_structure/WORKSPACE @@ -32,8 +32,6 @@ http_archive( urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"], ) -load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains") +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") rules_cc_dependencies() - -rules_cc_toolchains() From b5d3071681c493d7227b0ea04ad182ef52d395a1 Mon Sep 17 00:00:00 2001 From: aiuto Date: Mon, 13 Nov 2023 17:03:10 -0500 Subject: [PATCH 3/7] fix the imports on the filter directory test (#782) --- pkg/BUILD | 7 +++++++ tests/mappings/filter_directory/BUILD | 6 ++++-- .../filter_directory/test_filter_directory.py | 14 +------------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/pkg/BUILD b/pkg/BUILD index 7c38da48..b3115f58 100644 --- a/pkg/BUILD +++ b/pkg/BUILD @@ -105,4 +105,11 @@ py_binary( visibility = ["//visibility:public"], ) +py_library( + name = "filter_directory_lib", + srcs = ["filter_directory.py"], + srcs_version = "PY3", + visibility = ["//visibility:public"], +) + exports_files(["verify_archive_test_main.py.tpl"]) diff --git a/tests/mappings/filter_directory/BUILD b/tests/mappings/filter_directory/BUILD index c43bc777..a1ff831b 100644 --- a/tests/mappings/filter_directory/BUILD +++ b/tests/mappings/filter_directory/BUILD @@ -227,7 +227,9 @@ directory( py_test( name = "negative_tests", srcs = ["test_filter_directory.py"], - data = ["//pkg:filter_directory"], main = "test_filter_directory.py", - deps = ["@rules_python//python/runfiles"], + deps = [ + "//pkg:filter_directory_lib", + "@rules_python//python/runfiles", + ], ) diff --git a/tests/mappings/filter_directory/test_filter_directory.py b/tests/mappings/filter_directory/test_filter_directory.py index c11f85f8..8426905d 100644 --- a/tests/mappings/filter_directory/test_filter_directory.py +++ b/tests/mappings/filter_directory/test_filter_directory.py @@ -24,21 +24,9 @@ import tempfile import unittest +from pkg import filter_directory from python.runfiles import runfiles -# Get the filter_directory script into the import path. There might be a -# better way to do this, but it works. - -rf = runfiles.Create() -filter_directory_script = rf.Rlocation('/'.join([ - os.environ["TEST_WORKSPACE"], - "pkg", - "filter_directory" -])) - -sys.path.append(os.path.dirname(filter_directory_script)) -import filter_directory # noqa: E402 - # TODO: These tests are largely to ensure that filter_directory fails, but it # does not check _why_ they fail. From 9dd0c8cd736c6e55e20eb32e7a9f8639b13ff9b2 Mon Sep 17 00:00:00 2001 From: Mike Kelly Date: Mon, 13 Nov 2023 14:03:57 -0800 Subject: [PATCH 4/7] Add support for `Obsoletes` tag in RPM definition (#778) Currently there doesn't appear to be any support `Obsoletes` in our RPM structure. This change introduces the support for the `Obsoletes` tag in the RPM specfile. Unlikely `Requires`, there doesn't appear to be a context-specific `Obsoletes`, so this is not added here. --- pkg/rpm_pfg.bzl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/rpm_pfg.bzl b/pkg/rpm_pfg.bzl index b62fb1cb..44b791c0 100644 --- a/pkg/rpm_pfg.bzl +++ b/pkg/rpm_pfg.bzl @@ -321,6 +321,8 @@ def _pkg_rpm_impl(ctx): preamble_pieces.extend(["Provides: " + p for p in ctx.attr.provides]) if ctx.attr.conflicts: preamble_pieces.extend(["Conflicts: " + c for c in ctx.attr.conflicts]) + if ctx.attr.obsoletes: + preamble_pieces.extend(["Obsoletes: " + o for o in ctx.attr.obsoletes]) if ctx.attr.requires: preamble_pieces.extend(["Requires: " + r for r in ctx.attr.requires]) if ctx.attr.requires_contextual: @@ -924,6 +926,14 @@ pkg_rpm = rule( See also: https://rpm-software-management.github.io/rpm/manual/dependencies.html """, ), + "obsoletes": attr.string_list( + doc = """List of rpm capability expressions that this package obsoletes. + + Corresponds to the "Obsoletes" preamble tag. + + See also: https://rpm-software-management.github.io/rpm/manual/dependencies.html + """, + ), "requires": attr.string_list( doc = """List of rpm capability expressions that this package requires. From 988ebe8efb9624b575d5c108029962cbd129f49d Mon Sep 17 00:00:00 2001 From: aiuto Date: Mon, 13 Nov 2023 17:07:53 -0500 Subject: [PATCH 5/7] Little fixes to stop lint warnings (#783) * Fix some typos, some missing loads and buildifier warnings. --- pkg/private/deb/deb.bzl | 2 +- pkg/private/pkg_files.bzl | 3 +-- pkg/private/tar/BUILD | 4 ++++ pkg/rpm_pfg.bzl | 2 +- tests/tar/BUILD | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/private/deb/deb.bzl b/pkg/private/deb/deb.bzl index 62dfaf2d..53bc2ebb 100644 --- a/pkg/private/deb/deb.bzl +++ b/pkg/private/deb/deb.bzl @@ -181,7 +181,7 @@ pkg_deb_impl = rule( Create a Debian package. This rule produces 2 artifacts: a .deb and a .changes file. The DefaultInfo will - include both. If you need downstream rule to specificially depend on only the .deb or + include both. If you need downstream rule to specifically depend on only the .deb or .changes file then you can use `filegroup` to select distinct output groups. **OutputGroupInfo** diff --git a/pkg/private/pkg_files.bzl b/pkg/private/pkg_files.bzl index 6fcf22fb..769fffb8 100644 --- a/pkg/private/pkg_files.bzl +++ b/pkg/private/pkg_files.bzl @@ -228,7 +228,7 @@ def _process_pkg_symlink(mapping_context, pkg_symlink_info, origin): link_to = pkg_symlink_info.target, ) -def _process_pkg_filegroup(mapping_context, pkg_filegroup_info, origin): +def _process_pkg_filegroup(mapping_context, pkg_filegroup_info): if hasattr(pkg_filegroup_info, "pkg_dirs"): for d in pkg_filegroup_info.pkg_dirs: _process_pkg_dirs(mapping_context, d[0], d[1]) @@ -267,7 +267,6 @@ def process_src(mapping_context, src, origin): _process_pkg_filegroup( mapping_context, src[PackageFilegroupInfo], - origin, ) found_info = True if PackageSymlinkInfo in src: diff --git a/pkg/private/tar/BUILD b/pkg/private/tar/BUILD index 6bfeb1e0..b4eee99c 100644 --- a/pkg/private/tar/BUILD +++ b/pkg/private/tar/BUILD @@ -18,6 +18,10 @@ All interfaces are subject to change at any time. load("@rules_python//python:defs.bzl", "py_binary", "py_library") +package( + default_applicable_licenses = ["//:license"], +) + licenses(["notice"]) filegroup( diff --git a/pkg/rpm_pfg.bzl b/pkg/rpm_pfg.bzl index 44b791c0..97ffcfa2 100644 --- a/pkg/rpm_pfg.bzl +++ b/pkg/rpm_pfg.bzl @@ -712,7 +712,7 @@ pkg_rpm = rule( Is the equivalent to `%config(missingok, noreplace)` in the `%files` list. This rule produces 2 artifacts: an .rpm and a .changes file. The DefaultInfo will - include both. If you need downstream rule to specificially depend on only the .rpm or + include both. If you need downstream rule to specifically depend on only the .rpm or .changes file then you can use `filegroup` to select distinct output groups. **OutputGroupInfo** diff --git a/tests/tar/BUILD b/tests/tar/BUILD index a4cbc146..cecb5a8e 100644 --- a/tests/tar/BUILD +++ b/tests/tar/BUILD @@ -14,7 +14,7 @@ # -*- coding: utf-8 -*- """Tests for pkg_tar.""" -load("@rules_python//python:defs.bzl", "py_test") +load("@rules_python//python:defs.bzl", "py_binary", "py_test") # buildifier: disable=bzl-visibility load("//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "pkg_mkdirs", "pkg_mklink") @@ -577,7 +577,7 @@ pkg_tar( symlinks = { # We expect package_dir to apply to this "tree_artifact/toss_in_another": "some_target", - # But we protect the user from duplicationg package_dir in their + # But we protect the user from duplicating package_dir in their # link. That was the old behavior of symlink. "new/base/something/this": "that", }, From 3917ae64448da126ded00197a4cc99ac43e2b20f Mon Sep 17 00:00:00 2001 From: aiuto Date: Tue, 14 Nov 2023 11:51:04 -0500 Subject: [PATCH 6/7] Add yun as CI owner (#785) * add yun as CI owner * remove unknown name --- CODEOWNERS | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 10e6cd3d..19f1dfb3 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,7 +1,12 @@ * @aiuto @alexeagle +/.bazelci/ @meteorcloudy +/.bcr/ @meteorcloudy +/.github/ @meteorcloudy +/.pre-commit-config.yaml @meteorcloudy + /deb_packages/ @aiuto -/docs/ @aiuto @alexeagle @jylinv0 @gregestren +/docs/ @aiuto @alexeagle @jylinv0 /doc_build/ @aiuto @alexeagle @jylinv0 /pkg/rpm/ @nacl @@ -9,6 +14,6 @@ /legacy/tests/rpm @nacl /toolchains/rpm @nacl -/pkg/deb.bzl @aiuto @dannysullivan @jylinv0 -/pkg/private/deb/ @aiuto @dannysullivan @jylinv0 -/pkg/tests/deb/ @aiuto @dannysullivan @jylinv0 +/pkg/deb.bzl @aiuto @dannysullivan +/pkg/private/deb/ @aiuto @dannysullivan +/pkg/tests/deb/ @aiuto @dannysullivan From dd4cb3ca99189bc740ec7cb08c17b7528c28364b Mon Sep 17 00:00:00 2001 From: aiuto Date: Wed, 22 Nov 2023 09:33:50 -0500 Subject: [PATCH 7/7] CI fixes (#784) * do not use bzlmod for integration test * change distro target * split out doc_build to non bzlmod --- .bazelci/integration.yml | 14 ++++---------- .bazelci/tests.yml | 11 +++++++---- WORKSPACE.bzlmod | 16 ++++++++++------ toolchains/git/git_configure.bzl | 17 +++++++++++++++++ 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/.bazelci/integration.yml b/.bazelci/integration.yml index d73a4d75..cf05c442 100644 --- a/.bazelci/integration.yml +++ b/.bazelci/integration.yml @@ -1,23 +1,17 @@ -lts: <s - bazel: latest - -rolling: &rolling - bazel: rolling - common: &common - platform: ubuntu1804 working_directory: .. build_targets: - - "distro:*" + - "distro:all" tasks: rolling_ubuntu: name: rolling_distro - <<: *rolling + platform: ubuntu1804 + bazel: rolling <<: *common lts_ubuntu: name: lts_distro platform: ubuntu1804 - <<: *lts + bazel: latest <<: *common diff --git a/.bazelci/tests.yml b/.bazelci/tests.yml index 3fc01113..d64a858e 100644 --- a/.bazelci/tests.yml +++ b/.bazelci/tests.yml @@ -61,10 +61,6 @@ ubuntu1804: &ubuntu platform: ubuntu1804 <<: *common <<: *default_tests - build_targets: - - "//distro:distro" - - "//distro:relnotes" - - "//doc_build:*" centos7: ¢os platform: centos7_java11_devtoolset10 @@ -94,6 +90,9 @@ tasks: platform: ubuntu1804 build_flags: - "--enable_bzlmod" + build_targets: + - "//distro:distro" + - "//distro:relnotes" <<: *common <<: *rolling <<: *default_tests @@ -118,6 +117,10 @@ tasks: name: lts_ubuntu <<: *ubuntu <<: *lts + build_targets: + - "//distro:distro" + - "//distro:relnotes" + - "//doc_build:*" lts_windows: name: lts_windows <<: *windows diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod index e5300a3a..3a25ac48 100644 --- a/WORKSPACE.bzlmod +++ b/WORKSPACE.bzlmod @@ -15,9 +15,13 @@ local_repository( #) # Needed for making our release notes -#load("//toolchains/git:git_configure.bzl", "experimental_find_system_git") -# -#experimental_find_system_git( -# name = "rules_pkg_git", -# verbose = False, -#) +load("//toolchains/git:git_configure.bzl", "experimental_find_system_git_bzlmod") + +experimental_find_system_git_bzlmod( + name = "rules_pkg_git", + verbose = False, +) +register_toolchains( + "@rules_pkg_git//:git_auto_toolchain", + "//toolchains/git:git_missing_toolchain", +) diff --git a/toolchains/git/git_configure.bzl b/toolchains/git/git_configure.bzl index c1f9a0e7..f537c1a1 100644 --- a/toolchains/git/git_configure.bzl +++ b/toolchains/git/git_configure.bzl @@ -58,6 +58,7 @@ _find_system_git = repository_rule( }, ) +# buildifier: disable=function-docstring-args def experimental_find_system_git(name, workspace_file = None, verbose = False): """Create a toolchain that lets you run git. @@ -76,3 +77,19 @@ def experimental_find_system_git(name, workspace_file = None, verbose = False): "@%s//:git_auto_toolchain" % name, "@rules_pkg//toolchains/git:git_missing_toolchain", ) + +# buildifier: disable=function-docstring-args +def experimental_find_system_git_bzlmod(name, workspace_file = None, verbose = False): + """Create a toolchain that lets you run git. + + WARNING: This is experimental. The API and behavior are subject to change + at any time. + + This presumes that your Bazel WORKSPACE file is located under your git + client. That is often true, but might not be in a multi-repo where you + might weave together a Bazel workspace from several git repos that are + all rooted under the WORKSPACE file. + """ + if not workspace_file: + workspace_file = Label("//:MODULE.bazel") + _find_system_git(name = name, workspace_file = workspace_file, verbose = verbose)