File: rules

package info (click to toggle)
cockpit 354-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 308,956 kB
  • sloc: javascript: 775,606; python: 40,351; ansic: 35,655; cpp: 11,117; sh: 3,511; makefile: 580; xml: 261
file content (104 lines) | stat: -rwxr-xr-x 4,170 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# we need an apparmor profile for >= 4.0; this does not yet exist in Ubuntu 22.04
PRE4AA = $(filter $(shell . /etc/os-release; echo $${VERSION_ID:-unstable}),22.04)

# Ubuntu 22.04 LTS's node.js version 12 is too old to understand our source.
# Also, esbuild/nodejs are not available on all Debian architectures.
# Keep the pre-built dist/ for Ubuntu 22.04 and when nodejs is not available.
KEEP_DIST = $(filter $(shell . /etc/os-release; echo $${VERSION_ID:-unstable}),22.04)
ifeq ($(KEEP_DIST),)
    ifeq ($(shell command -v nodejs 2>/dev/null),)
        KEEP_DIST = no-nodejs
    endif
endif

# keep the host switcher on in currently supported stable releases
STABLE = $(filter $(shell . /etc/os-release; echo $${VERSION_CODENAME}),bookworm jammy noble)
ifneq ($(STABLE),)
    CONFIG_OPTIONS := $(CONFIG_OPTIONS) --enable-multihost
endif

# riscv is an emulated architecture for now, and too slow to run expensive unit tests
# hppa's threading is absurdly slow (#981127)
SLOW_ARCHES = $(filter $(shell dpkg-architecture -qDEB_BUILD_ARCH),riscv64 hppa)
ifneq ($(SLOW_ARCHES),)
	export COCKPIT_SKIP_SLOW_TESTS=1
endif

export deb_systemdsystemunitdir = $(shell pkgconf --variable=systemdsystemunitdir systemd | sed s,^/,,)
# pam.pc doesn't yet have a libdir on older releases
export deb_pamlibdir = $(shell { pkgconf --variable=libdir pam || echo /lib/$(DEB_HOST_MULTIARCH); } | sed s,^/,,)

%:
	dh $@ --buildsystem=autoconf --with=python3

override_dh_auto_configure:
ifeq ($(KEEP_DIST),)
	# upstream releases include a pre-built dist/, rebuild it
	rm -fr dist/
	# remove mini-node_modules with sizzle
	rm -fr node_modules
	# HACK: names for additional tarballs can't contain '_', so we name it just "orig-node"
	ln -fs node node_modules
endif
	dh_auto_configure -- \
		--with-pamdir=/$(deb_pamlibdir)/security \
		--libexecdir=/usr/lib/cockpit $(CONFIG_OPTIONS)

# HACK: Debian's pip breaks --prefix: https://bugs.debian.org/1035546 with
# default install layout
override_dh_auto_install:
	DEB_PYTHON_INSTALL_LAYOUT=deb dh_auto_install

# avoid trying to start cockpit-issue.service and cockpit-wsinstance-*.socket etc.
override_dh_installsystemd:
	dh_installsystemd -p cockpit-ws cockpit.socket

override_dh_install:
	# Debian/Ubuntu PAM config
	mkdir -p debian/tmp/etc/pam.d
	install -p -m 644 tools/cockpit.debian.pam debian/tmp/etc/pam.d/cockpit

	# don't ship broken branding symlinks
	for d in arch rhel fedora centos opensuse; do rm -r debian/tmp/usr/share/cockpit/branding/$$d; done
	dpkg-vendor --derives-from ubuntu || rm -r debian/tmp/usr/share/cockpit/branding/ubuntu

	# handled by package maintainer scripts
	rm debian/tmp/etc/motd.d/cockpit debian/tmp/etc/issue.d/cockpit.issue

	# already processed into debian/copyright
	rm -r debian/tmp/usr/share/doc/cockpit/legal

	# unpackaged modules
	rm -r debian/tmp/usr/share/cockpit/kdump
	rm debian/tmp/usr/share/metainfo/org.cockpit_project.cockpit_kdump.metainfo.xml
	rm -r debian/tmp/usr/share/cockpit/selinux
	rm debian/tmp/usr/share/metainfo/org.cockpit_project.cockpit_selinux.metainfo.xml

	dh_install -Xusr/src/debug
	# we don't need this, it contains full build paths and breaks reproducibility
	rm -r debian/tmp/usr/lib/python*/*-packages/*.dist-info

        # AppArmor profile
ifeq ($(PRE4AA),)
	mkdir -p debian/cockpit-ws/etc/apparmor.d/
	install -p -m 644 tools/apparmor.d/cockpit-desktop debian/cockpit-ws/etc/apparmor.d/
endif

execute_after_dh_install-indep:
	# avoid dh_missing failure
	rm -r debian/tmp/usr/lib/python*

	# run pytests *after* installation, so that we can make sure that we installed the right files
ifeq (, $(findstring nocheck, $(DEB_BUILD_OPTIONS)))
ifeq ($(shell . /etc/os-release; echo $${VERSION_ID:-unstable}),22.04)
	NO_QUNIT=1 PYTHONPATH=$$(ls -d debian/cockpit-bridge/usr/lib/python3*/dist-packages) python3 -m pytest -vv -k 'not linter and not test_descriptions'
else
	NO_QUNIT=1 pytest -vv -k 'not linter and not test_descriptions' -opythonpath=$$(ls -d debian/cockpit-bridge/usr/lib/python3*/dist-packages)
endif
endif