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 Section: utils
Priority: optional Priority: optional
Architecture: all 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> Maintainer: James Campbell <james@commandprompt.com>
Homepage: https://www.commandprompt.com Homepage: https://www.commandprompt.com
Description: A bridge to sit between monitoring tools and PostgreSQL Description: A bridge to sit between monitoring tools and PostgreSQL

View File

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

View File

@ -23,7 +23,7 @@ SUPPORTED := ubuntu-20.04 \
# These targets are the main ones to use for most things. # 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 # Build all packages
@ -69,12 +69,11 @@ test:
query-tests: query-tests:
cd tests ; ./run-tests.sh cd tests ; ./run-tests.sh
# Install the script at the specified base directory # Install the script at the specified base directory (common components)
install: install-common:
# Set up directories # Set up directories
mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME) mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME)
mkdir -p ${DESTDIR}/etc/logrotate.d mkdir -p ${DESTDIR}/etc/logrotate.d
mkdir -p $(DESTDIR)/lib/systemd/system
mkdir -p $(DESTDIR)/usr/local/bin mkdir -p $(DESTDIR)/usr/local/bin
mkdir -p $(DESTDIR)/usr/share/man/man1 mkdir -p $(DESTDIR)/usr/share/man/man1
@ -89,12 +88,35 @@ install:
# Install sample config # Install sample config
cp sample-config/* $(DESTDIR)/etc/$(PACKAGE_NAME)/ cp sample-config/* $(DESTDIR)/etc/$(PACKAGE_NAME)/
# Install systemd unit files
cp systemd/* $(DESTDIR)/lib/systemd/system/
# Install logrotate config # Install logrotate config
cp logrotate/${PACKAGE_NAME}.logrotate ${DESTDIR}/etc/logrotate.d/${PACKAGE_NAME} 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 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 # Run all of the install tests
.PHONY: install-tests debian-%-install-test rockylinux-%-install-test ubuntu-%-install-test gentoo-install-test .PHONY: install-tests debian-%-install-test rockylinux-%-install-test ubuntu-%-install-test gentoo-install-test
@ -167,7 +189,7 @@ package-image-%:
# Debian package creation # Debian package creation
actually-package-debian-%: actually-package-debian-%:
$(MAKE) install DESTDIR=/output/debian-$* $(MAKE) install-systemd DESTDIR=/output/debian-$*
cp -r --preserve=mode DEBIAN /output/debian-$*/ cp -r --preserve=mode DEBIAN /output/debian-$*/
dpkg-deb -Zgzip --build /output/debian-$* "/output/$(PACKAGE_NAME)-$(VERSION)-debian-$*.deb" dpkg-deb -Zgzip --build /output/debian-$* "/output/$(PACKAGE_NAME)-$(VERSION)-debian-$*.deb"
@ -182,7 +204,7 @@ actually-package-rockylinux-%:
# Ubuntu package creation # Ubuntu package creation
actually-package-ubuntu-%: actually-package-ubuntu-%:
$(MAKE) install DESTDIR=/output/ubuntu-$* $(MAKE) install-systemd DESTDIR=/output/ubuntu-$*
cp -r --preserve=mode DEBIAN /output/ubuntu-$*/ cp -r --preserve=mode DEBIAN /output/ubuntu-$*/
dpkg-deb -Zgzip --build /output/ubuntu-$* "/output/$(PACKAGE_NAME)-$(VERSION)-ubuntu-$*.deb" 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 URL: https://www.commandprompt.com
BuildArch: noarch BuildArch: noarch
Requires: logrotate, python, python-psycopg2, PyYAML, systemd Requires: logrotate, python, python-psycopg2, PyYAML, python-requests, systemd
%description %description
A bridge to sit between monitoring tools and PostgreSQL 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 # Do nothing since we have nothing to build
%install %install
make -C /src install DESTDIR=%{buildroot} make -C /src install-systemd DESTDIR=%{buildroot}
%files %files
/etc/logrotate.d/pgmon /etc/logrotate.d/pgmon

View File

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

View File

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