From 4a5b9d9fa143532d752718fb334d4b1761934351 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Thu, 3 Nov 2022 02:59:15 +0200 Subject: [PATCH] fix case in which if no source PKGBUILDs were updated, an exception will occur --- docs/faq.rst | 36 ++++++++++--------- src/ahriman/core/build_tools/sources.py | 2 +- src/ahriman/core/formatters/__init__.py | 22 ++++++------ src/ahriman/core/gitremote/__init__.py | 22 ++++++------ src/ahriman/core/gitremote/remote_pull.py | 22 ++++++------ .../core/gitremote/remote_pull_trigger.py | 22 ++++++------ src/ahriman/core/gitremote/remote_push.py | 22 ++++++------ .../core/gitremote/remote_push_trigger.py | 22 ++++++------ src/ahriman/core/report/telegram.py | 3 +- .../ahriman/core/build_tools/test_sources.py | 4 +-- 10 files changed, 90 insertions(+), 87 deletions(-) diff --git a/docs/faq.rst b/docs/faq.rst index 494347a2..f28eb224 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -705,43 +705,47 @@ Other topics How does it differ from %another-manager%? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Short answer - I do not know. +Short answer - I do not know. Also for some references credits to `Alad `_, he `did `_ really good investigation of existing alternatives. + +`arch-repo-manager `_ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +Looks actually pretty good, in case if I would find it, I would probably didn't start this project, most of features (like web interface or additional helpers) are already implemented or planned to be. However, this project seems to be at early alpha stage (as for Nov 2022), written in C++ (not pro or con) and misses code documentation. `archrepo2 `_ """""""""""""""""""""""""""""""""""""""""""""""""""" Don't know, haven't tried it. But it lacks of documentation at least. -* Web interface. -* No synchronization and reporting. +* ``ahriman`` has web interface. +* ``archrepo2`` doesn't have synchronization and reporting. * ``archrepo2`` actively uses direct shell calls and ``yaourt`` components. -* It has constantly running process instead of timer process (it is not pro or con). +* ``archrepo2`` has constantly running process instead of timer process (it is not pro or con). `repoctl `_ """"""""""""""""""""""""""""""""""""""""""""""" -* Web interface. -* No reporting. -* Local packages and patches support. -* Some actions are not fully automated (e.g. package update still requires manual intervention for the build itself). +* ``ahriman`` has web interface. +* ``repoctl`` does not have reporting feature. +* ``repoctl`` does not support local packages and patches. +* Some actions are not fully automated in ``repoctl`` (e.g. package update still requires manual intervention for the build itself). * ``repoctl`` has better AUR interaction features. With colors! * ``repoctl`` has much easier configuration and even completion. * ``repoctl`` is able to store old packages. -* Ability to host repository from same command vs external services (e.g. nginx) in ``ahriman``. +* Ability to host repository from same command in ``repoctl`` vs external services (e.g. nginx) in ``ahriman``. `repo-scripts `_ """"""""""""""""""""""""""""""""""""""""""""""""""""""""" Though originally I've created ahriman by trying to improve the project, it still lacks a lot of features: -* Web interface. -* Better reporting with template support. -* Synchronization features (there was only ``rsync`` based). -* Local packages and patches support. -* No dependency management. -* And so on. +* ``ahriman`` has web interface. +* ``ahriman`` has better reporting with template support. +* ``ahriman`` has more synchronization features (there was only ``rsync`` based). +* ``ahriman`` supports local packages and patches. +* ``repo-scripts`` doesn't have dependency management. -``repo-scripts`` also have bad architecture and bad quality code and uses out-of-dated ``yaourt`` and ``package-query``. +...and so on. ``repo-scripts`` also has bad architecture and bad quality code and uses out-of-dated ``yaourt`` and ``package-query``. `toolbox `_ """"""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/src/ahriman/core/build_tools/sources.py b/src/ahriman/core/build_tools/sources.py index 8c597d64..0095ec51 100644 --- a/src/ahriman/core/build_tools/sources.py +++ b/src/ahriman/core/build_tools/sources.py @@ -216,7 +216,7 @@ class Sources(LazyLogging): """ if commit_message is None: commit_message = f"Autogenerated commit at {datetime.datetime.utcnow()}" - Sources._check_output("git", "commit", "--all", "--message", commit_message, + Sources._check_output("git", "commit", "--allow-empty", "--message", commit_message, exception=None, cwd=sources_dir, logger=self.logger) def diff(self, sources_dir: Path) -> str: diff --git a/src/ahriman/core/formatters/__init__.py b/src/ahriman/core/formatters/__init__.py index c6cffb1c..a53d8d87 100644 --- a/src/ahriman/core/formatters/__init__.py +++ b/src/ahriman/core/formatters/__init__.py @@ -1,21 +1,21 @@ # -# copyright (c) 2021-2022 ahriman team. +# Copyright (c) 2021-2022 ahriman team. # -# this file is part of ahriman +# This file is part of ahriman # (see https://github.com/arcan1s/ahriman). # -# this program is free software: you can redistribute it and/or modify -# it under the terms of the gnu general public license as published by -# the free software foundation, either version 3 of the license, or +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# this program is distributed in the hope that it will be useful, -# but without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. see the -# gnu general public license for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# you should have received a copy of the gnu general public license -# along with this program. if not, see . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # from ahriman.core.formatters.printer import Printer from ahriman.core.formatters.string_printer import StringPrinter diff --git a/src/ahriman/core/gitremote/__init__.py b/src/ahriman/core/gitremote/__init__.py index b9a3d66d..b35f0ec4 100644 --- a/src/ahriman/core/gitremote/__init__.py +++ b/src/ahriman/core/gitremote/__init__.py @@ -1,21 +1,21 @@ # -# copyright (c) 2021-2022 ahriman team. +# Copyright (c) 2021-2022 ahriman team. # -# this file is part of ahriman +# This file is part of ahriman # (see https://github.com/arcan1s/ahriman). # -# this program is free software: you can redistribute it and/or modify -# it under the terms of the gnu general public license as published by -# the free software foundation, either version 3 of the license, or +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# this program is distributed in the hope that it will be useful, -# but without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. see the -# gnu general public license for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# you should have received a copy of the gnu general public license -# along with this program. if not, see . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # from ahriman.core.gitremote.remote_pull_trigger import RemotePullTrigger from ahriman.core.gitremote.remote_push_trigger import RemotePushTrigger diff --git a/src/ahriman/core/gitremote/remote_pull.py b/src/ahriman/core/gitremote/remote_pull.py index 249d86d3..83ecbb0b 100644 --- a/src/ahriman/core/gitremote/remote_pull.py +++ b/src/ahriman/core/gitremote/remote_pull.py @@ -1,21 +1,21 @@ # -# copyright (c) 2021-2022 ahriman team. +# Copyright (c) 2021-2022 ahriman team. # -# this file is part of ahriman +# This file is part of ahriman # (see https://github.com/arcan1s/ahriman). # -# this program is free software: you can redistribute it and/or modify -# it under the terms of the gnu general public license as published by -# the free software foundation, either version 3 of the license, or +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# this program is distributed in the hope that it will be useful, -# but without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. see the -# gnu general public license for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# you should have received a copy of the gnu general public license -# along with this program. if not, see . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # import shutil diff --git a/src/ahriman/core/gitremote/remote_pull_trigger.py b/src/ahriman/core/gitremote/remote_pull_trigger.py index eadc191d..aa0532ff 100644 --- a/src/ahriman/core/gitremote/remote_pull_trigger.py +++ b/src/ahriman/core/gitremote/remote_pull_trigger.py @@ -1,21 +1,21 @@ # -# copyright (c) 2021-2022 ahriman team. +# Copyright (c) 2021-2022 ahriman team. # -# this file is part of ahriman +# This file is part of ahriman # (see https://github.com/arcan1s/ahriman). # -# this program is free software: you can redistribute it and/or modify -# it under the terms of the gnu general public license as published by -# the free software foundation, either version 3 of the license, or +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# this program is distributed in the hope that it will be useful, -# but without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. see the -# gnu general public license for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# you should have received a copy of the gnu general public license -# along with this program. if not, see . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # from ahriman.core.configuration import Configuration from ahriman.core.gitremote.remote_pull import RemotePull diff --git a/src/ahriman/core/gitremote/remote_push.py b/src/ahriman/core/gitremote/remote_push.py index 73736172..19102a5a 100644 --- a/src/ahriman/core/gitremote/remote_push.py +++ b/src/ahriman/core/gitremote/remote_push.py @@ -1,21 +1,21 @@ # -# copyright (c) 2021-2022 ahriman team. +# Copyright (c) 2021-2022 ahriman team. # -# this file is part of ahriman +# This file is part of ahriman # (see https://github.com/arcan1s/ahriman). # -# this program is free software: you can redistribute it and/or modify -# it under the terms of the gnu general public license as published by -# the free software foundation, either version 3 of the license, or +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# this program is distributed in the hope that it will be useful, -# but without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. see the -# gnu general public license for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# you should have received a copy of the gnu general public license -# along with this program. if not, see . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # import shutil diff --git a/src/ahriman/core/gitremote/remote_push_trigger.py b/src/ahriman/core/gitremote/remote_push_trigger.py index 6ee5401b..aea0896e 100644 --- a/src/ahriman/core/gitremote/remote_push_trigger.py +++ b/src/ahriman/core/gitremote/remote_push_trigger.py @@ -1,21 +1,21 @@ # -# copyright (c) 2021-2022 ahriman team. +# Copyright (c) 2021-2022 ahriman team. # -# this file is part of ahriman +# This file is part of ahriman # (see https://github.com/arcan1s/ahriman). # -# this program is free software: you can redistribute it and/or modify -# it under the terms of the gnu general public license as published by -# the free software foundation, either version 3 of the license, or +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# this program is distributed in the hope that it will be useful, -# but without any warranty; without even the implied warranty of -# merchantability or fitness for a particular purpose. see the -# gnu general public license for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# you should have received a copy of the gnu general public license -# along with this program. if not, see . +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . # from typing import Iterable diff --git a/src/ahriman/core/report/telegram.py b/src/ahriman/core/report/telegram.py index b939b5db..83965c02 100644 --- a/src/ahriman/core/report/telegram.py +++ b/src/ahriman/core/report/telegram.py @@ -17,8 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# technically we could use python-telegram-bot, but it is just a single request, cmon -import requests +import requests # technically we could use python-telegram-bot, but it is just a single request, cmon from typing import Iterable diff --git a/tests/ahriman/core/build_tools/test_sources.py b/tests/ahriman/core/build_tools/test_sources.py index a78b82f6..9fdf1145 100644 --- a/tests/ahriman/core/build_tools/test_sources.py +++ b/tests/ahriman/core/build_tools/test_sources.py @@ -264,7 +264,7 @@ def test_commit(sources: Sources, mocker: MockerFixture) -> None: commit_message = "Commit message" sources.commit(local, commit_message=commit_message) check_output_mock.assert_called_once_with( - "git", "commit", "--all", "--message", commit_message, + "git", "commit", "--allow-empty", "--message", commit_message, exception=None, cwd=local, logger=pytest.helpers.anyvar(int) ) @@ -278,7 +278,7 @@ def test_commit_autogenerated(sources: Sources, mocker: MockerFixture) -> None: local = Path("local") sources.commit(Path("local")) check_output_mock.assert_called_once_with( - "git", "commit", "--all", "--message", pytest.helpers.anyvar(str, strict=True), + "git", "commit", "--allow-empty", "--message", pytest.helpers.anyvar(str, strict=True), exception=None, cwd=local, logger=pytest.helpers.anyvar(int) )