Add requests as a dependency, split install target

* Add requests as a dependency on all OSs

* Split the install target into a common target and separate
  install-systemd and install-openrc targets to support installing on
  Alpine
This commit is contained in:
James Campbell 2025-06-03 19:25:33 -04:00
parent bc9e039cb3
commit 8b804f3912
Signed by: james
GPG Key ID: 2287C33A40DC906A
6 changed files with 38 additions and 14 deletions

View File

@ -3,7 +3,7 @@ Version: 1.0
Section: utils
Priority: optional
Architecture: all
Depends: logrotate, python3 (>= 3.6), python3-psycopg2, python3-yaml, systemd
Depends: logrotate, python3 (>= 3.6), python3-psycopg2, python3-requests, python3-yaml, systemd
Maintainer: James Campbell <james@commandprompt.com>
Homepage: https://www.commandprompt.com
Description: A bridge to sit between monitoring tools and PostgreSQL

View File

@ -22,6 +22,7 @@ DEPEND="
${PYTHON_DEPS}
dev-python/psycopg:2
dev-python/pyyaml
dev-python/requests
app-admin/logrotate
"
RDEPEND="${DEPEND}"

View File

@ -23,7 +23,7 @@ SUPPORTED := ubuntu-20.04 \
# These targets are the main ones to use for most things.
##
.PHONY: all clean tgz test query-tests install
.PHONY: all clean tgz test query-tests install-common install-openrc install-systemd
# Build all packages
@ -69,12 +69,11 @@ test:
query-tests:
cd tests ; ./run-tests.sh
# Install the script at the specified base directory
install:
# Install the script at the specified base directory (common components)
install-common:
# Set up directories
mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME)
mkdir -p ${DESTDIR}/etc/logrotate.d
mkdir -p $(DESTDIR)/lib/systemd/system
mkdir -p $(DESTDIR)/usr/local/bin
mkdir -p $(DESTDIR)/usr/share/man/man1
@ -89,11 +88,34 @@ install:
# Install sample config
cp sample-config/* $(DESTDIR)/etc/$(PACKAGE_NAME)/
# Install logrotate config
cp logrotate/${PACKAGE_NAME}.logrotate ${DESTDIR}/etc/logrotate.d/${PACKAGE_NAME}
# Install for systemd
install-systemd:
# Install the common stuff
$(MAKE) install-common
# Set up directories
mkdir -p $(DESTDIR)/lib/systemd/system
# Install systemd unit files
cp systemd/* $(DESTDIR)/lib/systemd/system/
# Install logrotate config
cp logrotate/${PACKAGE_NAME}.logrotate ${DESTDIR}/etc/logrotate.d/${PACKAGE_NAME}
# Install for open-rc
install-openrc:
# Install the common stuff
$(MAKE) install-common
# Set up directories
mkdir -p $(DESTDIR)/etc/init.d
mkdir -p $(DESTDIR)/etc/conf.d
# Install init script
cp openrc/pgmon.initd $(DESTDIR)/init.d/pgmon
# Install init script config file
cp openrc/pgmon.confd $(DESTDIR)/conf.d/pgmon
# Run all of the install tests
@ -167,7 +189,7 @@ package-image-%:
# Debian package creation
actually-package-debian-%:
$(MAKE) install DESTDIR=/output/debian-$*
$(MAKE) install-systemd DESTDIR=/output/debian-$*
cp -r --preserve=mode DEBIAN /output/debian-$*/
dpkg-deb -Zgzip --build /output/debian-$* "/output/$(PACKAGE_NAME)-$(VERSION)-debian-$*.deb"
@ -182,7 +204,7 @@ actually-package-rockylinux-%:
# Ubuntu package creation
actually-package-ubuntu-%:
$(MAKE) install DESTDIR=/output/ubuntu-$*
$(MAKE) install-systemd DESTDIR=/output/ubuntu-$*
cp -r --preserve=mode DEBIAN /output/ubuntu-$*/
dpkg-deb -Zgzip --build /output/ubuntu-$* "/output/$(PACKAGE_NAME)-$(VERSION)-ubuntu-$*.deb"

View File

@ -7,7 +7,7 @@ License: MIT
URL: https://www.commandprompt.com
BuildArch: noarch
Requires: logrotate, python, python-psycopg2, PyYAML, systemd
Requires: logrotate, python, python-psycopg2, PyYAML, python-requests, systemd
%description
A bridge to sit between monitoring tools and PostgreSQL
@ -19,7 +19,7 @@ A bridge to sit between monitoring tools and PostgreSQL
# Do nothing since we have nothing to build
%install
make -C /src install DESTDIR=%{buildroot}
make -C /src install-systemd DESTDIR=%{buildroot}
%files
/etc/logrotate.d/pgmon

View File

@ -7,7 +7,7 @@ License: MIT
URL: https://www.commandprompt.com
BuildArch: noarch
Requires: logrotate, python3, python3-psycopg2, python3-pyyaml, systemd
Requires: logrotate, python3, python3-psycopg2, python3-pyyaml, python3-requests, systemd
%description
A bridge to sit between monitoring tools and PostgreSQL
@ -19,7 +19,7 @@ A bridge to sit between monitoring tools and PostgreSQL
# Do nothing since we have nothing to build
%install
make -C /src install DESTDIR=%{buildroot}
make -C /src install-systemd DESTDIR=%{buildroot}
%files
/etc/logrotate.d/pgmon

View File

@ -2,6 +2,7 @@ FROM alpine:3.21
RUN apk update && \
apk add py3-psycopg2 \
py3-requests \
py3-yaml \
tini