rules_pkg/deps.bzl

26 lines
962 B
Python
Raw Permalink Normal View History

Ensure that pkg_rpm tests can run on macOS if rpm(build) is present (#324) The experimental `pkg_rpm` tests make use of CSV manifests. An important part of this is verifying file consistency. For this, among other things, we capture MD5 checksums of expected package contents, and compare them to the outputs from a formatted RPM query. The tool initially used for this is `md5sum` from GNU coreutils. macOS (and Windows) do not have this utility by default; in particular, macOS has a `md5` tool that does essentially the same thing. To allow RPM tests to run on platforms without GNU coreutils, this change adds in a simple cross-platform MD5 hashing tool written with Python, and replaces all instances of `md5sum` with it. Additionally, when running tests locally, I encountered an issue with macOS symbolic link permissions. In macOS (and presumably other BSDs), symlinks can have a mode set directly on them, whereas in Linux, symlink permissions are not applicable and can't even be set. To fix this on non-Linux OSes, I assume that we have the BSD `chmod` tool with the `-h` flag that can set symbolic link permissions directly. This is inserted into the `%install` script as a macro; Linux users of `rpmbuild` will not observe changes to RPM outputs. The above is likely not true when `rpmbuild` is run in MinGW and Cygwin, which almost certainly use GNU coreutils. We'll cross that bridge when we get to it. See also #323. This does not attempt to do anything with allowing RPM tests to run on CI. Tests were run locally on a system running macOS 11.2 (Big Sur). Fixes #255.
2021-04-06 16:07:05 +00:00
# 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.
This is for backwards compatibility with existing usage. Please use
load("//pkg:deps.bzl", "rules_pkg_dependencies")
going forward.
"""
Ensure that pkg_rpm tests can run on macOS if rpm(build) is present (#324) The experimental `pkg_rpm` tests make use of CSV manifests. An important part of this is verifying file consistency. For this, among other things, we capture MD5 checksums of expected package contents, and compare them to the outputs from a formatted RPM query. The tool initially used for this is `md5sum` from GNU coreutils. macOS (and Windows) do not have this utility by default; in particular, macOS has a `md5` tool that does essentially the same thing. To allow RPM tests to run on platforms without GNU coreutils, this change adds in a simple cross-platform MD5 hashing tool written with Python, and replaces all instances of `md5sum` with it. Additionally, when running tests locally, I encountered an issue with macOS symbolic link permissions. In macOS (and presumably other BSDs), symlinks can have a mode set directly on them, whereas in Linux, symlink permissions are not applicable and can't even be set. To fix this on non-Linux OSes, I assume that we have the BSD `chmod` tool with the `-h` flag that can set symbolic link permissions directly. This is inserted into the `%install` script as a macro; Linux users of `rpmbuild` will not observe changes to RPM outputs. The above is likely not true when `rpmbuild` is run in MinGW and Cygwin, which almost certainly use GNU coreutils. We'll cross that bridge when we get to it. See also #323. This does not attempt to do anything with allowing RPM tests to run on CI. Tests were run locally on a system running macOS 11.2 (Big Sur). Fixes #255.
2021-04-06 16:07:05 +00:00
load("//pkg:deps.bzl", _rules_pkg_dependencies = "rules_pkg_dependencies")
Ensure that pkg_rpm tests can run on macOS if rpm(build) is present (#324) The experimental `pkg_rpm` tests make use of CSV manifests. An important part of this is verifying file consistency. For this, among other things, we capture MD5 checksums of expected package contents, and compare them to the outputs from a formatted RPM query. The tool initially used for this is `md5sum` from GNU coreutils. macOS (and Windows) do not have this utility by default; in particular, macOS has a `md5` tool that does essentially the same thing. To allow RPM tests to run on platforms without GNU coreutils, this change adds in a simple cross-platform MD5 hashing tool written with Python, and replaces all instances of `md5sum` with it. Additionally, when running tests locally, I encountered an issue with macOS symbolic link permissions. In macOS (and presumably other BSDs), symlinks can have a mode set directly on them, whereas in Linux, symlink permissions are not applicable and can't even be set. To fix this on non-Linux OSes, I assume that we have the BSD `chmod` tool with the `-h` flag that can set symbolic link permissions directly. This is inserted into the `%install` script as a macro; Linux users of `rpmbuild` will not observe changes to RPM outputs. The above is likely not true when `rpmbuild` is run in MinGW and Cygwin, which almost certainly use GNU coreutils. We'll cross that bridge when we get to it. See also #323. This does not attempt to do anything with allowing RPM tests to run on CI. Tests were run locally on a system running macOS 11.2 (Big Sur). Fixes #255.
2021-04-06 16:07:05 +00:00
rules_pkg_dependencies = _rules_pkg_dependencies
Ensure that pkg_rpm tests can run on macOS if rpm(build) is present (#324) The experimental `pkg_rpm` tests make use of CSV manifests. An important part of this is verifying file consistency. For this, among other things, we capture MD5 checksums of expected package contents, and compare them to the outputs from a formatted RPM query. The tool initially used for this is `md5sum` from GNU coreutils. macOS (and Windows) do not have this utility by default; in particular, macOS has a `md5` tool that does essentially the same thing. To allow RPM tests to run on platforms without GNU coreutils, this change adds in a simple cross-platform MD5 hashing tool written with Python, and replaces all instances of `md5sum` with it. Additionally, when running tests locally, I encountered an issue with macOS symbolic link permissions. In macOS (and presumably other BSDs), symlinks can have a mode set directly on them, whereas in Linux, symlink permissions are not applicable and can't even be set. To fix this on non-Linux OSes, I assume that we have the BSD `chmod` tool with the `-h` flag that can set symbolic link permissions directly. This is inserted into the `%install` script as a macro; Linux users of `rpmbuild` will not observe changes to RPM outputs. The above is likely not true when `rpmbuild` is run in MinGW and Cygwin, which almost certainly use GNU coreutils. We'll cross that bridge when we get to it. See also #323. This does not attempt to do anything with allowing RPM tests to run on CI. Tests were run locally on a system running macOS 11.2 (Big Sur). Fixes #255.
2021-04-06 16:07:05 +00:00
def rules_pkg_register_toolchains():
pass