mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-05-05 12:43:49 +00:00
Compare commits
2 Commits
607b728f10
...
9a1b34b08d
Author | SHA1 | Date | |
---|---|---|---|
9a1b34b08d | |||
e2efe21a8b |
@ -34,9 +34,9 @@ COPY "docker/install-aur-package.sh" "/usr/local/bin/install-aur-package"
|
||||
## darcs is not installed by reasons, because it requires a lot haskell packages which dramatically increase image size
|
||||
RUN pacman -Sy --noconfirm --asdeps devtools git pyalpm python-cerberus python-inflection python-passlib python-pyelftools python-requests python-srcinfo && \
|
||||
pacman -Sy --noconfirm --asdeps base-devel python-build python-flit python-installer python-wheel && \
|
||||
pacman -Sy --noconfirm --asdeps breezy git mercurial python-aiohttp python-boto3 python-cryptography python-jinja python-requests-unixsocket python-systemd rsync subversion && \
|
||||
pacman -Sy --noconfirm --asdeps breezy git mercurial python-aiohttp python-boto3 python-cryptography python-jinja python-systemd rsync subversion && \
|
||||
runuser -u build -- install-aur-package python-aioauth-client python-webargs python-aiohttp-apispec-git python-aiohttp-cors \
|
||||
python-aiohttp-jinja2 python-aiohttp-session python-aiohttp-security
|
||||
python-aiohttp-jinja2 python-aiohttp-session python-aiohttp-security python-requests-unixsocket2
|
||||
|
||||
## FIXME since 1.0.4 devtools requires dbus to be run, which doesn't work now in container
|
||||
COPY "docker/systemd-nspawn.sh" "/usr/local/bin/systemd-nspawn"
|
||||
|
@ -366,7 +366,7 @@ Web application requires the following python packages to be installed:
|
||||
* Additional web features also require ``aiohttp-apispec`` (autogenerated documentation), ``aiohttp_cors`` (CORS support, required by documentation).
|
||||
* In addition, authorization feature requires ``aiohttp_security``, ``aiohttp_session`` and ``cryptography``.
|
||||
* In addition to base authorization dependencies, OAuth2 also requires ``aioauth-client`` library.
|
||||
* In addition if you would like to disable authorization for local access (recommended way in order to run the application itself with reporting support), the ``requests-unixsocket`` library is required.
|
||||
* In addition if you would like to disable authorization for local access (recommended way in order to run the application itself with reporting support), the ``requests-unixsocket2`` library is required.
|
||||
|
||||
Middlewares
|
||||
^^^^^^^^^^^
|
||||
|
@ -1313,7 +1313,7 @@ How to enable basic authorization
|
||||
The ``salt`` parameter is optional, but recommended, and can be set to any (random) string.
|
||||
|
||||
#.
|
||||
In order to provide access for reporting from application instances you can (the recommended way) use unix sockets by the following configuration (note, that it requires ``python-requests-unixsocket`` package to be installed):
|
||||
In order to provide access for reporting from application instances you can (the recommended way) use unix sockets by the following configuration (note, that it requires ``python-requests-unixsocket2`` package to be installed):
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
|
@ -21,7 +21,7 @@ optdepends=('breezy: -bzr packages support'
|
||||
'python-aiohttp-session: web server with authorization'
|
||||
'python-boto3: sync to s3'
|
||||
'python-cryptography: web server with authorization'
|
||||
'python-requests-unixsocket: client report to web server by unix socket'
|
||||
'python-requests-unixsocket2: client report to web server by unix socket'
|
||||
'python-jinja: html report generation'
|
||||
'python-systemd: journal support'
|
||||
'rsync: sync by using rsync'
|
||||
|
@ -81,7 +81,7 @@ web = [
|
||||
"aiohttp_session",
|
||||
"aiohttp_security",
|
||||
"cryptography",
|
||||
"requests-unixsocket", # required by unix socket support
|
||||
"requests-unixsocket2", # required by unix socket support
|
||||
"setuptools", # required by aiohttp-apispec
|
||||
]
|
||||
|
||||
|
@ -27,16 +27,16 @@ class FilesystemPackage:
|
||||
class representing a simplified model for the package installed to filesystem
|
||||
|
||||
Attributes:
|
||||
base(str): package base name
|
||||
package_name(str): package name
|
||||
dependencies(list[str]): list of package dependencies
|
||||
directories(list[Path]): list of directories this package contains
|
||||
files(list[Path]): list of files this package contains
|
||||
groups(list[str]): list of groups of the package
|
||||
"""
|
||||
|
||||
base: str
|
||||
groups: list[str]
|
||||
dependencies: list[str]
|
||||
package_name: str
|
||||
groups: set[str]
|
||||
dependencies: set[str]
|
||||
directories: list[Path] = field(default_factory=list)
|
||||
files: list[Path] = field(default_factory=list)
|
||||
|
||||
@ -50,3 +50,6 @@ class FilesystemPackage:
|
||||
bool: True in case if this package must be used for the dependencies calculation or False otherwise
|
||||
"""
|
||||
return "base" not in self.groups
|
||||
|
||||
def __repr__(self):
|
||||
return f'FilesystemPackage(package_name="{self.package_name}", dependencies={self.dependencies})'
|
||||
|
@ -105,16 +105,16 @@ class PackageArchive:
|
||||
Returns:
|
||||
FilesystemPackage: generated pacman package model with empty paths
|
||||
"""
|
||||
package_base, *_ = path.parent.name.rsplit("-", 2)
|
||||
package_name, *_ = path.parent.name.rsplit("-", 2)
|
||||
try:
|
||||
pacman_package = OfficialSyncdb.info(package_base, pacman=self.pacman)
|
||||
pacman_package = OfficialSyncdb.info(package_name, pacman=self.pacman)
|
||||
return FilesystemPackage(
|
||||
base=package_base,
|
||||
groups=pacman_package.groups,
|
||||
dependencies=pacman_package.depends,
|
||||
package_name=package_name,
|
||||
groups=set(pacman_package.groups),
|
||||
dependencies=set(pacman_package.depends),
|
||||
)
|
||||
except UnknownPackageError:
|
||||
return FilesystemPackage(base=package_base, groups=[], dependencies=[])
|
||||
return FilesystemPackage(package_name=package_name, groups=set(), dependencies=set())
|
||||
|
||||
def depends_on(self) -> Dependencies:
|
||||
"""
|
||||
@ -126,7 +126,7 @@ class PackageArchive:
|
||||
dependencies, roots = self.depends_on_paths()
|
||||
installed_packages = self.installed_packages()
|
||||
|
||||
result: dict[str, list[FilesystemPackage]] = {}
|
||||
dependencies_per_path: dict[Path, list[FilesystemPackage]] = {}
|
||||
for package_base, package in installed_packages.items():
|
||||
if package_base in self.package.packages:
|
||||
continue # skip package itself
|
||||
@ -135,16 +135,24 @@ class PackageArchive:
|
||||
required_by.extend(library for library in package.files if library.name in dependencies)
|
||||
|
||||
for path in required_by:
|
||||
result.setdefault(str(path), []).append(package)
|
||||
dependencies_per_path.setdefault(path, []).append(package)
|
||||
|
||||
# reduce trees
|
||||
for path, packages in result.items():
|
||||
root_packages = [
|
||||
package
|
||||
result = {}
|
||||
for path, packages in dependencies_per_path.items():
|
||||
package_names = [package.package_name for package in packages]
|
||||
result[str(path)] = [
|
||||
package.package_name
|
||||
for package in packages
|
||||
if not any(package.base in other.dependencies for other in packages)
|
||||
# if there is any package which is dependency of this package, we can skip it here
|
||||
# also skip packages which didn't pass validation
|
||||
if not package.dependencies.intersection(package_names) and package.is_valid
|
||||
]
|
||||
|
||||
if str(path) == 'usr/lib/python3.12/site-packages':
|
||||
print(package_names)
|
||||
print(packages)
|
||||
print(result[str(path)])
|
||||
|
||||
return Dependencies(result)
|
||||
|
||||
@ -195,6 +203,6 @@ class PackageArchive:
|
||||
else:
|
||||
package.files.append(entry)
|
||||
|
||||
result[package.base] = package
|
||||
result[package.package_name] = package
|
||||
|
||||
return result
|
||||
|
Loading…
x
Reference in New Issue
Block a user