Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bazel/rules_squashfs
1 result
Show changes
Commits on Source (14)
Showing with 3689 additions and 19602 deletions
# Enable `bzlmod`
common --enable_bzlmod
# Build cache
build --experimental_guard_against_concurrent_changes
......
......@@ -16,9 +16,6 @@ common --show_timestamps
# Do not wrap any output
common --terminal_columns=0
# Print relative paths where possible to reduce noise
common --attempt_to_print_relative_paths
# Output as much information in the CI log about failures as possible
build --verbose_failures
......@@ -28,6 +25,9 @@ test --test_output=errors
# Output as much information when a test exceeds a timeout
test --test_verbose_timeout_warnings
# Validate that the lockfile is correct
common --lockfile_mode=error
# These locations are cached on the CI
build:local --disk_cache=${CI_PROJECT_DIR}/.cache/bazel/disk
build:local --repository_cache=${CI_PROJECT_DIR}/.cache/bazel/repo
......
7.0.0
7.3.1
include:
- component: "${CI_SERVER_HOST}/ci/component/bazelisk/bazelisk@v1.0.0-beta.3"
- component: "${CI_SERVER_HOST}/ci/component/bazelisk/bazelisk@v1.0.0-beta.4"
inputs:
variables: |
CI_PROJECT_DIR
......@@ -21,6 +21,12 @@ default:
test:
extends: .bazelisk
cache:
- !reference [.bazelisk, cache]
- key: "bazel-cache-${CI_PROJECT_ID}"
paths:
- ".cache/bazel/disk"
- ".cache/bazel/repo"
parallel:
matrix:
- ROOT:
......@@ -28,10 +34,10 @@ test:
- e2e
CONFIG:
- local
# TODO: fix up remote compilation with `zig`
# FIXME: `zig` compilation on remote
# - remote
script:
- cd "${ROOT}"; bazelisk test --config="${CONFIG}" //...
- cd "${ROOT}"; bazelisk test --config="${CONFIG}" ...
# TODO: switch this out for `rules_semantic_release`
semantic-release:
......
# [1.0.0-alpha.3](https://git.gitlab.arm.com/bazel/rules_squashfs/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2024-09-13)
### Bug Fixes
- **tar:** lazily unpack `srcs` ([2f0ddea](https://git.gitlab.arm.com/bazel/rules_squashfs/commit/2f0ddea417140b8e62e3ed6850e43bd5423716ce))
### Features
- **tar:** support `gzip`/`bzip2`/`xz`/`zstd` compressed `tar` files ([90b8a82](https://git.gitlab.arm.com/bazel/rules_squashfs/commit/90b8a827d8faa70542af2ea01c7b136bb1966836))
# [1.0.0-alpha.2](https://git.gitlab.arm.com/bazel/rules_squashfs/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2024-05-09)
### Bug Fixes
......
module(
name = "rules_squashfs",
version = "1.0.0-alpha.2",
version = "1.0.0-alpha.3",
bazel_compatibility = [
">=7.0.0",
],
compatibility_level = 1,
)
bazel_dep(name = "rules_coreutils", version = "1.0.0-beta.1")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.9")
bazel_dep(name = "rules_coreutils", version = "1.0.0-beta.6")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.13")
bazel_dep(name = "squashfs-tools", version = "4.6.1")
bazel_dep(name = "rules_gzip", version = "1.0.0-beta.1")
bazel_dep(name = "rules_bzip2", version = "1.0.0-beta.1")
bazel_dep(name = "rules_xz", version = "1.0.0-beta.1")
bazel_dep(name = "rules_zstd", version = "1.0.0-beta.1")
bazel_dep(name = "hermetic_cc_toolchain", version = "3.0.0", dev_dependency = True)
......
This diff is collapsed.
# Enable `bzlmod`
common --enable_bzlmod
# Build cache
build --experimental_guard_against_concurrent_changes
......
......@@ -16,9 +16,6 @@ common --show_timestamps
# Do not wrap any output
common --terminal_columns=0
# Print relative paths where possible to reduce noise
common --attempt_to_print_relative_paths
# Output as much information in the CI log about failures as possible
build --verbose_failures
......@@ -28,6 +25,9 @@ test --test_output=errors
# Output as much information when a test exceeds a timeout
test --test_verbose_timeout_warnings
# Validate that the lockfile is correct
common --lockfile_mode=error
# These locations are cached on the CI
build:local --disk_cache=${CI_PROJECT_DIR}/.cache/bazel/disk
build:local --repository_cache=${CI_PROJECT_DIR}/.cache/bazel/repo
......
7.0.0
7.3.1
......@@ -5,15 +5,18 @@ module(
],
)
bazel_dep(name = "rules_gzip", version = "1.0.0-beta.1")
bazel_dep(name = "rules_bzip2", version = "1.0.0-beta.1")
bazel_dep(name = "rules_xz", version = "1.0.0-beta.1")
bazel_dep(name = "rules_zstd", version = "1.0.0-beta.1")
bazel_dep(name = "rules_diff", version = "1.0.0-beta.3")
bazel_dep(name = "rules_squashfs", version = "0.0.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.13")
bazel_dep(name = "rules_coreutils", version = "1.0.0-beta.6")
bazel_dep(name = "rules_squashfs")
local_path_override(
module_name = "rules_squashfs",
path = "..",
)
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.9")
bazel_dep(name = "rules_coreutils", version = "1.0.0-beta.1")
bazel_dep(name = "hermetic_cc_toolchain", version = "3.0.0", dev_dependency = True)
This diff is collapsed.
load("//fixture/directory:defs.bzl", "fixture_directory")
load("@rules_squashfs//squashfs/unpack:defs.bzl", "squashfs_unpack")
load("@rules_squashfs//squashfs/tar:defs.bzl", "squashfs_tar")
load("@rules_diff//diff/directory/test:defs.bzl", "diff_directory_test")
......
load("@rules_squashfs//squashfs/unpack:defs.bzl", "squashfs_unpack")
load("@rules_squashfs//squashfs/tar:defs.bzl", "squashfs_tar")
load("@rules_bzip2//bzip2/compress:defs.bzl", "bzip2_compress")
load("@rules_diff//diff/directory/test:defs.bzl", "diff_directory_test")
bzip2_compress(
name = "compressed",
src = "//fixture/nested:tar",
)
squashfs_tar(
name = "squashed",
srcs = [
":compressed",
],
)
squashfs_unpack(
name = "unpacked",
testonly = True,
src = ":squashed",
)
diff_directory_test(
name = "diff",
size = "small",
a = "//fixture/directory:extract",
b = ":unpacked",
)
load("@rules_squashfs//squashfs/unpack:defs.bzl", "squashfs_unpack")
load("@rules_squashfs//squashfs/tar:defs.bzl", "squashfs_tar")
load("@rules_gzip//gzip/compress:defs.bzl", "gzip_compress")
load("@rules_diff//diff/directory/test:defs.bzl", "diff_directory_test")
gzip_compress(
name = "compressed",
src = "//fixture/nested:tar",
)
squashfs_tar(
name = "squashed",
srcs = [
":compressed",
],
)
squashfs_unpack(
name = "unpacked",
testonly = True,
src = ":squashed",
)
diff_directory_test(
name = "diff",
size = "small",
a = "//fixture/directory:extract",
b = ":unpacked",
)
load("@rules_squashfs//squashfs/unpack:defs.bzl", "squashfs_unpack")
load("@rules_squashfs//squashfs/tar:defs.bzl", "squashfs_tar")
load("@rules_xz//xz/compress:defs.bzl", "xz_compress")
load("@rules_diff//diff/directory/test:defs.bzl", "diff_directory_test")
xz_compress(
name = "compressed",
src = "//fixture/nested:tar",
)
squashfs_tar(
name = "squashed",
srcs = [
":compressed",
],
)
squashfs_unpack(
name = "unpacked",
testonly = True,
src = ":squashed",
)
diff_directory_test(
name = "diff",
size = "small",
a = "//fixture/directory:extract",
b = ":unpacked",
)
load("@rules_squashfs//squashfs/unpack:defs.bzl", "squashfs_unpack")
load("@rules_squashfs//squashfs/tar:defs.bzl", "squashfs_tar")
load("@rules_zstd//zstd/compress:defs.bzl", "zstd_compress")
load("@rules_diff//diff/directory/test:defs.bzl", "diff_directory_test")
zstd_compress(
name = "compressed",
src = "//fixture/nested:tar",
)
squashfs_tar(
name = "squashed",
srcs = [
":compressed",
],
)
squashfs_unpack(
name = "unpacked",
testonly = True,
src = ":squashed",
)
diff_directory_test(
name = "diff",
size = "small",
a = "//fixture/directory:extract",
b = ":unpacked",
)
......@@ -8,7 +8,11 @@ set -o pipefail
# Bazel substitutions
SQFSTAR="{{sqfstar}}"
CAT="{{cat}}"
readonly SQFSTAR CAT
GZIP="{{gzip}}"
BZIP2="{{bzip2}}"
XZ="{{xz}}"
ZSTD="{{zstd}}"
readonly SQFSTAR CAT GZIP BZIP2 XZ ZSTD
# Runfiles location
function rlocation() (
......@@ -22,7 +26,7 @@ function rlocation() (
declare -a TARS
while true; do
case "${1}" in
*".tar")
*".tar" | *".tar.gz" | *".tar.bz2" | *".tar.xz" | *".tar.zst")
TARS+=("$(rlocation "${1}")")
shift
continue
......@@ -34,6 +38,28 @@ while true; do
done
# Perform the difference
echo "${@}"
"${CAT}" "${TARS[@]}" |
"${SQFSTAR}" "${@}"
{
for TAR in "${TARS[@]}"; do
case "${TAR}" in
*".tar")
"${CAT}" "${TAR}"
;;
*".tar.gz")
"${GZIP}" -fcd "${TAR}"
;;
*".tar.bz2")
"${BZIP2}" -fcd "${TAR}"
;;
*".tar.xz")
"${XZ}" -fcd "${TAR}"
;;
*".tar.zst")
"${ZSTD}" -fcd "${TAR}"
;;
*)
echo >&2 "Unsupported: ${TAR}"
exit 2
;;
esac
done
} | "${SQFSTAR}" "${@}"
......@@ -20,7 +20,7 @@ squashfs_tar(
ATTRS = {
"srcs": attr.label_list(
doc = "The `.tar` archives to squashify.",
allow_files = [".tar"], # TODO: support compressed archives
allow_files = [".tar", ".tar.gz", ".tar.bz2", ".tar.xz", ".tar.zst"],
mandatory = True,
),
"compression": attr.label(
......@@ -49,13 +49,17 @@ def _resources(os, inputs):
def implementation(ctx):
sqfstar = ctx.toolchains["//squashfs/toolchain/sqfstar:type"]
cat = ctx.toolchains["@rules_coreutils//coreutils/toolchain/cat:type"]
gzip = ctx.toolchains["@rules_gzip//gzip/toolchain/pigz:type"]
bzip2 = ctx.toolchains["@rules_bzip2//bzip2/toolchain/bzip2:type"]
xz = ctx.toolchains["@rules_xz//xz/toolchain/xz:type"]
zstd = ctx.toolchains["@rules_zstd//zstd/toolchain/zstd:type"]
squashed = ctx.actions.declare_file("{}.squashfs".format(ctx.label.name))
inputs = [] + ctx.files.srcs
inputs = depset(transitive = [s[DefaultInfo].files for s in ctx.attr.srcs])
args = ctx.actions.args()
args.add_all(ctx.files.srcs)
args.add_all(inputs)
args.add("-exit-on-error")
args.add("-no-progress")
args.add("-quiet")
......@@ -84,27 +88,31 @@ def implementation(ctx):
if ctx.file.exclude:
args.add("-ef").add(ctx.file.exclude.path)
inputs.append(ctx.file.exclude)
inputs = depset([ctx.file.exclude], transitive = [inputs])
args.add(squashed.path)
rendered = ctx.actions.declare_file("{}.rendered.{}".format(ctx.label.name, ctx.file.template.extension))
substitutions = ctx.actions.template_dict()
substitutions.add("{{sqfstar}}", sqfstar.executable.path)
substitutions.add("{{cat}}", cat.executable.path)
substitutions.add("{{gzip}}", gzip.executable.path)
substitutions.add("{{bzip2}}", bzip2.executable.path)
substitutions.add("{{xz}}", xz.executable.path)
substitutions.add("{{zstd}}", zstd.executable.path)
ctx.actions.expand_template(
output = rendered,
template = ctx.file.template,
is_executable = True,
substitutions = {
"{{sqfstar}}": sqfstar.executable.path,
"{{cat}}": cat.executable.path,
},
computed_substitutions = substitutions,
)
inputs.append(rendered)
inputs = depset([rendered], transitive = [inputs])
ctx.actions.run(
outputs = [squashed],
inputs = inputs,
executable = rendered,
tools = [sqfstar.run, cat.run],
tools = [sqfstar.run, cat.run, gzip.run, bzip2.run, xz.run, zstd.run],
arguments = [args],
mnemonic = "SquashfsTar",
progress_message = "squashing tars into %{output}",
......@@ -119,6 +127,10 @@ tar = rule(
implementation = implementation,
toolchains = [
"@rules_coreutils//coreutils/toolchain/cat:type",
"@rules_gzip//gzip/toolchain/pigz:type",
"@rules_bzip2//bzip2/toolchain/bzip2:type",
"@rules_xz//xz/toolchain/xz:type",
"@rules_zstd//zstd/toolchain/zstd:type",
"//squashfs/toolchain/sqfstar:type",
],
)
......@@ -15,7 +15,7 @@ toolchain(
toolchain_info(
name = "mksquashfs",
target = "@squashfs-tools//:mksquashfs"
target = "@squashfs-tools//:mksquashfs",
)
toolchain(
......@@ -24,7 +24,6 @@ toolchain(
toolchain_type = ":type",
)
alias(
name = "resolved",
actual = "@resolved-mksquashfs",
......