Skip to content

Commit

Permalink
image: include files from git reproducibly
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Dec 19, 2024
1 parent ba0b252 commit 0747305
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
12 changes: 4 additions & 8 deletions image/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")

filegroup(
name = "sysroot_tree",
srcs = glob(["sysroot-tree/**"]),
)
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")

pkg_files(
name = "sysroot",
srcs = [":sysroot_tree"],
strip_prefix = strip_prefix.from_pkg() + "sysroot-tree",
srcs = glob(["sysroot-tree/**"]),
attributes = pkg_attributes(mode = "0555"),
strip_prefix = strip_prefix.from_pkg("sysroot-tree"),
visibility = ["//visibility:public"],
)

Expand Down
18 changes: 15 additions & 3 deletions image/base/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")
load("//bazel/mkosi:mkosi_image.bzl", "mkosi_image")

copy_to_directory(
Expand Down Expand Up @@ -33,9 +34,7 @@ copy_to_directory(
"mkosi.finalize",
"mkosi.postinst",
"mkosi.prepare",
] + glob([
"mkosi.skeleton/**",
]),
],
outs = [
kernel_variant,
kernel_variant + ".tar",
Expand All @@ -46,6 +45,7 @@ copy_to_directory(
kernel_variant + "-rpmdb.sqlite-wal",
],
extra_trees = [
":skeleton",
"//image:sysroot_tar",
"//image:cryptsetup_closure",
],
Expand Down Expand Up @@ -86,3 +86,15 @@ pkg_tar(
tags = ["manual"],
visibility = ["//visibility:public"],
)

pkg_files(
name = "skeleton_files",
srcs = glob(["mkosi.skeleton/**"]),
attributes = pkg_attributes(mode = "0555"),
strip_prefix = strip_prefix.from_pkg("mkosi.skeleton"),
)

pkg_tar(
name = "skeleton",
srcs = [":skeleton_files"],
)
19 changes: 16 additions & 3 deletions image/initrd/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")
load("//bazel/mkosi:mkosi_image.bzl", "mkosi_image")

mkosi_image(
name = "initrd",
srcs = [
"mkosi.postinst",
] + glob([
"mkosi.skeleton/**",
]),
],
outs = [
"image",
"image.cpio.zst",
],
extra_trees = [
":skeleton",
"//image:sysroot_tar",
"//image:cryptsetup_closure",
"//disk-mapper/cmd:disk-mapper-package.tar",
Expand All @@ -24,3 +25,15 @@ mkosi_image(
],
visibility = ["//visibility:public"],
)

pkg_files(
name = "skeleton_files",
srcs = glob(["mkosi.skeleton/**"]),
attributes = pkg_attributes(mode = "0555"),
strip_prefix = strip_prefix.from_pkg("mkosi.skeleton"),
)

pkg_tar(
name = "skeleton",
srcs = [":skeleton_files"],
)

0 comments on commit 0747305

Please sign in to comment.