mirror of https://github.com/caronc/apprise
Chris Caron
2 years ago
committed by
GitHub
13 changed files with 330 additions and 7 deletions
@ -0,0 +1,36 @@
|
||||
# Base |
||||
FROM rockylinux:8 |
||||
ENV container docker |
||||
RUN ( \ |
||||
cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ |
||||
systemd-tmpfiles-setup.service ] || rm -f $i; done); \ |
||||
rm -f /lib/systemd/system/multi-user.target.wants/*;\ |
||||
rm -f /etc/systemd/system/*.wants/*;\ |
||||
rm -f /lib/systemd/system/local-fs.target.wants/*; \ |
||||
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ |
||||
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ |
||||
rm -f /lib/systemd/system/basic.target.wants/*;\ |
||||
rm -f /lib/systemd/system/anaconda.target.wants/*; \ |
||||
echo "assumeyes=1" >> /etc/yum.conf; \ |
||||
dnf install -y epel-release; \ |
||||
dnf install -y rpm-build rpmlint python3-pip python3-virtualenv rubygem-ronn \ |
||||
dnf-plugins-core 'dnf-command(config-manager)' \ |
||||
'dnf-command(builddep)' sudo rsync rpmdevtools; \ |
||||
dnf config-manager --set-enabled powertools; |
||||
|
||||
COPY packaging/redhat/python-apprise.spec / |
||||
# Place our build file into the path |
||||
COPY bin/build-rpm.sh /usr/bin |
||||
RUN rpmspec -q --buildrequires /python-apprise.spec | cut -f1 -d' ' | \ |
||||
xargs dnf install -y |
||||
|
||||
# RPM Build Structure Setup |
||||
ENV FLAVOR=rpmbuild OS=centos DIST=el8 |
||||
RUN useradd builder -u 1000 -m -G users,wheel &>/dev/null && \ |
||||
echo "builder ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers |
||||
|
||||
VOLUME ["/apprise"] |
||||
WORKDIR /apprise |
||||
|
||||
# RPMs should never be built as root |
||||
USER builder |
@ -0,0 +1,36 @@
|
||||
# Base |
||||
FROM rockylinux:9 |
||||
ENV container docker |
||||
RUN ( \ |
||||
cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \ |
||||
systemd-tmpfiles-setup.service ] || rm -f $i; done); \ |
||||
rm -f /lib/systemd/system/multi-user.target.wants/*;\ |
||||
rm -f /etc/systemd/system/*.wants/*;\ |
||||
rm -f /lib/systemd/system/local-fs.target.wants/*; \ |
||||
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ |
||||
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ |
||||
rm -f /lib/systemd/system/basic.target.wants/*;\ |
||||
rm -f /lib/systemd/system/anaconda.target.wants/*; \ |
||||
echo "assumeyes=1" >> /etc/yum.conf; \ |
||||
dnf install -y epel-release; \ |
||||
dnf install -y rpm-build rpmlint python3-pip rubygem-ronn \ |
||||
dnf-plugins-core 'dnf-command(config-manager)' \ |
||||
'dnf-command(builddep)' sudo rsync rpmdevtools; \ |
||||
dnf config-manager --set-enabled crb; |
||||
|
||||
COPY packaging/redhat/python-apprise.spec / |
||||
# Place our build file into the path |
||||
COPY bin/build-rpm.sh /usr/bin |
||||
RUN rpmspec -q --buildrequires /python-apprise.spec | cut -f1 -d' ' | \ |
||||
xargs dnf install -y |
||||
|
||||
# RPM Build Structure Setup |
||||
ENV FLAVOR=rpmbuild OS=centos DIST=el8 |
||||
RUN useradd builder -u 1000 -m -G users,wheel &>/dev/null && \ |
||||
echo "builder ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers |
||||
|
||||
VOLUME ["/apprise"] |
||||
WORKDIR /apprise |
||||
|
||||
# RPMs should never be built as root |
||||
USER builder |
@ -0,0 +1,33 @@
|
||||
# Base |
||||
FROM fedora:37 |
||||
ENV container docker |
||||
RUN \ |
||||
rm -f /usr/lib/systemd/system/multi-user.target.wants/*;\ |
||||
rm -f /etc/systemd/system/*.wants/*;\ |
||||
rm -f /usr/lib/systemd/system/local-fs.target.wants/*; \ |
||||
rm -f /usr/lib/systemd/system/sockets.target.wants/*udev*; \ |
||||
rm -f /usr/lib/systemd/system/sockets.target.wants/*initctl*; \ |
||||
rm -f /usr/lib/systemd/system/basic.target.wants/*;\ |
||||
rm -f /usr/lib/systemd/system/anaconda.target.wants/*; \ |
||||
echo "assumeyes=1" >> /etc/dnf/dnf.conf; \ |
||||
dnf install -y epel-release; \ |
||||
dnf install -y rpm-build rpmlint python3-pip rubygem-ronn \ |
||||
dnf-plugins-core 'dnf-command(config-manager)' \ |
||||
'dnf-command(builddep)' sudo rsync rpmdevtools; |
||||
|
||||
COPY packaging/redhat/python-apprise.spec / |
||||
# Place our build file into the path |
||||
COPY bin/build-rpm.sh /usr/bin |
||||
RUN rpmspec -q --buildrequires /python-apprise.spec | cut -f1 -d' ' | \ |
||||
xargs dnf install -y |
||||
|
||||
# RPM Build Structure Setup |
||||
ENV FLAVOR=rpmbuild OS=centos DIST=el8 |
||||
RUN useradd builder -u 1000 -m -G users,wheel &>/dev/null && \ |
||||
echo "builder ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers |
||||
|
||||
VOLUME ["/apprise"] |
||||
WORKDIR /apprise |
||||
|
||||
# RPMs should never be built as root |
||||
USER builder |
@ -0,0 +1,110 @@
|
||||
#!/bin/bash |
||||
# Copyright (C) 2022 Chris Caron <lead2gold@gmail.com> |
||||
# All rights reserved. |
||||
# |
||||
# This code is licensed under the MIT License. |
||||
# |
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
# of this software and associated documentation files(the "Software"), to deal |
||||
# in the Software without restriction, including without limitation the rights |
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell |
||||
# copies of the Software, and to permit persons to whom the Software is |
||||
# furnished to do so, subject to the following conditions : |
||||
# |
||||
# The above copyright notice and this permission notice shall be included in |
||||
# all copies or substantial portions of the Software. |
||||
# |
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE |
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
# THE SOFTWARE. |
||||
|
||||
# Directory where Apprise Source Code can be found |
||||
APPRISE_DIR="/apprise" |
||||
PYTHON=python3 |
||||
PIP=pip3 |
||||
VENV_CMD="$PYTHON -m venv" |
||||
|
||||
mkenv(){ |
||||
# Prepares RPM Environment |
||||
cat << _EOF > $HOME/.rpmmacros |
||||
# macros |
||||
%_topdir $APPRISE_DIR |
||||
%_sourcedir %{_topdir}/dist |
||||
%_specdir %{_topdir}/dist |
||||
%_rpmdir %{_topdir}/dist/rpm |
||||
%_srcrpmdir %{_topdir}/dist/rpm |
||||
%_builddir %{_topdir}/build/rpm |
||||
_EOF |
||||
# Prepare our working directories if not already present |
||||
mkdir -p $APPRISE_DIR/{dist/rpm,build/rpm} |
||||
return 0 |
||||
} |
||||
|
||||
clean(){ |
||||
# Tidy .pyc files |
||||
find $APPRISE_DIR -name '*.pyc' -delete &>/dev/null |
||||
find $APPRISE_DIR -type d -name '__pycache__' -exec rm -rf {} \ &>/dev/null; |
||||
# Remove previously build details |
||||
[ -d "$APPRISE_DIR/apprise.egg-info" ] && rm -rf $APPRISE_DIR/apprise.egg-info |
||||
[ -d "$APPRISE_DIR/build" ] && rm -rf $APPRISE_DIR/build |
||||
[ -d "$APPRISE_DIR/BUILDROOT" ] && rm -rf $APPRISE_DIR/BUILDROOT |
||||
} |
||||
|
||||
build(){ |
||||
# Test spec file for any issues |
||||
rpmlint "$APPRISE_DIR/packaging/redhat/python-apprise.spec" |
||||
[ $? -ne 0 ] && echo "RPMLint Failed!" && return 1 |
||||
|
||||
# Prepare RPM Package |
||||
# Detect our version |
||||
local VER=$(rpmspec -q --qf "%{version}\n" \ |
||||
"$APPRISE_DIR/packaging/redhat/python-apprise.spec" 2>/dev/null | head -n1) |
||||
[ -z "$VER" ] && echo "Could not detect Apprise RPM Version" && return 1 |
||||
|
||||
if [ ! -f "$APPRISE_DIR/dist/apprise-$VER.tar.gz" ]; then |
||||
# Build Apprise |
||||
if [ ! -x $HOME/dev/bin/activate ]; then |
||||
$VENV_CMD $HOME/dev |
||||
[ $? -ne 0 ] && echo "Could not create Virtual Python Environment" && return 1 |
||||
fi |
||||
. $HOME/dev/bin/activate |
||||
$PIP install coverage babel wheel markdown |
||||
|
||||
pushd $APPRISE_DIR |
||||
# Build Man Page |
||||
ronn --roff $APPRISE_DIR/packaging/man/apprise.md |
||||
$PYTHON setup.py extract_messages |
||||
$PYTHON setup.py sdist |
||||
|
||||
# exit from our virtual environment |
||||
deactivate |
||||
fi |
||||
|
||||
# Prepare our RPM Source and SPEC dependencies |
||||
find "$APPRISE_DIR/packaging/man/" -type f -name '*.1' \ |
||||
-exec cp --verbose {} "$APPRISE_DIR/dist" \; |
||||
find "$APPRISE_DIR/packaging/redhat" -type f -name '*.patch' \ |
||||
-exec cp --verbose {} "$APPRISE_DIR/dist" \; |
||||
find "$APPRISE_DIR/packaging/redhat" -type f -name '*.spec' \ |
||||
-exec cp --verbose {} "$APPRISE_DIR/dist" \; |
||||
|
||||
# Build and Test our RPM Package |
||||
rpmbuild -ba "$APPRISE_DIR/dist/python-apprise.spec" |
||||
return $? |
||||
} |
||||
|
||||
# Prepare our environment |
||||
mkenv |
||||
|
||||
# Clean |
||||
clean |
||||
|
||||
# Build |
||||
build |
||||
|
||||
# Return our build status |
||||
exit $? |
@ -0,0 +1,12 @@
|
||||
diff -Naur apprise-1.2.0/test/test_plugin_macosx.py apprise-1.2.0.patched/test/test_plugin_macosx.py
|
||||
--- apprise-1.2.0/test/test_plugin_macosx.py 2022-11-02 14:59:59.000000000 -0400
|
||||
+++ apprise-1.2.0.patched/test/test_plugin_macosx.py 2022-11-15 13:25:27.991284405 -0500
|
||||
@@ -38,7 +38,7 @@
|
||||
logging.disable(logging.CRITICAL)
|
||||
|
||||
|
||||
-if sys.platform not in ["darwin", "linux"]:
|
||||
+if sys.platform not in ["darwin"]:
|
||||
pytest.skip("Only makes sense on macOS, but also works on Linux",
|
||||
allow_module_level=True)
|
||||
|
@ -0,0 +1,19 @@
|
||||
diff -Naur apprise-1.2.0/test/conftest.py apprise-1.2.0.patched/test/conftest.py
|
||||
--- apprise-1.2.0/test/conftest.py 2022-11-02 14:00:13.000000000 -0400
|
||||
+++ apprise-1.2.0.patched/test/conftest.py 2022-11-15 10:28:23.793969418 -0500
|
||||
@@ -32,12 +32,12 @@
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
|
||||
|
||||
|
||||
-@pytest.fixture(scope="session", autouse=True)
|
||||
-def no_throttling_everywhere(session_mocker):
|
||||
+@pytest.fixture(autouse=True)
|
||||
+def no_throttling_everywhere(mocker):
|
||||
"""
|
||||
A pytest session fixture which disables throttling on all notifiers.
|
||||
It is automatically enabled.
|
||||
"""
|
||||
for notifier in NOTIFY_MODULE_MAP.values():
|
||||
plugin = notifier["plugin"]
|
||||
- session_mocker.patch.object(plugin, "request_rate_per_sec", 0)
|
||||
+ mocker.patch.object(plugin, "request_rate_per_sec", 0)
|
Loading…
Reference in new issue