mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-27 14:22:10 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
67b97a64ea | |||
7ace74af44 | |||
b7d481858d | |||
f753563804 | |||
4727894349 | |||
4b98b21a70 |
@ -1,7 +1,7 @@
|
||||
# Maintainer: Evgeniy Alekseev
|
||||
|
||||
pkgname='ahriman'
|
||||
pkgver=0.11.5
|
||||
pkgver=0.11.7
|
||||
pkgrel=1
|
||||
pkgdesc="ArcHlinux ReposItory MANager"
|
||||
arch=('any')
|
||||
@ -23,7 +23,7 @@ optdepends=('aws-cli: sync to s3'
|
||||
source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgname-$pkgver-src.tar.xz"
|
||||
'ahriman.sysusers'
|
||||
'ahriman.tmpfiles')
|
||||
sha512sums=('f81de308af2d462e4904b143808bd4f22c5479fc2ac56c6a6f562be08816d97ddc6daae0b453db98cbc236ce0abad4100f2ae4729a7444a16fbf4b61b2b7d655'
|
||||
sha512sums=('d35053c7a52e5cc2dd8a3dca6c9d9f18788296d0059683b16238a54318a74fb4c42544d0727460250e7d0f0ce1009aca96e88d3e52e6bdffab8d45e5e4901b7b'
|
||||
'13718afec2c6786a18f0b223ef8e58dccf0688bca4cdbe203f14071f5031ed20120eb0ce38b52c76cfd6e8b6581a9c9eaa2743eb11abbaca637451a84c33f075'
|
||||
'55b20f6da3d66e7bbf2add5d95a3b60632df121717d25a993e56e737d14f51fe063eb6f1b38bd81cc32e05db01c0c1d80aaa720c45cde87f238d8b46cdb8cbc4')
|
||||
backup=('etc/ahriman.ini'
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<body>
|
||||
<div class="root">
|
||||
<h1>ahriman {{ version|e }}</h1>
|
||||
<h1>ahriman {{ version|e }} ({{ architecture|e }})</h1>
|
||||
|
||||
{% include "search-line.jinja2" %}
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
<th>package base</th>
|
||||
<th>packages</th>
|
||||
<th>version</th>
|
||||
<th>architecture</th>
|
||||
<th>last update</th>
|
||||
<th>status</th>
|
||||
</tr>
|
||||
@ -31,7 +30,6 @@
|
||||
<td class="include-search"><a href="{{ package.web_url|e }}" title="{{ package.base|e }}">{{ package.base|e }}</a></td>
|
||||
<td class="include-search">{{ package.packages|join("<br>"|safe) }}</td>
|
||||
<td>{{ package.version|e }}</td>
|
||||
<td>{{ architecture|e }}</td>
|
||||
<td>{{ package.timestamp|e }}</td>
|
||||
<td class="package-{{ package.status|e }}">{{ package.status|e }}</td>
|
||||
</tr>
|
||||
|
@ -33,14 +33,12 @@
|
||||
<tr class="header">
|
||||
<th>package</th>
|
||||
<th>version</th>
|
||||
<th>architecture</th>
|
||||
</tr>
|
||||
|
||||
{% for package in packages %}
|
||||
<tr class="package">
|
||||
<td class="include-search"><a href="{{ link_path|e }}/{{ package.filename|e }}" title="{{ package.name|e }}">{{ package.name|e }}</a></td>
|
||||
<td>{{ package.version|e }}</td>
|
||||
<td>{{ architecture|e }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<style>
|
||||
:root {
|
||||
--color-building: 250, 255, 146;
|
||||
--color-building: 255, 255, 146;
|
||||
--color-failed: 255, 94, 94;
|
||||
--color-pending: 250, 255, 146;
|
||||
--color-success: 121, 255, 94;
|
||||
--color-unknown: 197, 197, 197;
|
||||
--color-pending: 255, 255, 146;
|
||||
--color-success: 94, 255, 94;
|
||||
--color-unknown: 225, 225, 225;
|
||||
}
|
||||
|
||||
@keyframes blink-building {
|
||||
@ -47,7 +47,11 @@
|
||||
background-color: rgba(235, 235, 255, 1);
|
||||
}
|
||||
|
||||
tr.header, tr.package:hover {
|
||||
tr.package:hover {
|
||||
background-color: rgba(255, 255, 225, 1);
|
||||
}
|
||||
|
||||
tr.header{
|
||||
background-color: rgba(200, 200, 255, 1);
|
||||
}
|
||||
|
||||
|
@ -113,5 +113,5 @@ if __name__ == '__main__':
|
||||
parser.print_help()
|
||||
exit(1)
|
||||
|
||||
with Lock(args.lock, args.force):
|
||||
with Lock(args.lock, args.architecture, args.force):
|
||||
args.fn(args)
|
||||
|
@ -17,28 +17,33 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
from typing import Optional
|
||||
from types import TracebackType
|
||||
from typing import Literal, Optional, Type
|
||||
|
||||
from ahriman.core.exceptions import DuplicateRun
|
||||
|
||||
|
||||
class Lock:
|
||||
|
||||
def __init__(self, path: Optional[str], force: bool) -> None:
|
||||
self.path = path
|
||||
def __init__(self, path: Optional[str], architecture: str, force: bool) -> None:
|
||||
self.path = f'{path}_{architecture}' if path is not None else None
|
||||
self.force = force
|
||||
|
||||
def __enter__(self):
|
||||
def __enter__(self) -> Lock:
|
||||
if self.force:
|
||||
self.remove()
|
||||
self.check()
|
||||
self.create()
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
def __exit__(self, exc_type: Optional[Type[Exception]], exc_val: Optional[Exception],
|
||||
exc_tb: TracebackType) -> Literal[False]:
|
||||
self.remove()
|
||||
return False
|
||||
|
||||
def check(self) -> None:
|
||||
if self.path is None:
|
||||
|
@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from pyalpm import Handle
|
||||
from pyalpm import Handle # type: ignore
|
||||
from typing import List, Set
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
|
@ -20,11 +20,10 @@
|
||||
import jinja2
|
||||
import os
|
||||
|
||||
from typing import Dict, Iterable
|
||||
from typing import Callable, Dict, Iterable
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.report.report import Report
|
||||
from ahriman.core.util import package_like
|
||||
from ahriman.models.package import Package
|
||||
from ahriman.models.sign_settings import SignSettings
|
||||
|
||||
@ -33,7 +32,6 @@ class HTML(Report):
|
||||
|
||||
def __init__(self, architecture: str, config: Configuration) -> None:
|
||||
Report.__init__(self, architecture, config)
|
||||
self.architecture = architecture
|
||||
section = config.get_section_name('html', architecture)
|
||||
self.report_path = config.get(section, 'path')
|
||||
self.link_path = config.get(section, 'link_path')
|
||||
@ -61,14 +59,14 @@ class HTML(Report):
|
||||
'version': base.version
|
||||
} for base in packages for package, filename in base.packages.items()
|
||||
]
|
||||
comparator: Callable[[Dict[str, str]], str] = lambda item: item['filename']
|
||||
|
||||
html = template.render(
|
||||
architecture=self.architecture,
|
||||
homepage=self.homepage,
|
||||
link_path=self.link_path,
|
||||
has_package_signed=SignSettings.SignPackages in self.sign_targets,
|
||||
has_repo_signed=SignSettings.SignRepository in self.sign_targets,
|
||||
packages= sorted(content, key=lambda item: item['filename']),
|
||||
packages=sorted(content, key=comparator),
|
||||
pgp_key=self.pgp_key,
|
||||
repository=self.repository)
|
||||
|
||||
|
@ -56,13 +56,17 @@ class Leaf:
|
||||
self.package = package
|
||||
self.dependencies: Set[str] = set()
|
||||
|
||||
@property
|
||||
def items(self) -> Iterable[str]:
|
||||
return self.package.packages.keys()
|
||||
|
||||
def is_root(self, packages: Iterable[Leaf]) -> bool:
|
||||
'''
|
||||
:param packages:
|
||||
:return: true if any of packages is dependency of the leaf, false otherwise
|
||||
'''
|
||||
for leaf in packages:
|
||||
if self.dependencies.intersection(leaf.package.packages.keys()):
|
||||
if self.dependencies.intersection(leaf.items):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -24,7 +24,7 @@ from typing import Optional
|
||||
|
||||
|
||||
def check_output(*args: str, exception: Optional[Exception],
|
||||
cwd = None, stderr: int = subprocess.STDOUT,
|
||||
cwd: Optional[str] = None, stderr: int = subprocess.STDOUT,
|
||||
logger: Optional[Logger] = None) -> str:
|
||||
try:
|
||||
result = subprocess.check_output(args, cwd=cwd, stderr=stderr).decode('utf8').strip()
|
||||
|
@ -19,13 +19,14 @@
|
||||
#
|
||||
from __future__ import annotations
|
||||
|
||||
import aur
|
||||
import aur # type: ignore
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from dataclasses import dataclass
|
||||
from srcinfo.parse import parse_srcinfo
|
||||
from pyalpm import vercmp # type: ignore
|
||||
from srcinfo.parse import parse_srcinfo # type: ignore
|
||||
from typing import Dict, List, Optional, Set, Type
|
||||
|
||||
from ahriman.core.alpm.pacman import Pacman
|
||||
@ -106,7 +107,7 @@ class Package:
|
||||
src_info, errors = parse_srcinfo(fn.read())
|
||||
if errors:
|
||||
raise InvalidPackageInfo(errors)
|
||||
makedepends = src_info['makedepends']
|
||||
makedepends = src_info.get('makedepends', [])
|
||||
# sum over each package
|
||||
depends: List[str] = src_info.get('depends', [])
|
||||
for package in src_info['packages'].values():
|
||||
@ -137,5 +138,5 @@ class Package:
|
||||
|
||||
def is_outdated(self, remote: Package) -> bool:
|
||||
remote_version = remote.actual_version() # either normal version or updated VCS
|
||||
result = check_output('vercmp', self.version, remote_version, exception=None)
|
||||
return True if int(result) < 0 else False
|
||||
result: int = vercmp(self.version, remote_version)
|
||||
return result < 0
|
||||
|
@ -17,4 +17,4 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
__version__ = '0.11.5'
|
||||
__version__ = '0.11.7'
|
@ -17,15 +17,19 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp.web import middleware, Request, Response
|
||||
from aiohttp.web import middleware, Request
|
||||
from aiohttp.web_exceptions import HTTPClientError
|
||||
from aiohttp.web_response import StreamResponse
|
||||
from logging import Logger
|
||||
from typing import Callable
|
||||
from typing import Awaitable, Callable
|
||||
|
||||
|
||||
def exception_handler(logger: Logger) -> Callable:
|
||||
HandlerType = Callable[[Request], Awaitable[StreamResponse]]
|
||||
|
||||
|
||||
def exception_handler(logger: Logger) -> Callable[[Request, HandlerType], Awaitable[StreamResponse]]:
|
||||
@middleware
|
||||
async def handle(request: Request, handler: Callable) -> Response:
|
||||
async def handle(request: Request, handler: HandlerType) -> StreamResponse:
|
||||
try:
|
||||
return await handler(request)
|
||||
except HTTPClientError:
|
||||
|
@ -27,4 +27,5 @@ class BaseView(View):
|
||||
|
||||
@property
|
||||
def service(self) -> Watcher:
|
||||
return self.request.app['watcher']
|
||||
watcher: Watcher = self.request.app['watcher']
|
||||
return watcher
|
||||
|
@ -17,7 +17,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from aiohttp_jinja2 import template
|
||||
import aiohttp_jinja2 # type: ignore
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
import ahriman.version as version
|
||||
@ -27,7 +28,7 @@ from ahriman.web.views.base import BaseView
|
||||
|
||||
class IndexView(BaseView):
|
||||
|
||||
@template("build-status.jinja2")
|
||||
@aiohttp_jinja2.template("build-status.jinja2") # type: ignore
|
||||
async def get(self) -> Dict[str, Any]:
|
||||
# some magic to make it jinja-friendly
|
||||
packages = [
|
||||
|
@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import aiohttp_jinja2
|
||||
import aiohttp_jinja2 # type: ignore
|
||||
import jinja2
|
||||
import logging
|
||||
|
||||
|
Reference in New Issue
Block a user