Some checks failed
Comprehensive CI/CD Pipeline / Build and Test (push) Successful in 16m30s
Comprehensive CI/CD Pipeline / Security Audit (push) Failing after 6s
Comprehensive CI/CD Pipeline / Package Validation (push) Successful in 37s
Comprehensive CI/CD Pipeline / Status Report (push) Has been skipped
- Change CARGO_FLAGS from --release to --profile ci - Update binary paths from target/release/ to target/ci/ - Fixes linker error: 'file format not recognized' for serde_yaml - Resolves CI build failure with memory-optimized compilation - Package builds successfully with CI profile settings
225 lines
No EOL
9.3 KiB
Makefile
Executable file
225 lines
No EOL
9.3 KiB
Makefile
Executable file
#!/usr/bin/make -f
|
|
|
|
# Uncomment this to turn on verbose mode.
|
|
#export DH_VERBOSE = 1
|
|
|
|
# This has to be exported to make some magic below work.
|
|
export DH_OPTIONS
|
|
|
|
# Build system configuration
|
|
export CARGO_HOME = $(CURDIR)/debian/cargo
|
|
export CARGO_TARGET_DIR = $(CURDIR)/debian/cargo/target
|
|
|
|
# Detect architecture for cross-compilation
|
|
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
|
|
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
|
|
|
# Rust target for cross-compilation (simplified)
|
|
RUST_TARGET := $(DEB_HOST_ARCH)
|
|
|
|
# Build flags - Use safer flags to avoid Rust compiler SIGSEGV
|
|
CARGO_FLAGS := --profile ci --config .cargo/config.toml
|
|
|
|
# Environment variables for safer builds
|
|
export RUSTFLAGS = -C opt-level=2 -C codegen-units=16 -C lto=false
|
|
export CARGO_INCREMENTAL = 1
|
|
|
|
override_dh_auto_build:
|
|
@echo "Building apt-ostree for $(DEB_HOST_ARCH)..."
|
|
# Ensure cargo is available
|
|
@which cargo > /dev/null || (echo "Error: cargo not found. Please install Rust toolchain." && exit 1)
|
|
# Ensure both binaries are built
|
|
@echo "Building apt-ostree CLI..."
|
|
cargo build $(CARGO_FLAGS) --bin apt-ostree
|
|
@echo "Building apt-ostreed daemon..."
|
|
cargo build $(CARGO_FLAGS) --bin apt-ostreed
|
|
dh_auto_build
|
|
|
|
override_dh_auto_install:
|
|
@echo "Installing apt-ostree binary..."
|
|
# Check if binary exists
|
|
@if [ ! -f "debian/cargo/target/ci/apt-ostree" ]; then \
|
|
echo "Error: apt-ostree binary not found. Build failed."; \
|
|
exit 1; \
|
|
fi
|
|
# Install the apt-ostree binary to the correct location
|
|
install -D -m 755 debian/cargo/target/ci/apt-ostree \
|
|
debian/apt-ostree/usr/bin/apt-ostree
|
|
# Create additional directories
|
|
mkdir -p debian/apt-ostree/usr/share/doc/apt-ostree
|
|
mkdir -p debian/apt-ostree/usr/share/man/man1
|
|
mkdir -p debian/apt-ostree/usr/share/bash-completion/completions
|
|
mkdir -p debian/apt-ostree/usr/share/zsh/vendor-completions
|
|
mkdir -p debian/apt-ostree/usr/share/apt-ostree
|
|
@echo "apt-ostree package directories created successfully"
|
|
# Install man pages if they exist
|
|
@if [ -f "debian/apt-ostree.1" ]; then \
|
|
install -D -m 644 debian/apt-ostree.1 debian/apt-ostree/usr/share/man/man1/apt-ostree.1; \
|
|
fi
|
|
@if [ -f "debian/man/apt-ostree.1" ]; then \
|
|
install -D -m 644 debian/man/apt-ostree.1 debian/apt-ostree/usr/share/man/man1/apt-ostree.1; \
|
|
fi
|
|
@if [ -f "debian/man/apt-ostree-dev.1" ]; then \
|
|
install -D -m 644 debian/man/apt-ostree-dev.1 debian/apt-ostree/usr/share/man/man1/apt-ostree-dev.1; \
|
|
fi
|
|
@if [ -f "debian/man/apt-ostree.conf.5" ]; then \
|
|
install -D -m 644 debian/man/apt-ostree.conf.5 debian/apt-ostree/usr/share/man/man5/apt-ostree.conf.5; \
|
|
fi
|
|
# Install bash completion if it exists
|
|
@if [ -f "debian/apt-ostree.bash-completion" ]; then \
|
|
install -D -m 644 debian/apt-ostree.bash-completion \
|
|
debian/apt-ostree/usr/share/bash-completion/completions/apt-ostree; \
|
|
fi
|
|
# Install zsh completion if it exists
|
|
@if [ -f "debian/apt-ostree.zsh-completion" ]; then \
|
|
install -D -m 644 debian/apt-ostree.zsh-completion \
|
|
debian/apt-ostree/usr/share/zsh/vendor-completions/_apt-ostree; \
|
|
fi
|
|
|
|
@echo "Installing apt-ostreed daemon into apt-ostree package..."
|
|
# Check if binary exists
|
|
@if [ ! -f "debian/cargo/target/ci/apt-ostreed" ]; then \
|
|
echo "Error: apt-ostreed binary not found. Build failed."; \
|
|
exit 1; \
|
|
fi
|
|
# Install the apt-ostreed binary into the apt-ostree package
|
|
install -D -m 755 debian/cargo/target/ci/apt-ostreed \
|
|
debian/apt-ostree/usr/libexec/apt-ostreed
|
|
# Check and install systemd service files
|
|
@if [ ! -f "daemon/systemd/apt-ostreed.service" ]; then \
|
|
echo "Error: apt-ostreed.service not found."; \
|
|
exit 1; \
|
|
fi
|
|
@if [ ! -f "daemon/systemd/apt-ostreed.socket" ]; then \
|
|
echo "Error: apt-ostreed.socket not found."; \
|
|
exit 1; \
|
|
fi
|
|
install -D -m 644 daemon/systemd/apt-ostreed.service \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostreed.service
|
|
install -D -m 644 daemon/systemd/apt-ostreed.socket \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostreed.socket
|
|
|
|
# Install additional systemd services
|
|
@echo "Installing additional systemd services..."
|
|
install -D -m 644 src/daemon/apt-ostree-bootstatus.service \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostree-bootstatus.service
|
|
install -D -m 644 src/daemon/apt-ostree-countme.service \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostree-countme.service
|
|
install -D -m 644 src/daemon/apt-ostree-countme.timer \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostree-countme.timer
|
|
install -D -m 644 src/daemon/apt-ostreed-automatic.service \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostreed-automatic.service
|
|
install -D -m 644 src/daemon/apt-ostreed-automatic.timer \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostreed-automatic.timer
|
|
# Install fix-shadow-mode service from debian-atomic-files (if available)
|
|
@if [ -f "../debian-atomic-files/apt-ostree-systemd/systemd/system/apt-ostree-fix-shadow-mode.service" ]; then \
|
|
install -D -m 644 ../debian-atomic-files/apt-ostree-systemd/systemd/system/apt-ostree-fix-shadow-mode.service \
|
|
debian/apt-ostree/lib/systemd/system/apt-ostree-fix-shadow-mode.service; \
|
|
echo "Installed apt-ostree-fix-shadow-mode.service"; \
|
|
else \
|
|
echo "Warning: apt-ostree-fix-shadow-mode.service not found, skipping"; \
|
|
fi
|
|
|
|
# Check and install polkit policy
|
|
@if [ ! -f "daemon/polkit/apt-ostree.policy" ]; then \
|
|
echo "Error: apt-ostree.policy not found."; \
|
|
exit 1; \
|
|
fi
|
|
install -D -m 644 daemon/polkit/apt-ostree.policy \
|
|
debian/apt-ostree/usr/share/polkit-1/actions/org.projectatomic.aptostree1.policy
|
|
# Check and install configuration files
|
|
@if [ ! -f "src/daemon/apt-ostreed.conf" ]; then \
|
|
echo "Error: apt-ostreed.conf not found."; \
|
|
exit 1; \
|
|
fi
|
|
install -d -m 755 debian/apt-ostree/etc/apt-ostreed
|
|
install -D -m 644 src/daemon/apt-ostreed.conf \
|
|
debian/apt-ostree/etc/apt-ostreed/apt-ostreed.conf
|
|
|
|
# Install kernel integration files
|
|
@echo "Installing kernel integration files..."
|
|
mkdir -p debian/apt-ostree/usr/lib/kernel/install.d
|
|
@if [ -f "../debian-atomic-files/apt-ostree-systemd/kernel/install.d/05-aptostree.install" ]; then \
|
|
install -D -m 644 ../debian-atomic-files/apt-ostree-systemd/kernel/install.d/05-aptostree.install \
|
|
debian/apt-ostree/usr/lib/kernel/install.d/05-aptostree.install; \
|
|
echo "Installed kernel install hook"; \
|
|
else \
|
|
echo "Warning: kernel install hook not found, skipping"; \
|
|
fi
|
|
@if [ -f "../debian-atomic-files/apt-ostree-systemd/kernel/install.conf" ]; then \
|
|
install -D -m 644 ../debian-atomic-files/apt-ostree-systemd/kernel/install.conf \
|
|
debian/apt-ostree/usr/lib/kernel/install.conf; \
|
|
echo "Installed kernel install config"; \
|
|
else \
|
|
echo "Warning: kernel install config not found, skipping"; \
|
|
fi
|
|
|
|
# Install tmpfiles configuration
|
|
@echo "Installing tmpfiles configuration..."
|
|
mkdir -p debian/apt-ostree/usr/lib/tmpfiles.d
|
|
@if [ -f "../debian-atomic-files/apt-ostree-systemd/tmpfiles.d/apt-ostree-0-integration.conf" ]; then \
|
|
install -D -m 644 ../debian-atomic-files/apt-ostree-systemd/tmpfiles.d/apt-ostree-0-integration.conf \
|
|
debian/apt-ostree/usr/lib/tmpfiles.d/apt-ostree-0-integration.conf; \
|
|
echo "Installed tmpfiles integration config"; \
|
|
else \
|
|
echo "Warning: tmpfiles integration config not found, skipping"; \
|
|
fi
|
|
@if [ -f "../debian-atomic-files/apt-ostree-systemd/tmpfiles.d/apt-ostree-0-integration-opt-usrlocal.conf" ]; then \
|
|
install -D -m 644 ../debian-atomic-files/apt-ostree-systemd/tmpfiles.d/apt-ostree-0-integration-opt-usrlocal.conf \
|
|
debian/apt-ostree/usr/lib/tmpfiles.d/apt-ostree-0-integration-opt-usrlocal.conf; \
|
|
echo "Installed tmpfiles usrlocal config"; \
|
|
else \
|
|
echo "Warning: tmpfiles usrlocal config not found, skipping"; \
|
|
fi
|
|
@if [ -f "../debian-atomic-files/apt-ostree-systemd/tmpfiles.d/apt-ostree-0-integration-opt-usrlocal-compat.conf" ]; then \
|
|
install -D -m 644 ../debian-atomic-files/apt-ostree-systemd/tmpfiles.d/apt-ostree-0-integration-opt-usrlocal-compat.conf \
|
|
debian/apt-ostree/usr/lib/tmpfiles.d/apt-ostree-0-integration-opt-usrlocal-compat.conf; \
|
|
echo "Installed tmpfiles usrlocal compat config"; \
|
|
else \
|
|
echo "Warning: tmpfiles usrlocal compat config not found, skipping"; \
|
|
fi
|
|
|
|
# Install D-Bus policy configuration
|
|
@echo "Installing D-Bus policy configuration..."
|
|
mkdir -p debian/apt-ostree/usr/share/dbus-1/system.d
|
|
@if [ -f "../debian-atomic-files/apt-ostree-systemd/org.debian.aptostree1.conf" ]; then \
|
|
install -D -m 644 ../debian-atomic-files/apt-ostree-systemd/org.debian.aptostree1.conf \
|
|
debian/apt-ostree/usr/share/dbus-1/system.d/org.debian.aptostree1.conf; \
|
|
echo "Installed D-Bus policy config"; \
|
|
else \
|
|
echo "Warning: D-Bus policy config not found, skipping"; \
|
|
fi
|
|
|
|
# Create additional directories
|
|
mkdir -p debian/apt-ostree/usr/share/doc/apt-ostree
|
|
# Create log directory
|
|
mkdir -p debian/apt-ostree/var/log
|
|
# Create cache directory
|
|
mkdir -p debian/apt-ostree/var/cache/apt-ostree
|
|
# Create state directory
|
|
mkdir -p debian/apt-ostree/var/lib/apt-ostree
|
|
@echo "apt-ostreed components installed into apt-ostree package successfully"
|
|
|
|
# Skip dh_auto_install since we've handled installation manually
|
|
@echo "Package installation completed successfully!"
|
|
|
|
override_dh_auto_clean:
|
|
@echo "Cleaning cargo build artifacts..."
|
|
# Clean cargo build artifacts
|
|
rm -rf debian/cargo
|
|
dh_auto_clean
|
|
|
|
override_dh_strip:
|
|
# Strip debug symbols from binary
|
|
dh_strip
|
|
|
|
override_dh_shlibdeps:
|
|
# Handle shared library dependencies
|
|
dh_shlibdeps
|
|
|
|
override_dh_fixperms:
|
|
# Fix file permissions
|
|
dh_fixperms
|
|
|
|
%:
|
|
dh $@
|