Compare commits

..

1 Commits

Author SHA1 Message Date
607b728f10 remove excess dependencies leaves 2024-06-04 16:02:26 +03:00
7 changed files with 23 additions and 34 deletions

View File

@ -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-systemd rsync subversion && \
pacman -Sy --noconfirm --asdeps breezy git mercurial python-aiohttp python-boto3 python-cryptography python-jinja python-requests-unixsocket 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-requests-unixsocket2
python-aiohttp-jinja2 python-aiohttp-session python-aiohttp-security
## 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"

View File

@ -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-unixsocket2`` 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-unixsocket`` library is required.
Middlewares
^^^^^^^^^^^

View File

@ -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-unixsocket2`` 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-unixsocket`` package to be installed):
.. code-block:: ini

View File

@ -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-unixsocket2: client report to web server by unix socket'
'python-requests-unixsocket: client report to web server by unix socket'
'python-jinja: html report generation'
'python-systemd: journal support'
'rsync: sync by using rsync'

View File

@ -81,7 +81,7 @@ web = [
"aiohttp_session",
"aiohttp_security",
"cryptography",
"requests-unixsocket2", # required by unix socket support
"requests-unixsocket", # required by unix socket support
"setuptools", # required by aiohttp-apispec
]

View File

@ -27,16 +27,16 @@ class FilesystemPackage:
class representing a simplified model for the package installed to filesystem
Attributes:
package_name(str): package name
base(str): package base 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
"""
package_name: str
groups: set[str]
dependencies: set[str]
base: str
groups: list[str]
dependencies: list[str]
directories: list[Path] = field(default_factory=list)
files: list[Path] = field(default_factory=list)
@ -50,6 +50,3 @@ 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})'

View File

@ -105,16 +105,16 @@ class PackageArchive:
Returns:
FilesystemPackage: generated pacman package model with empty paths
"""
package_name, *_ = path.parent.name.rsplit("-", 2)
package_base, *_ = path.parent.name.rsplit("-", 2)
try:
pacman_package = OfficialSyncdb.info(package_name, pacman=self.pacman)
pacman_package = OfficialSyncdb.info(package_base, pacman=self.pacman)
return FilesystemPackage(
package_name=package_name,
groups=set(pacman_package.groups),
dependencies=set(pacman_package.depends),
base=package_base,
groups=pacman_package.groups,
dependencies=pacman_package.depends,
)
except UnknownPackageError:
return FilesystemPackage(package_name=package_name, groups=set(), dependencies=set())
return FilesystemPackage(base=package_base, groups=[], dependencies=[])
def depends_on(self) -> Dependencies:
"""
@ -126,7 +126,7 @@ class PackageArchive:
dependencies, roots = self.depends_on_paths()
installed_packages = self.installed_packages()
dependencies_per_path: dict[Path, list[FilesystemPackage]] = {}
result: dict[str, list[FilesystemPackage]] = {}
for package_base, package in installed_packages.items():
if package_base in self.package.packages:
continue # skip package itself
@ -135,24 +135,16 @@ class PackageArchive:
required_by.extend(library for library in package.files if library.name in dependencies)
for path in required_by:
dependencies_per_path.setdefault(path, []).append(package)
result.setdefault(str(path), []).append(package)
# reduce trees
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 path, packages in result.items():
root_packages = [
package
for package 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 not any(package.base in other.dependencies for other in packages)
]
if str(path) == 'usr/lib/python3.12/site-packages':
print(package_names)
print(packages)
print(result[str(path)])
return Dependencies(result)
@ -203,6 +195,6 @@ class PackageArchive:
else:
package.files.append(entry)
result[package.package_name] = package
result[package.base] = package
return result