diff --git a/.bazelci/integration.yml b/.bazelci/integration.yml index 0a2d0e15..07aebca9 100644 --- a/.bazelci/integration.yml +++ b/.bazelci/integration.yml @@ -7,7 +7,7 @@ rolling: &rolling common: &common platform: ubuntu1804 - working_directory: /workdir/pkg + working_directory: /workdir build_targets: - "distro:*" diff --git a/.bazelci/tests.yml b/.bazelci/tests.yml index 248aa63e..15162de4 100644 --- a/.bazelci/tests.yml +++ b/.bazelci/tests.yml @@ -1,6 +1,6 @@ common: &common - working_directory: ../pkg + # working_directory: ../pkg # # Bazel releases @@ -23,13 +23,13 @@ default_tests: &default_tests # rpmbuild(8) is not available on most platforms skip_rpm: &skip_rpm - "-//tests/rpm/..." - - "-//legacy/tests/rpm/..." + - "-//pkg/legacy/tests/rpm/..." win_tests: &win_tests test_targets: - "..." - "-//distro/..." - - "-//legacy/tests/rpm/..." + - "-//pkg/legacy/tests/rpm/..." - "-//tests:make_rpm_test" - "-//tests:package_naming_aggregate_test" - "-//tests:path_test" diff --git a/BUILD b/BUILD new file mode 100644 index 00000000..18b98407 --- /dev/null +++ b/BUILD @@ -0,0 +1,36 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +exports_files( + ["WORKSPACE"], + visibility = ["//visibility:public"], +) + +exports_files( + glob([ + "*.bzl", + ]), + visibility = ["//visibility:public"], +) + +filegroup( + name = "standard_package", + srcs = glob([ + "*.bzl", + ]) + [ + "BUILD", + "LICENSE", + ], + visibility = ["//distro:__pkg__"], +) diff --git a/pkg/WORKSPACE b/WORKSPACE similarity index 91% rename from pkg/WORKSPACE rename to WORKSPACE index 17523066..2fa6ad68 100644 --- a/pkg/WORKSPACE +++ b/WORKSPACE @@ -1,4 +1,4 @@ -# Copyright 2020 The Bazel Authors. All rights reserved. +# Copyright 2021 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ workspace(name = "rules_pkg") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//:deps.bzl", "rules_pkg_dependencies") +load("@rules_pkg//pkg:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() @@ -27,6 +26,8 @@ bazel_skylib_workspace() # # Include dependencies which are only needed for development here. +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + # Find rpmbuild if it exists. load("@rules_pkg//toolchains:rpmbuild_configure.bzl", "find_system_rpmbuild") @@ -57,7 +58,7 @@ stardoc_repositories() # TODO(nacl): remove this when the "new" framework is ready. local_repository( name = "experimental_test_external_repo", - path = "experimental/tests/external_repo", + path = "pkg/experimental/tests/external_repo", ) local_repository( diff --git a/deps.bzl b/deps.bzl new file mode 100644 index 00000000..d402f2b2 --- /dev/null +++ b/deps.bzl @@ -0,0 +1,22 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Workspace dependencies for rules_pkg/pkg + +load("//pkg:deps.bzl", _rules_pkg_dependencies = "rules_pkg_dependencies") + +rules_pkg_dependencies = _rules_pkg_dependencies + +def rules_pkg_register_toolchains(): + pass diff --git a/pkg/distro/BUILD b/distro/BUILD similarity index 80% rename from pkg/distro/BUILD rename to distro/BUILD index b1c3d4e8..9dcf2c14 100644 --- a/pkg/distro/BUILD +++ b/distro/BUILD @@ -12,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//:pkg.bzl", "pkg_tar") -load("//:version.bzl", "version") -load("//releasing:defs.bzl", "print_rel_notes") -load("//releasing:git.bzl", "git_changelog") +load("@rules_pkg//pkg:pkg.bzl", "pkg_tar") +load("@rules_pkg//pkg:version.bzl", "version") +load("@rules_pkg//pkg/releasing:defs.bzl", "print_rel_notes") +load("@rules_pkg//pkg/releasing:git.bzl", "git_changelog") +load("@rules_python//python:defs.bzl", "py_test") load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("@bazel_stardoc//stardoc:stardoc.bzl", "stardoc") -load("@rules_python//python:defs.bzl", "py_test") licenses(["notice"]) @@ -37,8 +37,9 @@ pkg_tar( srcs = [ ":small_workspace", "//:standard_package", - "//private:standard_package", - "//releasing:standard_package", + "//pkg:standard_package", + "//pkg/private:standard_package", + "//pkg/releasing:standard_package", "//toolchains:standard_package", "//toolchains/git:standard_package", ], @@ -92,7 +93,7 @@ py_test( "noci", ], deps = [ - "//releasing:release_utils", + "//pkg/releasing:release_utils", "@bazel_tools//tools/python/runfiles", ], ) @@ -106,15 +107,15 @@ genrule( bzl_library( name = "rules_pkg_lib", srcs = [ - "//:mappings.bzl", - "//:package_variables.bzl", - "//:path.bzl", - "//:pkg.bzl", - "//:providers.bzl", - "//:rpm.bzl", - "//:version.bzl", - "//private:pkg_files.bzl", - "//private:util.bzl", + "//pkg:mappings.bzl", + "//pkg:package_variables.bzl", + "//pkg:path.bzl", + "//pkg:pkg.bzl", + "//pkg:providers.bzl", + "//pkg:rpm.bzl", + "//pkg:version.bzl", + "//pkg/private:pkg_files.bzl", + "//pkg/private:util.bzl", "@bazel_skylib//lib:paths", ], visibility = ["//visibility:private"], @@ -123,7 +124,7 @@ bzl_library( stardoc( name = "docs_deb", out = "pkg_deb.md", - input = "//:pkg.bzl", + input = "//pkg:pkg.bzl", symbol_names = [ "pkg_deb", "pkg_deb_impl", @@ -134,7 +135,7 @@ stardoc( stardoc( name = "docs_tar", out = "pkg_tar.md", - input = "//:pkg.bzl", + input = "//pkg:pkg.bzl", symbol_names = [ "pkg_tar", "pkg_tar_impl", @@ -145,7 +146,7 @@ stardoc( stardoc( name = "docs_zip", out = "pkg_zip.md", - input = "//:pkg.bzl", + input = "//pkg:pkg.bzl", symbol_names = [ "pkg_zip", "pkg_zip_impl", @@ -156,14 +157,14 @@ stardoc( stardoc( name = "docs_legacy_rpm", out = "legacy_pkg_rpm.md", - input = "//legacy:rpm.bzl", + input = "//pkg/legacy:rpm.bzl", deps = [":rules_pkg_lib"], ) stardoc( name = "mappings", out = "mappings.md", - input = "//:mappings.bzl", + input = "//pkg:mappings.bzl", deps = [ ":rules_pkg_lib", ], diff --git a/pkg/distro/__init__.py b/distro/__init__.py similarity index 100% rename from pkg/distro/__init__.py rename to distro/__init__.py diff --git a/pkg/distro/packaging_test.py b/distro/packaging_test.py similarity index 98% rename from pkg/distro/packaging_test.py rename to distro/packaging_test.py index 1b81e81e..df1e1bd6 100644 --- a/pkg/distro/packaging_test.py +++ b/distro/packaging_test.py @@ -19,7 +19,7 @@ import unittest from bazel_tools.tools.python.runfiles import runfiles -from releasing import release_tools +from pkg.releasing import release_tools from distro import release_version _VERBOSE = True diff --git a/pkg/distro/testdata/BUILD.tpl b/distro/testdata/BUILD.tpl similarity index 100% rename from pkg/distro/testdata/BUILD.tpl rename to distro/testdata/BUILD.tpl diff --git a/examples/naming_package_files/WORKSPACE b/examples/naming_package_files/WORKSPACE index 8b26a4de..1b2573e1 100644 --- a/examples/naming_package_files/WORKSPACE +++ b/examples/naming_package_files/WORKSPACE @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") local_repository( name = "rules_pkg", - path = "../../pkg", + path = "../..", ) http_archive diff --git a/examples/prebuilt_rpmbuild/WORKSPACE b/examples/prebuilt_rpmbuild/WORKSPACE index ef814f72..640b3ecc 100644 --- a/examples/prebuilt_rpmbuild/WORKSPACE +++ b/examples/prebuilt_rpmbuild/WORKSPACE @@ -16,7 +16,7 @@ workspace(name = "rules_pkg_example_prebuilt_rpmbuild") local_repository( name = "rules_pkg", - path = "../../pkg", + path = "../..", ) load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") diff --git a/examples/rich_structure/WORKSPACE b/examples/rich_structure/WORKSPACE index 252c34f2..4c09450d 100644 --- a/examples/rich_structure/WORKSPACE +++ b/examples/rich_structure/WORKSPACE @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") local_repository( name = "rules_pkg", - path = "../../pkg", + path = "../..", ) load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") diff --git a/examples/time_stamping/WORKSPACE b/examples/time_stamping/WORKSPACE index 1edca417..3140dd02 100644 --- a/examples/time_stamping/WORKSPACE +++ b/examples/time_stamping/WORKSPACE @@ -16,7 +16,7 @@ workspace(name = "rules_pkg_examples") local_repository( name = "rules_pkg", - path = "../../pkg", + path = "../..", ) load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") diff --git a/examples/where_is_my_output/WORKSPACE b/examples/where_is_my_output/WORKSPACE index 252c34f2..4c09450d 100644 --- a/examples/where_is_my_output/WORKSPACE +++ b/examples/where_is_my_output/WORKSPACE @@ -18,7 +18,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") local_repository( name = "rules_pkg", - path = "../../pkg", + path = "../..", ) load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") diff --git a/install.bzl b/install.bzl new file mode 100644 index 00000000..e69de29b diff --git a/mappings.bzl b/mappings.bzl new file mode 100644 index 00000000..2c7e9920 --- /dev/null +++ b/mappings.bzl @@ -0,0 +1,38 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load( + "//pkg:mappings.bzl", + _filter_directory = "filter_directory", + _pkg_attributes = "pkg_attributes", + _pkg_filegroup = "pkg_filegroup", + _pkg_files = "pkg_files", + _pkg_mkdirs = "pkg_mkdirs", + _pkg_mklink = "pkg_mklink", + _strip_prefix = "strip_prefix", +) + +filter_directory = _filter_directory + +pkg_attributes = _pkg_attributes + +pkg_filegroup = _pkg_filegroup + +pkg_files = _pkg_files + +pkg_mkdirs = _pkg_mkdirs + +pkg_mklink = _pkg_mklink + +strip_prefix = _strip_prefix diff --git a/package_variables.bzl b/package_variables.bzl new file mode 100644 index 00000000..118b3517 --- /dev/null +++ b/package_variables.bzl @@ -0,0 +1,18 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("pkg/package_variables.bzl", + _add_ctx_variables = "add_ctx_variables", +) +add_ctx_variables = _add_ctx_variables diff --git a/pkg.bzl b/pkg.bzl new file mode 100644 index 00000000..81e1feec --- /dev/null +++ b/pkg.bzl @@ -0,0 +1,24 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load( + "//pkg:pkg.bzl", + _pkg_deb = "pkg_deb", + _pkg_tar = "pkg_tar", + _pkg_zip = "pkg_zip", +) + +pkg_deb = _pkg_deb +pkg_tar = _pkg_tar +pkg_zip = _pkg_zip diff --git a/pkg/BUILD b/pkg/BUILD index d4b8e9e8..f9dafd65 100644 --- a/pkg/BUILD +++ b/pkg/BUILD @@ -40,18 +40,12 @@ filegroup( "*.md", ]) + [ "BUILD", - "LICENSE", - "//legacy:standard_package", - "//rpm:standard_package", + "//pkg/legacy:standard_package", + "//pkg/rpm:standard_package", ], visibility = ["//distro:__pkg__"], ) -exports_files( - ["WORKSPACE"], - visibility = ["//visibility:public"], -) - # Used by pkg_rpm in rpm.bzl. py_binary( name = "make_rpm", @@ -65,8 +59,8 @@ py_binary( #}), visibility = ["//visibility:public"], deps = [ - "//private:archive", - ":make_rpm_lib", + "//pkg/private:archive", + "//pkg:make_rpm_lib", ], ) @@ -79,8 +73,8 @@ py_library( "//tests:__subpackages__", ], deps = [ - "//private:archive", - "//private:helpers", + "//pkg/private:archive", + "//pkg/private:helpers", ], ) diff --git a/pkg/LICENSE b/pkg/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/pkg/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/pkg/README.md b/pkg/README.md index 1a70f714..cab36e00 100644 --- a/pkg/README.md +++ b/pkg/README.md @@ -40,7 +40,7 @@ find_system_rpmbuild(name = "rules_pkg_rpmbuild") This example is a simplification of the debian packaging of Bazel: ```python -load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_deb") +load("@rules_pkg//pkg:pkg.bzl", "pkg_tar", "pkg_deb") pkg_tar( diff --git a/pkg/install.bzl b/pkg/install.bzl index 9468b0da..b1a5500e 100644 --- a/pkg/install.bzl +++ b/pkg/install.bzl @@ -19,8 +19,8 @@ run`-able installation script. """ -load("//:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo") -load("//private:pkg_files.bzl", "process_src", "write_manifest") +load("//pkg:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo") +load("//pkg/private:pkg_files.bzl", "process_src", "write_manifest") load("@rules_python//python:defs.bzl", "py_binary") def _pkg_install_script_impl(ctx): @@ -106,7 +106,7 @@ _pkg_install_script = rule( # scripts and expected interfaces. "_script_template": attr.label( allow_single_file = True, - default = "//private:install.py.tpl", + default = "//pkg/private:install.py.tpl", ), }, executable = True, @@ -172,7 +172,7 @@ def pkg_install(name, srcs, **kwargs): name = name, srcs = [":" + name + "_install_script"], main = name + "_install_script.py", - deps = ["@rules_pkg//private:manifest"], + deps = ["//pkg/private:manifest"], srcs_version = "PY3", python_version = "PY3", **kwargs diff --git a/pkg/legacy/BUILD b/pkg/legacy/BUILD index 2b309adb..f1857400 100644 --- a/pkg/legacy/BUILD +++ b/pkg/legacy/BUILD @@ -21,5 +21,5 @@ filegroup( ]) + [ "BUILD", ], - visibility = ["//:__pkg__"], + visibility = ["//pkg:__pkg__"], ) diff --git a/pkg/legacy/rpm.bzl b/pkg/legacy/rpm.bzl index 91a344b4..95b2e2a4 100644 --- a/pkg/legacy/rpm.bzl +++ b/pkg/legacy/rpm.bzl @@ -188,7 +188,7 @@ pkg_rpm = rule( # Implicit dependencies. "rpmbuild_path": attr.string(), # deprecated "_make_rpm": attr.label( - default = Label("//:make_rpm"), + default = Label("//pkg:make_rpm"), cfg = "exec", executable = True, allow_files = True, diff --git a/pkg/legacy/tests/rpm/BUILD b/pkg/legacy/tests/rpm/BUILD index 2ad1ea18..2b572972 100644 --- a/pkg/legacy/tests/rpm/BUILD +++ b/pkg/legacy/tests/rpm/BUILD @@ -13,7 +13,7 @@ # limitations under the License. # -*- coding: utf-8 -*- -load("//:rpm.bzl", "pkg_rpm") +load("//pkg:rpm.bzl", "pkg_rpm") pkg_rpm( name = "test-rpm", diff --git a/pkg/make_rpm.py b/pkg/make_rpm.py index 28a7f46f..a71a6c6c 100644 --- a/pkg/make_rpm.py +++ b/pkg/make_rpm.py @@ -29,7 +29,7 @@ import tempfile from string import Template -from private import helpers +from pkg.private import helpers # Setup to safely create a temporary directory and clean it up when done. diff --git a/pkg/mappings.bzl b/pkg/mappings.bzl index 75ccd516..eaf6f0bb 100644 --- a/pkg/mappings.bzl +++ b/pkg/mappings.bzl @@ -27,8 +27,8 @@ Rules that actually make use of the outputs of the above rules are not specified here. """ +load("//pkg:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo") load("@bazel_skylib//lib:paths.bzl", "paths") -load("//:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo") # TODO(#333): strip_prefix module functions should produce unique outputs. In # particular, this one and `_sp_from_pkg` can overlap. @@ -784,7 +784,7 @@ filter_directory = rule( """, ), "_filterer": attr.label( - default = "//:filter_directory", + default = "//pkg:filter_directory", executable = True, cfg = "exec", ), diff --git a/pkg/pkg.bzl b/pkg/pkg.bzl index f1d8e42f..c538bed7 100644 --- a/pkg/pkg.bzl +++ b/pkg/pkg.bzl @@ -21,9 +21,9 @@ load( "PackageFilesInfo", "PackageVariablesInfo", ) -load("//private:util.bzl", "setup_output_files", "substitute_package_variables") +load("//pkg/private:util.bzl", "setup_output_files", "substitute_package_variables") load( - "//private:pkg_files.bzl", + "//pkg/private:pkg_files.bzl", "add_directory", "add_empty_file", "add_label_list", @@ -47,7 +47,7 @@ SUPPORTED_TAR_COMPRESSIONS = ( ) deb_filetype = [".deb", ".udeb"] _DEFAULT_MTIME = -1 -_stamp_condition = str(Label("//private:private_stamp_detect")) +_stamp_condition = str(Label("//pkg/private:private_stamp_detect")) def _remap(remap_paths, path): """If path starts with a key in remap_paths, rewrite it.""" @@ -452,7 +452,7 @@ pkg_tar_impl = rule( # Implicit dependencies. "build_tar": attr.label( - default = Label("//private:build_tar"), + default = Label("//pkg/private:build_tar"), cfg = "exec", executable = True, allow_files = True, @@ -563,7 +563,7 @@ pkg_deb_impl = rule( # Implicit dependencies. "make_deb": attr.label( - default = Label("//private:make_deb"), + default = Label("//pkg/private:make_deb"), cfg = "exec", executable = True, allow_files = True, @@ -693,7 +693,7 @@ pkg_zip_impl = rule( # Implicit dependencies. "_build_zip": attr.label( - default = Label("//private:build_zip"), + default = Label("//pkg/private:build_zip"), cfg = "exec", executable = True, allow_files = True, diff --git a/pkg/private/BUILD b/pkg/private/BUILD index bf2da210..e353f580 100644 --- a/pkg/private/BUILD +++ b/pkg/private/BUILD @@ -57,7 +57,7 @@ py_library( ], srcs_version = "PY3", visibility = [ - "//:__pkg__", + "//pkg:__pkg__", "//tests:__pkg__", ], ) @@ -70,7 +70,7 @@ py_library( ], srcs_version = "PY3", visibility = [ - "//:__pkg__", + "//pkg:__pkg__", "//tests:__subpackages__", ], ) @@ -83,7 +83,7 @@ py_library( ], srcs_version = "PY3", visibility = [ - "//:__pkg__", + "//pkg:__pkg__", "//tests:__pkg__", ], ) diff --git a/pkg/private/build_tar.py b/pkg/private/build_tar.py index 52d784ef..daf11c41 100644 --- a/pkg/private/build_tar.py +++ b/pkg/private/build_tar.py @@ -19,10 +19,10 @@ import tarfile import tempfile -from private import archive -from private import helpers -from private import build_info -from private import manifest +from pkg.private import archive +from pkg.private import helpers +from pkg.private import build_info +from pkg.private import manifest class TarFile(object): diff --git a/pkg/private/build_zip.py b/pkg/private/build_zip.py index 2a24a6f1..1b26a1ba 100644 --- a/pkg/private/build_zip.py +++ b/pkg/private/build_zip.py @@ -18,9 +18,9 @@ import json import zipfile -from private import build_info -from private import helpers -from private import manifest +from pkg.private import build_info +from pkg.private import helpers +from pkg.private import manifest ZIP_EPOCH = 315532800 diff --git a/pkg/private/install.py.tpl b/pkg/private/install.py.tpl index c361c6ef..6721067c 100644 --- a/pkg/private/install.py.tpl +++ b/pkg/private/install.py.tpl @@ -24,7 +24,7 @@ import os import shutil import sys -import private.manifest as manifest +from pkg.private import manifest # Globals used for runfile path manipulation. # diff --git a/pkg/private/make_deb.py b/pkg/private/make_deb.py index 6da5c5b9..6226fe27 100644 --- a/pkg/private/make_deb.py +++ b/pkg/private/make_deb.py @@ -28,7 +28,7 @@ else: OrderedDict = dict -from private import helpers +from pkg.private import helpers # list of debian fields : (name, mandatory, wrap[, default]) # see http://www.debian.org/doc/debian-policy/ch-controlfields.html diff --git a/pkg/private/pkg_files.bzl b/pkg/private/pkg_files.bzl index 390e09bd..ace905be 100644 --- a/pkg/private/pkg_files.bzl +++ b/pkg/private/pkg_files.bzl @@ -31,9 +31,9 @@ Concepts and terms: by rule implementations and passed to the build_*.py helpers. """ -load("//:path.bzl", "compute_data_path", "dest_path") +load("//pkg:path.bzl", "compute_data_path", "dest_path") load( - "//:providers.bzl", + "//pkg:providers.bzl", "PackageArtifactInfo", "PackageDirsInfo", "PackageFilegroupInfo", diff --git a/pkg/private/util.bzl b/pkg/private/util.bzl index db46e45a..8b18347d 100644 --- a/pkg/private/util.bzl +++ b/pkg/private/util.bzl @@ -13,7 +13,7 @@ # limitations under the License. """Internal utilities for rules_pkg.""" -load("//:providers.bzl", "PackageVariablesInfo") +load("//pkg:providers.bzl", "PackageVariablesInfo") def setup_output_files(ctx, package_file_name = None, default_output_file = None): """Provide output file metadata for common packaging rules diff --git a/pkg/releasing/defs.bzl b/pkg/releasing/defs.bzl index 00c75d58..3552a59e 100644 --- a/pkg/releasing/defs.bzl +++ b/pkg/releasing/defs.bzl @@ -12,7 +12,7 @@ def print_rel_notes( tarball_name = ":%s-%s.tar.gz" % (repo, version) # Must use Label to get a path relative to the rules_pkg repository, # instead of the calling BUILD file. - print_rel_notes_helper = Label("//releasing:print_rel_notes") + print_rel_notes_helper = Label("//pkg/releasing:print_rel_notes") tools = [print_rel_notes_helper] cmd = [ "LC_ALL=C.UTF-8 $(location %s)" % str(print_rel_notes_helper), diff --git a/pkg/releasing/git.bzl b/pkg/releasing/git.bzl index 02c63754..2952e6ce 100644 --- a/pkg/releasing/git.bzl +++ b/pkg/releasing/git.bzl @@ -73,7 +73,7 @@ _git_changelog = rule( default = False, ), "_git_changelog": attr.label( - default = Label("//releasing:git_changelog_private"), + default = Label("//pkg/releasing:git_changelog_private"), cfg = "exec", executable = True, allow_files = True, diff --git a/pkg/releasing/print_rel_notes.py b/pkg/releasing/print_rel_notes.py index 2e38008b..2b0c7fd9 100644 --- a/pkg/releasing/print_rel_notes.py +++ b/pkg/releasing/print_rel_notes.py @@ -20,7 +20,7 @@ import string import textwrap -from releasing import release_tools +from pkg.releasing import release_tools def print_notes(org, repo, version, tarball_path, mirror_host=None, diff --git a/pkg/rpm.bzl b/pkg/rpm.bzl index cb28119c..ea5df1cc 100644 --- a/pkg/rpm.bzl +++ b/pkg/rpm.bzl @@ -29,8 +29,8 @@ The mechanism for choosing between the two is documented in the function itself. """ -load("//legacy:rpm.bzl", pkg_rpm_legacy = "pkg_rpm") -load("//:rpm_pfg.bzl", pkg_rpm_pfg = "pkg_rpm") +load("//pkg/legacy:rpm.bzl", pkg_rpm_legacy = "pkg_rpm") +load("//pkg:rpm_pfg.bzl", pkg_rpm_pfg = "pkg_rpm") def pkg_rpm(name, srcs = None, spec_file = None, **kwargs): """pkg_rpm wrapper diff --git a/pkg/rpm/BUILD b/pkg/rpm/BUILD index 40c00051..67791dac 100644 --- a/pkg/rpm/BUILD +++ b/pkg/rpm/BUILD @@ -31,7 +31,7 @@ filegroup( ]) + [ "BUILD", ], - visibility = ["//:__pkg__"], + visibility = ["//pkg:__pkg__"], ) # Helper script used to augment the %install scriptlet and %files list with diff --git a/pkg/rpm_pfg.bzl b/pkg/rpm_pfg.bzl index 38dcb622..221501b1 100644 --- a/pkg/rpm_pfg.bzl +++ b/pkg/rpm_pfg.bzl @@ -25,8 +25,8 @@ find_system_rpmbuild(name="rules_pkg_rpmbuild") ``` """ -load("//private:util.bzl", "setup_output_files") -load("//:providers.bzl", "PackageArtifactInfo", "PackageFilegroupInfo", "PackageVariablesInfo") +load("//pkg/private:util.bzl", "setup_output_files") +load("//pkg:providers.bzl", "PackageArtifactInfo", "PackageFilegroupInfo", "PackageVariablesInfo") rpm_filetype = [".rpm"] @@ -866,7 +866,7 @@ pkg_rpm = rule( In most cases, you should not need to override this attribute. """, allow_single_file = spec_filetype, - default = "//rpm:template.spec.tpl", + default = "//pkg/rpm:template.spec.tpl", ), "binary_payload_compression": attr.string( doc = """Compression mode used for this RPM @@ -897,13 +897,13 @@ pkg_rpm = rule( ), # Implicit dependencies. "_make_rpm": attr.label( - default = Label("//:make_rpm"), + default = Label("//pkg:make_rpm"), cfg = "exec", executable = True, allow_files = True, ), "_treeartifact_helper": attr.label( - default = Label("//rpm:augment_rpm_files_install"), + default = Label("//pkg/rpm:augment_rpm_files_install"), cfg = "exec", executable = True, allow_files = True, diff --git a/providers.bzl b/providers.bzl new file mode 100644 index 00000000..45362204 --- /dev/null +++ b/providers.bzl @@ -0,0 +1,28 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//pkg:providers.bzl", + _PackageArtifactInfo = "PackageArtifactInfo", + _PackageDirsInfo = "PackageDirsInfo", + _PackageFilegroupInfo = "PackageFilegroupInfo", + _PackageFilesInfo = "PackageFilesInfo", + _PackageSymlinkInfo = "PackageSymlinkInfo", + _PackageVariablesInfo = "PackageVariablesInfo", +) +PackageArtifactInfo = _PackageArtifactInfo +PackageDirsInfo = _PackageDirsInfo +PackageFilegroupInfo = _PackageFilegroupInfo +PackageFilesInfo = _PackageFilesInfo +PackageSymlinkInfo = _PackageSymlinkInfo +PackageVariablesInfo = _PackageVariablesInfo diff --git a/rpm.bzl b/rpm.bzl new file mode 100644 index 00000000..c26ecef4 --- /dev/null +++ b/rpm.bzl @@ -0,0 +1,18 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//pkg:rpm.bzl", + _pkg_rpm = "pkg_rpm", +) +pkg_rpm = _pkg_rpm diff --git a/pkg/tests/BUILD b/tests/BUILD similarity index 95% rename from pkg/tests/BUILD rename to tests/BUILD index 2aaeba27..42ace9e6 100644 --- a/pkg/tests/BUILD +++ b/tests/BUILD @@ -13,13 +13,13 @@ # limitations under the License. # -*- coding: utf-8 -*- -load("//:mappings.bzl", "pkg_attributes", "pkg_mkdirs", "pkg_mklink") -load("//:pkg.bzl", "SUPPORTED_TAR_COMPRESSIONS", "pkg_deb", "pkg_tar", "pkg_zip") -load("//tests/util:defs.bzl", "directory", "fake_artifact") +load("my_package_name.bzl", "my_package_naming") +load("path_test.bzl", "path_tests") +load("@//pkg:mappings.bzl", "pkg_attributes", "pkg_mkdirs", "pkg_mklink") +load("@//pkg:pkg.bzl", "SUPPORTED_TAR_COMPRESSIONS", "pkg_deb", "pkg_tar", "pkg_zip") +load("@//tests/util:defs.bzl", "directory", "fake_artifact") load("@rules_python//python:defs.bzl", "py_test") load("@bazel_skylib//rules:copy_file.bzl", "copy_file") -load(":my_package_name.bzl", "my_package_naming") -load(":path_test.bzl", "path_tests") licenses(["notice"]) @@ -34,7 +34,7 @@ filegroup( ":test_tar_package_dir_file", ], visibility = [ - "//legacy/tests:__subpackages__", + "//pkg/legacy/tests:__subpackages__", "//tests:__subpackages__", ], ) @@ -48,7 +48,7 @@ py_test( python_version = "PY3", srcs_version = "PY3", deps = [ - "//private:archive", + "//pkg/private:archive", "@bazel_tools//tools/python/runfiles", ], ) @@ -56,7 +56,7 @@ py_test( py_test( name = "path_test", srcs = ["path_test.py"], - data = ["//:path.bzl"], + data = ["//pkg:path.bzl"], python_version = "PY3", srcs_version = "PY3", ) @@ -67,7 +67,7 @@ py_test( python_version = "PY3", srcs_version = "PY3", deps = [ - "//private:helpers", + "//pkg/private:helpers", ], ) @@ -77,7 +77,7 @@ py_test( python_version = "PY3", srcs_version = "PY3", deps = [ - "//:make_rpm_lib", + "//pkg:make_rpm_lib", ], ) @@ -346,7 +346,7 @@ py_test( ], python_version = "PY3", deps = [ - "//private:build_zip", + "//pkg/private:build_zip", "@bazel_tools//tools/python/runfiles", ], ) @@ -371,7 +371,7 @@ py_test( [pkg_tar( name = "test-tar-inclusion-%s" % ext, - build_tar = "//private:build_tar", + build_tar = "//pkg/private:build_tar", deps = [ ":test-tar-basic-%s" % ext, ":test_tar_naming", @@ -506,7 +506,7 @@ py_test( ], python_version = "PY3", deps = [ - "//private:archive", + "//pkg/private:archive", "@bazel_tools//tools/python/runfiles", ], ) diff --git a/pkg/tests/archive_test.py b/tests/archive_test.py similarity index 99% rename from pkg/tests/archive_test.py rename to tests/archive_test.py index 22521ba4..37918d99 100644 --- a/pkg/tests/archive_test.py +++ b/tests/archive_test.py @@ -18,7 +18,7 @@ import unittest from bazel_tools.tools.python.runfiles import runfiles -from private import archive +from pkg.private import archive from tests import compressor diff --git a/pkg/tests/compressor.py b/tests/compressor.py similarity index 100% rename from pkg/tests/compressor.py rename to tests/compressor.py diff --git a/pkg/tests/deb/BUILD b/tests/deb/BUILD similarity index 95% rename from pkg/tests/deb/BUILD rename to tests/deb/BUILD index bd5910fe..a1a7063a 100644 --- a/pkg/tests/deb/BUILD +++ b/tests/deb/BUILD @@ -15,8 +15,8 @@ # Tests for pkg_deb specific behavior -load("//:mappings.bzl", "pkg_mklink") -load("//:pkg.bzl", "pkg_deb", "pkg_tar") +load("//pkg:mappings.bzl", "pkg_mklink") +load("//pkg:pkg.bzl", "pkg_deb", "pkg_tar") load("//tests:my_package_name.bzl", "my_package_naming") load("@rules_python//python:defs.bzl", "py_test") @@ -97,7 +97,7 @@ py_test( ], python_version = "PY3", deps = [ - "//private:archive", + "//pkg/private:archive", "@bazel_tools//tools/python/runfiles", ], ) diff --git a/pkg/tests/deb/pkg_deb_test.py b/tests/deb/pkg_deb_test.py similarity index 99% rename from pkg/tests/deb/pkg_deb_test.py rename to tests/deb/pkg_deb_test.py index e6791093..bf4af9df 100644 --- a/pkg/tests/deb/pkg_deb_test.py +++ b/tests/deb/pkg_deb_test.py @@ -23,7 +23,7 @@ import unittest from bazel_tools.tools.python.runfiles import runfiles -from private import archive +from pkg.private import archive class DebInspect(object): diff --git a/pkg/tests/helpers_test.py b/tests/helpers_test.py similarity index 98% rename from pkg/tests/helpers_test.py rename to tests/helpers_test.py index b47e5c3d..0e6f0051 100644 --- a/pkg/tests/helpers_test.py +++ b/tests/helpers_test.py @@ -16,7 +16,7 @@ import tempfile import unittest -from private import helpers +from pkg.private import helpers class GetFlagValueTestCase(unittest.TestCase): diff --git a/pkg/tests/install/BUILD b/tests/install/BUILD similarity index 92% rename from pkg/tests/install/BUILD rename to tests/install/BUILD index dafb5626..731a3b4a 100644 --- a/pkg/tests/install/BUILD +++ b/tests/install/BUILD @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_python//python:defs.bzl", "py_test") +load("//pkg:install.bzl", "pkg_install") +load("//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "pkg_mkdirs") load("//tests/util:defs.bzl", "fake_artifact") -load("//:mappings.bzl", "pkg_attributes", "pkg_files", "pkg_mkdirs") -load("//:install.bzl", "pkg_install") +load("@rules_python//python:defs.bzl", "py_test") py_test( name = "install_test", @@ -33,7 +33,7 @@ py_test( #"requires-fakeroot" ], deps = [ - "//private:manifest", + "//pkg/private:manifest", "@rules_python//python/runfiles", ], ) diff --git a/pkg/tests/install/test.py b/tests/install/test.py similarity index 99% rename from pkg/tests/install/test.py rename to tests/install/test.py index 824a04cf..4a491a93 100644 --- a/pkg/tests/install/test.py +++ b/tests/install/test.py @@ -22,7 +22,7 @@ import subprocess from rules_python.python.runfiles import runfiles -import private.manifest as manifest +from pkg.private import manifest class PkgInstallTest(unittest.TestCase): diff --git a/pkg/tests/is_compressed_test.py b/tests/is_compressed_test.py similarity index 100% rename from pkg/tests/is_compressed_test.py rename to tests/is_compressed_test.py diff --git a/pkg/tests/make_rpm_test.py b/tests/make_rpm_test.py similarity index 99% rename from pkg/tests/make_rpm_test.py rename to tests/make_rpm_test.py index c12af6f5..cb8608be 100644 --- a/pkg/tests/make_rpm_test.py +++ b/tests/make_rpm_test.py @@ -21,7 +21,7 @@ import os import unittest -import make_rpm +from pkg import make_rpm @contextlib.contextmanager diff --git a/pkg/tests/mappings/BUILD b/tests/mappings/BUILD similarity index 98% rename from pkg/tests/mappings/BUILD rename to tests/mappings/BUILD index bd1631e8..a120c250 100644 --- a/pkg/tests/mappings/BUILD +++ b/tests/mappings/BUILD @@ -20,7 +20,7 @@ load( ) load(":mappings_external_repo_test.bzl", "mappings_external_repo_analysis_tests") load( - "//:mappings.bzl", + "//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", diff --git a/pkg/tests/mappings/all.manifest.golden b/tests/mappings/all.manifest.golden similarity index 100% rename from pkg/tests/mappings/all.manifest.golden rename to tests/mappings/all.manifest.golden diff --git a/pkg/tests/mappings/external_repo/WORKSPACE b/tests/mappings/external_repo/WORKSPACE similarity index 100% rename from pkg/tests/mappings/external_repo/WORKSPACE rename to tests/mappings/external_repo/WORKSPACE diff --git a/pkg/tests/mappings/external_repo/pkg/BUILD b/tests/mappings/external_repo/pkg/BUILD similarity index 100% rename from pkg/tests/mappings/external_repo/pkg/BUILD rename to tests/mappings/external_repo/pkg/BUILD diff --git a/pkg/tests/mappings/external_repo/pkg/dir/extproj.sh b/tests/mappings/external_repo/pkg/dir/extproj.sh similarity index 100% rename from pkg/tests/mappings/external_repo/pkg/dir/extproj.sh rename to tests/mappings/external_repo/pkg/dir/extproj.sh diff --git a/pkg/tests/mappings/external_repo/pkg/test.bzl b/tests/mappings/external_repo/pkg/test.bzl similarity index 100% rename from pkg/tests/mappings/external_repo/pkg/test.bzl rename to tests/mappings/external_repo/pkg/test.bzl diff --git a/pkg/tests/mappings/filter_directory/BUILD b/tests/mappings/filter_directory/BUILD similarity index 98% rename from pkg/tests/mappings/filter_directory/BUILD rename to tests/mappings/filter_directory/BUILD index d4c4a6c4..46545670 100644 --- a/pkg/tests/mappings/filter_directory/BUILD +++ b/tests/mappings/filter_directory/BUILD @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_python//python:defs.bzl", "py_test") load(":defs.bzl", "inspect_directory_test") +load("//pkg:mappings.bzl", "filter_directory") load("//tests/util:defs.bzl", "directory") -load("//:mappings.bzl", "filter_directory") +load("@rules_python//python:defs.bzl", "py_test") # TODO: the below tests only check for rule success and confirmation that # directory structure matches expectations. A more thorough test implementation @@ -225,7 +225,7 @@ directory( py_test( name = "negative_tests", srcs = ["test_filter_directory.py"], - data = ["//:filter_directory"], + data = ["//pkg:filter_directory"], main = "test_filter_directory.py", deps = ["@rules_python//python/runfiles"], ) diff --git a/pkg/tests/mappings/filter_directory/defs.bzl b/tests/mappings/filter_directory/defs.bzl similarity index 100% rename from pkg/tests/mappings/filter_directory/defs.bzl rename to tests/mappings/filter_directory/defs.bzl diff --git a/pkg/tests/mappings/filter_directory/inspect_directory.py.tpl b/tests/mappings/filter_directory/inspect_directory.py.tpl similarity index 100% rename from pkg/tests/mappings/filter_directory/inspect_directory.py.tpl rename to tests/mappings/filter_directory/inspect_directory.py.tpl diff --git a/pkg/tests/mappings/filter_directory/test_filter_directory.py b/tests/mappings/filter_directory/test_filter_directory.py similarity index 99% rename from pkg/tests/mappings/filter_directory/test_filter_directory.py rename to tests/mappings/filter_directory/test_filter_directory.py index a7f62fbf..96b1220d 100644 --- a/pkg/tests/mappings/filter_directory/test_filter_directory.py +++ b/tests/mappings/filter_directory/test_filter_directory.py @@ -23,6 +23,7 @@ import sys import tempfile import unittest + from rules_python.python.runfiles import runfiles # Get the filter_directory script into the import path. There might be a @@ -31,6 +32,7 @@ rf = runfiles.Create() filter_directory_script = rf.Rlocation('/'.join([ os.environ["TEST_WORKSPACE"], + "pkg", "filter_directory" ])) diff --git a/pkg/tests/mappings/manifest_test_lib.py b/tests/mappings/manifest_test_lib.py similarity index 100% rename from pkg/tests/mappings/manifest_test_lib.py rename to tests/mappings/manifest_test_lib.py diff --git a/pkg/tests/mappings/manifest_test_main.py.tpl b/tests/mappings/manifest_test_main.py.tpl similarity index 100% rename from pkg/tests/mappings/manifest_test_main.py.tpl rename to tests/mappings/manifest_test_main.py.tpl diff --git a/pkg/tests/mappings/mappings_external_repo_test.bzl b/tests/mappings/mappings_external_repo_test.bzl similarity index 96% rename from pkg/tests/mappings/mappings_external_repo_test.bzl rename to tests/mappings/mappings_external_repo_test.bzl index 43c76ddb..3cf4e4af 100644 --- a/pkg/tests/mappings/mappings_external_repo_test.bzl +++ b/tests/mappings/mappings_external_repo_test.bzl @@ -14,11 +14,11 @@ """Tests for file mapping routines in pkg/mappings.bzl""" +load(":mappings_test.bzl", "pkg_files_contents_test") +load("//pkg:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo") +load("//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("@bazel_skylib//lib:new_sets.bzl", "sets") load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest") -load("//:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo") -load("//:mappings.bzl", "pkg_files", "strip_prefix") -load("mappings_test.bzl", "pkg_files_contents_test") ########## # pkg_files tests involving external repositories diff --git a/pkg/tests/mappings/mappings_test.bzl b/tests/mappings/mappings_test.bzl similarity index 99% rename from pkg/tests/mappings/mappings_test.bzl rename to tests/mappings/mappings_test.bzl index e8699bb8..c8da1078 100644 --- a/pkg/tests/mappings/mappings_test.bzl +++ b/tests/mappings/mappings_test.bzl @@ -14,12 +14,15 @@ """Tests for file mapping routines in pkg/mappings.bzl""" -load("@bazel_skylib//lib:new_sets.bzl", "sets") load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest") -load("@rules_python//python:defs.bzl", "py_test") -load("//:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo") load( - "//:mappings.bzl", + "@//pkg:providers.bzl", + "PackageDirsInfo", + "PackageFilegroupInfo", + "PackageFilesInfo", + "PackageSymlinkInfo",) +load( + "@//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", @@ -28,12 +31,14 @@ load( "strip_prefix", "REMOVE_BASE_DIRECTORY", ) -load("//tests/util:defs.bzl", +load("@//tests/util:defs.bzl", "directory", "fake_artifact", "generic_base_case_test", "generic_negative_test" ) +load("@bazel_skylib//lib:new_sets.bzl", "sets") +load("@rules_python//python:defs.bzl", "py_test") ########## # Helpers diff --git a/pkg/tests/mappings/testdata/a_script.sh b/tests/mappings/testdata/a_script.sh similarity index 100% rename from pkg/tests/mappings/testdata/a_script.sh rename to tests/mappings/testdata/a_script.sh diff --git a/pkg/tests/mappings/testdata/config b/tests/mappings/testdata/config similarity index 100% rename from pkg/tests/mappings/testdata/config rename to tests/mappings/testdata/config diff --git a/pkg/tests/mappings/testdata/hello.txt b/tests/mappings/testdata/hello.txt similarity index 100% rename from pkg/tests/mappings/testdata/hello.txt rename to tests/mappings/testdata/hello.txt diff --git a/pkg/tests/mappings/utf8_manifest.golden b/tests/mappings/utf8_manifest.golden similarity index 100% rename from pkg/tests/mappings/utf8_manifest.golden rename to tests/mappings/utf8_manifest.golden diff --git a/pkg/tests/my_package_name.bzl b/tests/my_package_name.bzl similarity index 94% rename from pkg/tests/my_package_name.bzl rename to tests/my_package_name.bzl index 1dc614f6..6a7febf3 100644 --- a/pkg/tests/my_package_name.bzl +++ b/tests/my_package_name.bzl @@ -14,7 +14,7 @@ """Sample rule to show package naming.""" -load("//:providers.bzl", "PackageVariablesInfo") +load("@//pkg:providers.bzl", "PackageVariablesInfo") def _my_package_naming_impl(ctx): values = {} diff --git a/pkg/tests/package_naming_aggregate_test.sh b/tests/package_naming_aggregate_test.sh similarity index 100% rename from pkg/tests/package_naming_aggregate_test.sh rename to tests/package_naming_aggregate_test.sh diff --git a/pkg/tests/path_test.bzl b/tests/path_test.bzl similarity index 96% rename from pkg/tests/path_test.bzl rename to tests/path_test.bzl index f714200e..1956822f 100644 --- a/pkg/tests/path_test.bzl +++ b/tests/path_test.bzl @@ -14,9 +14,9 @@ """Tests for path.bzl""" +load("@//pkg:mappings.bzl", "pkg_mkdirs") +load("@//pkg:path.bzl", "compute_data_path") load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest") -load("//:mappings.bzl", "pkg_mkdirs") -load("//:path.bzl", "compute_data_path") ########## # Test compute_data_path diff --git a/pkg/tests/path_test.py b/tests/path_test.py similarity index 98% rename from pkg/tests/path_test.py rename to tests/path_test.py index 100f0d47..85d133fb 100644 --- a/pkg/tests/path_test.py +++ b/tests/path_test.py @@ -19,7 +19,7 @@ import unittest -pkg_bzl = imp.load_source('pkg_bzl', 'path.bzl') +pkg_bzl = imp.load_source('pkg_bzl', 'pkg/path.bzl') Owner = collections.namedtuple('Owner', ['workspace_name', 'workspace_root']) Root = collections.namedtuple('Root', ['path']) diff --git a/pkg/tests/pkg_tar_test.py b/tests/pkg_tar_test.py similarity index 99% rename from pkg/tests/pkg_tar_test.py rename to tests/pkg_tar_test.py index f3fb3441..4181f002 100644 --- a/pkg/tests/pkg_tar_test.py +++ b/tests/pkg_tar_test.py @@ -17,7 +17,7 @@ import unittest from bazel_tools.tools.python.runfiles import runfiles -from private import archive +from pkg.private import archive PORTABLE_MTIME = 946684800 # 2000-01-01 00:00:00.000 UTC diff --git a/pkg/tests/rpm/BUILD b/tests/rpm/BUILD similarity index 98% rename from pkg/tests/rpm/BUILD rename to tests/rpm/BUILD index 8eae3932..5f1ced6b 100644 --- a/pkg/tests/rpm/BUILD +++ b/tests/rpm/BUILD @@ -13,19 +13,19 @@ # limitations under the License. # -*- coding: utf-8 -*- -load(":toolchain_tests.bzl", "create_toolchain_analysis_tests") -load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("analysis_tests.bzl", "analysis_tests") +load("toolchain_tests.bzl", "create_toolchain_analysis_tests") load( - "//:mappings.bzl", + "//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "pkg_mkdirs", "pkg_mklink", ) -load("//:rpm.bzl", "pkg_rpm") +load("//pkg:rpm.bzl", "pkg_rpm") +load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@rules_python//python:defs.bzl", "py_library", "py_test") -load(":analysis_tests.bzl", "analysis_tests") ############################################################################ # analysis tests diff --git a/pkg/tests/rpm/analysis_tests.bzl b/tests/rpm/analysis_tests.bzl similarity index 97% rename from pkg/tests/rpm/analysis_tests.bzl rename to tests/rpm/analysis_tests.bzl index 04802aa9..6b61a38a 100644 --- a/pkg/tests/rpm/analysis_tests.bzl +++ b/tests/rpm/analysis_tests.bzl @@ -14,17 +14,17 @@ """Tests for RPM generation analysis""" -load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") -load("//:rpm.bzl", "pkg_rpm") load( - "//:mappings.bzl", + "@//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "pkg_mkdirs", "pkg_mklink", ) -load("//:providers.bzl", "PackageArtifactInfo", "PackageVariablesInfo") -load("//tests/util:defs.bzl", "directory", "generic_base_case_test", "generic_negative_test") +load("@//pkg:providers.bzl", "PackageArtifactInfo", "PackageVariablesInfo") +load("@//pkg:rpm.bzl", "pkg_rpm") +load("@//tests/util:defs.bzl", "directory", "generic_base_case_test", "generic_negative_test") +load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") def _declare_pkg_rpm(name, srcs_ungrouped, tags = None, **kwargs): pfg_name = "{}_pfg".format(name) diff --git a/pkg/tests/rpm/pkg_rpm_basic_test.py b/tests/rpm/pkg_rpm_basic_test.py similarity index 100% rename from pkg/tests/rpm/pkg_rpm_basic_test.py rename to tests/rpm/pkg_rpm_basic_test.py diff --git a/pkg/tests/rpm/rpm_util.py b/tests/rpm/rpm_util.py similarity index 100% rename from pkg/tests/rpm/rpm_util.py rename to tests/rpm/rpm_util.py diff --git a/pkg/tests/rpm/source_date_epoch/BUILD b/tests/rpm/source_date_epoch/BUILD similarity index 97% rename from pkg/tests/rpm/source_date_epoch/BUILD rename to tests/rpm/source_date_epoch/BUILD index 3dc243c2..1f0b132f 100644 --- a/pkg/tests/rpm/source_date_epoch/BUILD +++ b/tests/rpm/source_date_epoch/BUILD @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//:mappings.bzl", "pkg_filegroup", "pkg_files") -load("//:rpm.bzl", "pkg_rpm") +load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files") +load("@rules_pkg//pkg:rpm.bzl", "pkg_rpm") load("@rules_python//python:defs.bzl", "py_test") ############################################################################ diff --git a/pkg/tests/rpm/source_date_epoch/epoch.txt b/tests/rpm/source_date_epoch/epoch.txt similarity index 100% rename from pkg/tests/rpm/source_date_epoch/epoch.txt rename to tests/rpm/source_date_epoch/epoch.txt diff --git a/pkg/tests/rpm/source_date_epoch/rpm_contents_vs_manifest_test.py b/tests/rpm/source_date_epoch/rpm_contents_vs_manifest_test.py similarity index 100% rename from pkg/tests/rpm/source_date_epoch/rpm_contents_vs_manifest_test.py rename to tests/rpm/source_date_epoch/rpm_contents_vs_manifest_test.py diff --git a/pkg/tests/rpm/template-test.spec.tpl b/tests/rpm/template-test.spec.tpl similarity index 100% rename from pkg/tests/rpm/template-test.spec.tpl rename to tests/rpm/template-test.spec.tpl diff --git a/pkg/tests/rpm/toolchain_tests.bzl b/tests/rpm/toolchain_tests.bzl similarity index 100% rename from pkg/tests/rpm/toolchain_tests.bzl rename to tests/rpm/toolchain_tests.bzl diff --git a/pkg/tests/rpm/tree_artifacts/BUILD b/tests/rpm/tree_artifacts/BUILD similarity index 98% rename from pkg/tests/rpm/tree_artifacts/BUILD rename to tests/rpm/tree_artifacts/BUILD index 21683bf6..c6923250 100644 --- a/pkg/tests/rpm/tree_artifacts/BUILD +++ b/tests/rpm/tree_artifacts/BUILD @@ -12,17 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//tests/util:defs.bzl", "directory") load( - "//:mappings.bzl", + "@//pkg:mappings.bzl", "REMOVE_BASE_DIRECTORY", "pkg_attributes", "pkg_filegroup", "pkg_files", "strip_prefix", ) - -load("//:rpm.bzl", "pkg_rpm") +load("@//pkg:rpm.bzl", "pkg_rpm") +load("@//tests/util:defs.bzl", "directory") load("@rules_python//python:defs.bzl", "py_test") ############################################################################ diff --git a/pkg/tests/rpm/tree_artifacts/rpm_contents_vs_manifest_test.py b/tests/rpm/tree_artifacts/rpm_contents_vs_manifest_test.py similarity index 100% rename from pkg/tests/rpm/tree_artifacts/rpm_contents_vs_manifest_test.py rename to tests/rpm/tree_artifacts/rpm_contents_vs_manifest_test.py diff --git a/pkg/tests/rpm/tree_artifacts/rpm_treeartifact_ops_test.py b/tests/rpm/tree_artifacts/rpm_treeartifact_ops_test.py similarity index 100% rename from pkg/tests/rpm/tree_artifacts/rpm_treeartifact_ops_test.py rename to tests/rpm/tree_artifacts/rpm_treeartifact_ops_test.py diff --git a/pkg/tests/stamp_test.py b/tests/stamp_test.py similarity index 100% rename from pkg/tests/stamp_test.py rename to tests/stamp_test.py diff --git a/pkg/tests/testdata/a.ar b/tests/testdata/a.ar similarity index 100% rename from pkg/tests/testdata/a.ar rename to tests/testdata/a.ar diff --git a/pkg/tests/testdata/a_ab.ar b/tests/testdata/a_ab.ar similarity index 100% rename from pkg/tests/testdata/a_ab.ar rename to tests/testdata/a_ab.ar diff --git a/pkg/tests/testdata/a_b.ar b/tests/testdata/a_b.ar similarity index 100% rename from pkg/tests/testdata/a_b.ar rename to tests/testdata/a_b.ar diff --git a/pkg/tests/testdata/a_b_ab.ar b/tests/testdata/a_b_ab.ar similarity index 100% rename from pkg/tests/testdata/a_b_ab.ar rename to tests/testdata/a_b_ab.ar diff --git a/pkg/tests/testdata/ab.ar b/tests/testdata/ab.ar similarity index 100% rename from pkg/tests/testdata/ab.ar rename to tests/testdata/ab.ar diff --git a/pkg/tests/testdata/b.ar b/tests/testdata/b.ar similarity index 100% rename from pkg/tests/testdata/b.ar rename to tests/testdata/b.ar diff --git a/pkg/tests/testdata/config b/tests/testdata/config similarity index 100% rename from pkg/tests/testdata/config rename to tests/testdata/config diff --git a/pkg/tests/testdata/deb_preinst b/tests/testdata/deb_preinst similarity index 100% rename from pkg/tests/testdata/deb_preinst rename to tests/testdata/deb_preinst diff --git a/pkg/tests/testdata/deb_triggers b/tests/testdata/deb_triggers similarity index 100% rename from pkg/tests/testdata/deb_triggers rename to tests/testdata/deb_triggers diff --git a/pkg/tests/testdata/empty.ar b/tests/testdata/empty.ar similarity index 100% rename from pkg/tests/testdata/empty.ar rename to tests/testdata/empty.ar diff --git a/pkg/tests/testdata/executable.sh b/tests/testdata/executable.sh similarity index 100% rename from pkg/tests/testdata/executable.sh rename to tests/testdata/executable.sh diff --git a/pkg/tests/testdata/file_with_a_ridiculously_long_name_consectetur_adipiscing_elit_fusce_laoreet_lorem_neque_sed_pharetra_erat.txt b/tests/testdata/file_with_a_ridiculously_long_name_consectetur_adipiscing_elit_fusce_laoreet_lorem_neque_sed_pharetra_erat.txt similarity index 100% rename from pkg/tests/testdata/file_with_a_ridiculously_long_name_consectetur_adipiscing_elit_fusce_laoreet_lorem_neque_sed_pharetra_erat.txt rename to tests/testdata/file_with_a_ridiculously_long_name_consectetur_adipiscing_elit_fusce_laoreet_lorem_neque_sed_pharetra_erat.txt diff --git a/pkg/tests/testdata/hello.txt b/tests/testdata/hello.txt similarity index 100% rename from pkg/tests/testdata/hello.txt rename to tests/testdata/hello.txt diff --git a/pkg/tests/testdata/loremipsum.txt b/tests/testdata/loremipsum.txt similarity index 100% rename from pkg/tests/testdata/loremipsum.txt rename to tests/testdata/loremipsum.txt diff --git a/pkg/tests/testdata/tar_test.tar b/tests/testdata/tar_test.tar similarity index 100% rename from pkg/tests/testdata/tar_test.tar rename to tests/testdata/tar_test.tar diff --git a/pkg/tests/testdata/tar_test.tar.bz2 b/tests/testdata/tar_test.tar.bz2 similarity index 100% rename from pkg/tests/testdata/tar_test.tar.bz2 rename to tests/testdata/tar_test.tar.bz2 diff --git a/pkg/tests/testdata/tar_test.tar.gz b/tests/testdata/tar_test.tar.gz similarity index 100% rename from pkg/tests/testdata/tar_test.tar.gz rename to tests/testdata/tar_test.tar.gz diff --git a/pkg/tests/testdata/tar_test.tar.xz b/tests/testdata/tar_test.tar.xz similarity index 100% rename from pkg/tests/testdata/tar_test.tar.xz rename to tests/testdata/tar_test.tar.xz diff --git a/pkg/tests/testdata/templates b/tests/testdata/templates similarity index 100% rename from pkg/tests/testdata/templates rename to tests/testdata/templates diff --git a/pkg/tests/testdata/test_tar_package_dir_file.txt b/tests/testdata/test_tar_package_dir_file.txt similarity index 100% rename from pkg/tests/testdata/test_tar_package_dir_file.txt rename to tests/testdata/test_tar_package_dir_file.txt diff --git a/pkg/tests/testdata/utf8/1-a b/tests/testdata/utf8/1-a similarity index 100% rename from pkg/tests/testdata/utf8/1-a rename to tests/testdata/utf8/1-a diff --git "a/pkg/tests/testdata/utf8/2-\316\273" "b/tests/testdata/utf8/2-\316\273" similarity index 100% rename from "pkg/tests/testdata/utf8/2-\316\273" rename to "tests/testdata/utf8/2-\316\273" diff --git "a/pkg/tests/testdata/utf8/3-\344\270\226" "b/tests/testdata/utf8/3-\344\270\226" similarity index 100% rename from "pkg/tests/testdata/utf8/3-\344\270\226" rename to "tests/testdata/utf8/3-\344\270\226" diff --git a/pkg/tests/testdata/utf8/BUILD b/tests/testdata/utf8/BUILD similarity index 100% rename from pkg/tests/testdata/utf8/BUILD rename to tests/testdata/utf8/BUILD diff --git "a/pkg/tests/testdata/utf8/s\303\274bdir/2-\316\273" "b/tests/testdata/utf8/s\303\274bdir/2-\316\273" similarity index 100% rename from "pkg/tests/testdata/utf8/s\303\274bdir/2-\316\273" rename to "tests/testdata/utf8/s\303\274bdir/2-\316\273" diff --git "a/pkg/tests/testdata/utf8/s\303\274bdir/hello" "b/tests/testdata/utf8/s\303\274bdir/hello" similarity index 100% rename from "pkg/tests/testdata/utf8/s\303\274bdir/hello" rename to "tests/testdata/utf8/s\303\274bdir/hello" diff --git a/pkg/tests/util/BUILD b/tests/util/BUILD similarity index 100% rename from pkg/tests/util/BUILD rename to tests/util/BUILD diff --git a/pkg/tests/util/create_directory_with_contents.py b/tests/util/create_directory_with_contents.py similarity index 100% rename from pkg/tests/util/create_directory_with_contents.py rename to tests/util/create_directory_with_contents.py diff --git a/pkg/tests/util/defs.bzl b/tests/util/defs.bzl similarity index 98% rename from pkg/tests/util/defs.bzl rename to tests/util/defs.bzl index 69024d38..3c60c835 100644 --- a/pkg/tests/util/defs.bzl +++ b/tests/util/defs.bzl @@ -14,9 +14,9 @@ """Rules to aid testing""" +load("@//pkg/private:pkg_files.bzl", "add_label_list", "write_manifest") load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") load("@rules_python//python:defs.bzl", "py_binary") -load("//private:pkg_files.bzl", "add_label_list", "write_manifest") def _directory_impl(ctx): out_dir_file = ctx.actions.declare_directory(ctx.attr.outdir or ctx.attr.name) diff --git a/pkg/tests/util/md5.py b/tests/util/md5.py similarity index 100% rename from pkg/tests/util/md5.py rename to tests/util/md5.py diff --git a/pkg/tests/zip_test.py b/tests/zip_test.py similarity index 100% rename from pkg/tests/zip_test.py rename to tests/zip_test.py diff --git a/pkg/toolchains/BUILD b/toolchains/BUILD similarity index 100% rename from pkg/toolchains/BUILD rename to toolchains/BUILD diff --git a/pkg/toolchains/BUILD.tpl b/toolchains/BUILD.tpl similarity index 100% rename from pkg/toolchains/BUILD.tpl rename to toolchains/BUILD.tpl diff --git a/pkg/toolchains/git/BUILD b/toolchains/git/BUILD similarity index 100% rename from pkg/toolchains/git/BUILD rename to toolchains/git/BUILD diff --git a/pkg/toolchains/git/BUILD.tpl b/toolchains/git/BUILD.tpl similarity index 100% rename from pkg/toolchains/git/BUILD.tpl rename to toolchains/git/BUILD.tpl diff --git a/pkg/toolchains/git/git.bzl b/toolchains/git/git.bzl similarity index 100% rename from pkg/toolchains/git/git.bzl rename to toolchains/git/git.bzl diff --git a/pkg/toolchains/git/git_configure.bzl b/toolchains/git/git_configure.bzl similarity index 100% rename from pkg/toolchains/git/git_configure.bzl rename to toolchains/git/git_configure.bzl diff --git a/pkg/toolchains/rpmbuild.bzl b/toolchains/rpmbuild.bzl similarity index 100% rename from pkg/toolchains/rpmbuild.bzl rename to toolchains/rpmbuild.bzl diff --git a/pkg/toolchains/rpmbuild_configure.bzl b/toolchains/rpmbuild_configure.bzl similarity index 100% rename from pkg/toolchains/rpmbuild_configure.bzl rename to toolchains/rpmbuild_configure.bzl