-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathrules
More file actions
executable file
·126 lines (93 loc) · 4.39 KB
/
rules
File metadata and controls
executable file
·126 lines (93 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/make -f
#export DH_VERBOSE = 1
include /usr/share/dpkg/pkg-info.mk
include /usr/share/rustc/architecture.mk
# The package name for authd, used only locally to avoid repetitions
AUTHD_GO_PACKAGE := $(shell grep-dctrl -s XS-Go-Import-Path -n - ./debian/control)
export GOFLAGS := -ldflags=-X=$(AUTHD_GO_PACKAGE)/internal/consts.Version=$(DEB_VERSION_UPSTREAM) --mod=vendor -buildmode=pie
export DEB_BUILD_MAINT_OPTIONS := optimize=-lto
# Strict symbols checking
export DPKG_GENSYMBOLS_CHECK_LEVEL := 4
# Copy in build directory all content to embed
export DH_GOLANG_INSTALL_ALL := 1
# We want to take whatever ubuntu propose to us (as it won’t download a newer version),
# as long as it matches the go.mod go stenza which is the language requirement.
export GOTOOLCHAIN := local
# Needed for Rust vendored sources tracking
export CARGO_VENDOR_DIR := $(CURDIR)/vendor_rust
# Needed for Rust configure/build/test stages
export DEB_HOST_GNU_TYPE DEB_HOST_RUST_TYPE
export CARGO_HOME = $(CURDIR)/debian/cargo_home
# Used not to hardcode the daemons and PAM module paths
export AUTHD_DAEMONS_PATH := /usr/libexec
export AUTHD_PAM_MODULES_PATH = /usr/lib/$(DEB_TARGET_GNU_TYPE)/security
# Skip some tests that rely on external dependencies when building package:
# they need external commands (e.g. `vhs`) that are not available in the build environment.
export AUTHD_SKIP_EXTERNAL_DEPENDENT_TESTS=1
# Skip some tests that fail when running as root as it may happen when building the packages
# in sbuild or similar environments.
export AUTHD_SKIP_ROOT_TESTS := 1
# Defines the targets to be built as part of dh_auto_build
export DH_GOLANG_BUILDPKG := \
$(AUTHD_GO_PACKAGE)/cmd/authctl \
$(AUTHD_GO_PACKAGE)/cmd/authd \
$(AUTHD_GO_PACKAGE)/pam \
$(NULL)
# Prepend the following paths to PATH:
# * The cargo wrapper. This will either be the path to the wrapper installed by
# dh-cargo, or the path to the wrapper installed by the cargo-$VERSION package.
# * The Go executable from the backported Go package. It's possible that no
# backported Go package is installed, because the golang-go package already
# satisfies the dependency. It's still fine to also add the path in that case,
# it will be ignored if it doesn't exist.
export PATH := $(shell ./debian/get-depends-cargo-bin-path.sh):$(shell ./debian/get-depends-go-bin-path.sh):$(shell printenv PATH)
BUILDDIR := $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)
export BUILT_PAM_LIBS_PATH := obj-$(DEB_HOST_GNU_TYPE)/src/$(AUTHD_GO_PACKAGE)/pam
%:
# --without=single-binary can be removed with dh 15.
dh $@ --buildsystem=golang --with=golang,apport --without=single-binary
override_dh_auto_clean:
dh_auto_clean
dh_auto_clean --buildsystem=cargo
# Vendor Go dependencies when building the source package
[ -d vendor/ ] || go mod vendor
# Vendor Rust dependencies when building the source package
[ -d vendor_rust/ ] || debian/vendor-rust.sh
# Cleanup empty cargo-checksum
rm -f debian/cargo-checksum.json
# Cleanup generated service files
rm -f debian/*.service
override_dh_auto_configure:
dh_auto_configure
touch debian/cargo-checksum.json
# Go manual if cargo-vendor-filterer is not around, otherwise dh-cargo will
# ensure that what we've filtered won't be still listed in debian/control.
# TODO: Drop this when we won't care about noble anymore.
if ! command -v cargo-vendor-filterer 2>/dev/null; then \
env DEB_CARGO_CRATE="$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM)" \
cargo prepare-debian "$(CARGO_VENDOR_DIR)"; \
else \
echo "cargo version: $$(cargo --version)"; \
echo "cargo-vendor-filterer version: $$(cargo-vendor-filterer --version)"; \
dh_auto_configure --buildsystem=cargo; \
fi
for i in debian/*.service.in debian/pam-configs/*.in; do \
sed s,@AUTHD_DAEMONS_PATH@,$(AUTHD_DAEMONS_PATH),g $$i > $${i%.*}; \
done
override_dh_auto_build:
# Build PAM library & Go loader
DH_GOLANG_GO_GENERATE=1 dh_auto_build -- $(AUTHD_GO_PACKAGE)/pam
# Build the NSS library
echo "PATH: $(PATH)"
echo "Building NSS library with $$(which cargo) ($$(cargo --version))"
cargo build --release
# Build the daemon
dh_auto_build -- $(AUTHD_GO_PACKAGE)/cmd/authd
override_dh_auto_test:
AUTHD_SKIP_FLAKY_TESTS=1 dh_auto_test
override_dh_auto_install:
dh_auto_install --destdir=debian/tmp -- --no-source
# Fills the built-using variables for rust
/usr/share/cargo/bin/dh-cargo-built-using authd
# Install gdm-PAM config file
dh_installpam -pauthd --name=gdm-authd