Skip to content

Commit 69de202

Browse files
committed
Add version number to bb_clientd.deb
... and skip asking for reboot if just upgrading during dpkg installation.
1 parent 86a4ceb commit 69de202

File tree

7 files changed

+46
-28
lines changed

7 files changed

+46
-28
lines changed

.bazelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
build --host_cxxopt=-std=c++17
2-
run --workspace_status_command="bash tools/workspace-status.sh"
2+
build --workspace_status_command="bash tools/workspace-status.sh"

.github/workflows/master.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
},
193193
{
194194
"name": "linux_amd64: build bb_clientd.deb",
195-
"run": "bazel build --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb"
195+
"run": "bazel build --stamp --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb"
196196
},
197197
{
198198
"name": "linux_amd64: copy bb_clientd.deb",

BUILD.bazel

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
12
load("@gazelle//:def.bzl", "gazelle")
23
load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar")
34

@@ -35,15 +36,29 @@ pkg_tar(
3536
},
3637
)
3738

39+
# When built with --stamp, creates a non-deterministic output file for pushing images to a remote registry.
40+
# With --nostamp, produces a deterministic output so dependents get cache hits.
41+
expand_template(
42+
name = "deb_version_file",
43+
out = "_deb_version.txt",
44+
stamp_substitutions = {"_TAG_": "{{BUILD_SCM_TIMESTAMP}}-{{BUILD_SCM_REVISION}}"},
45+
substitutions = {"_TAG_": "0~unknown"},
46+
template = ["_TAG_"],
47+
visibility = ["//visibility:public"],
48+
)
49+
3850
pkg_deb(
3951
name = "bb_clientd_deb",
40-
architecture = "amd64",
52+
architecture = select({
53+
"@platforms//cpu:x86_64": "amd64",
54+
}),
4155
data = ":bb_clientd_deb_data",
4256
depends = ["fuse"],
4357
description = "The Buildbarn client daemon",
4458
homepage = "https://github.com/buildbarn/bb-clientd",
4559
maintainer = "The Buildbarn team",
4660
package = "bb-clientd",
61+
package_file_name = "bb-clientd.deb",
4762
postinst = "configs/linux/postinst.sh",
48-
version = "0.0.0",
63+
version_file = ":deb_version_file",
4964
)

MODULE.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
module(name = "com_github_buildbarn_bb_clientd")
22

3+
bazel_dep(name = "aspect_bazel_lib", version = "2.14.0")
34
bazel_dep(name = "bazel_remote_apis", version = "0.0.0")
45
bazel_dep(name = "com_github_buildbarn_bb_remote_execution")
56
bazel_dep(name = "com_github_buildbarn_bb_storage")
67
bazel_dep(name = "com_github_buildbarn_go_xdr")
78
bazel_dep(name = "gazelle", version = "0.42.0")
89
bazel_dep(name = "jsonnet_go", version = "0.20.0")
10+
bazel_dep(name = "platforms", version = "0.0.11")
911
bazel_dep(name = "protobuf", version = "29.3")
1012
bazel_dep(name = "rules_jsonnet", version = "0.6.0")
1113
bazel_dep(name = "rules_go", version = "0.53.0")

MODULE.bazel.lock

+11-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configs/linux/postinst.sh

+13-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ else
1313
# Restarting systemd-logind.service effectively kills user sessions and the
1414
# users' desktop environment, so let the user get a hint about reboot
1515
# instead.
16-
/usr/share/update-notifier/notify-reboot-required
17-
if [ -e /var/run/reboot-required ]; then
18-
cat /var/run/reboot-required
16+
if [ "$#" -ge 2 ] && [ "$1" = "configure" ]; then
17+
old_version=$2
18+
else
19+
old_version=""
20+
fi
21+
# In the future, the old version can determain if reboot is required:
22+
# if dpkg --compare-versions "$old_version" lt "20250312T094712Z-2b641c6"; then
23+
if [ -z "$old_version" ]; then
24+
/usr/share/update-notifier/notify-reboot-required
25+
if [ -e /var/run/reboot-required ]; then
26+
cat /var/run/reboot-required
27+
fi
28+
echo "Please reboot to apply changes to /etc/logind.conf"
1929
fi
20-
echo "Please reboot to apply changes to /etc/logind.conf"
2130
fi
2231

2332
# Pick up changes to the systemd service.

tools/github_workflows/github_workflows.jsonnet

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ workflows_template.getWorkflows(
1212
steps+: [
1313
{
1414
name: 'linux_amd64: build bb_clientd.deb',
15-
run: 'bazel build --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb',
15+
run: 'bazel build --stamp --platforms=@rules_go//go/toolchain:linux_amd64 //:bb_clientd_deb',
1616
},
1717
{
1818
name: 'linux_amd64: copy bb_clientd.deb',

0 commit comments

Comments
 (0)