Compare commits

..

2 Commits

Author SHA1 Message Date
e64ada0067 docs and recipes updatte 2024-09-13 01:48:38 +03:00
d9a2045d32 try to improve parser 2024-09-13 01:42:43 +03:00
7 changed files with 18 additions and 43 deletions

View File

@ -15,8 +15,6 @@ pacman -Sy --noconfirm devtools git pyalpm python-inflection python-passlib pyth
pacman -Sy --noconfirm --asdeps base-devel python-build python-flit python-installer python-tox python-wheel pacman -Sy --noconfirm --asdeps base-devel python-build python-flit python-installer python-tox python-wheel
# optional dependencies # optional dependencies
if [[ -z $MINIMAL_INSTALL ]]; then if [[ -z $MINIMAL_INSTALL ]]; then
# VCS support
pacman -Sy --noconfirm breezy darcs mercurial subversion
# web server # web server
pacman -Sy --noconfirm python-aioauth-client python-aiohttp python-aiohttp-apispec-git python-aiohttp-cors python-aiohttp-jinja2 python-aiohttp-security python-aiohttp-session python-cryptography python-jinja pacman -Sy --noconfirm python-aioauth-client python-aiohttp python-aiohttp-apispec-git python-aiohttp-cors python-aiohttp-jinja2 python-aiohttp-security python-aiohttp-session python-cryptography python-jinja
# additional features # additional features

View File

@ -31,7 +31,6 @@ RUN useradd -m -d "/home/build" -s "/usr/bin/nologin" build && \
echo "build ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/build" echo "build ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/build"
COPY "docker/install-aur-package.sh" "/usr/local/bin/install-aur-package" COPY "docker/install-aur-package.sh" "/usr/local/bin/install-aur-package"
## install package dependencies ## install package dependencies
## darcs is not installed by reasons, because it requires a lot haskell packages which dramatically increase image size
RUN pacman -Sy --noconfirm --asdeps \ RUN pacman -Sy --noconfirm --asdeps \
devtools \ devtools \
git \ git \
@ -50,9 +49,7 @@ RUN pacman -Sy --noconfirm --asdeps \
python-wheel \ python-wheel \
&& \ && \
pacman -Sy --noconfirm --asdeps \ pacman -Sy --noconfirm --asdeps \
breezy \
git \ git \
mercurial \
python-aiohttp \ python-aiohttp \
python-boto3 \ python-boto3 \
python-cerberus \ python-cerberus \
@ -61,7 +58,6 @@ RUN pacman -Sy --noconfirm --asdeps \
python-matplotlib \ python-matplotlib \
python-systemd \ python-systemd \
rsync \ rsync \
subversion \
&& \ && \
runuser -u build -- install-aur-package \ runuser -u build -- install-aur-package \
python-aioauth-client \ python-aioauth-client \

View File

@ -265,11 +265,7 @@ TL;DR
How to update VCS packages How to update VCS packages
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
Normally the service handles VCS packages correctly, however it requires additional dependencies: Normally the service handles VCS packages correctly. The version is updated in clean chroot, no additional actions are required.
.. code-block:: shell
pacman -S breezy darcs mercurial subversion
How to review changes before build How to review changes before build
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -9,10 +9,7 @@ url="https://github.com/arcan1s/ahriman"
license=('GPL3') license=('GPL3')
depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-inflection' 'python-passlib' 'python-pyelftools' 'python-requests' 'python-srcinfo') depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-inflection' 'python-passlib' 'python-pyelftools' 'python-requests' 'python-srcinfo')
makedepends=('python-build' 'python-flit' 'python-installer' 'python-wheel') makedepends=('python-build' 'python-flit' 'python-installer' 'python-wheel')
optdepends=('breezy: -bzr packages support' optdepends=('python-aioauth-client: web server with OAuth2 authorization'
'darcs: -darcs packages support'
'mercurial: -hg packages support'
'python-aioauth-client: web server with OAuth2 authorization'
'python-aiohttp: web server' 'python-aiohttp: web server'
'python-aiohttp-apispec>=3.0.0: web server' 'python-aiohttp-apispec>=3.0.0: web server'
'python-aiohttp-cors: web server' 'python-aiohttp-cors: web server'
@ -26,8 +23,7 @@ optdepends=('breezy: -bzr packages support'
'python-requests-unixsocket2: 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-jinja: html report generation'
'python-systemd: journal support' 'python-systemd: journal support'
'rsync: sync by using rsync' 'rsync: sync by using rsync')
'subversion: -svn packages support')
source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgname-$pkgver.tar.gz" source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgname-$pkgver.tar.gz"
'ahriman.sysusers' 'ahriman.sysusers'
'ahriman.tmpfiles') 'ahriman.tmpfiles')

View File

@ -98,12 +98,13 @@ class Task(LazyLogging):
if self.include_debug_packages or not package.name.startswith(debug_package_prefix) if self.include_debug_packages or not package.name.startswith(debug_package_prefix)
] ]
def build(self, sources_dir: Path, **kwargs: str | None) -> list[Path]: def build(self, sources_dir: Path, *, dry_run: bool = False, **kwargs: str | None) -> list[Path]:
""" """
run package build run package build
Args: Args:
sources_dir(Path): path to where sources are sources_dir(Path): path to where sources are
dry_run(bool, optional): do not perform build itself (Default value = False)
**kwargs(str | None): environment variables to be passed to build processes **kwargs(str | None): environment variables to be passed to build processes
Returns: Returns:
@ -113,6 +114,8 @@ class Task(LazyLogging):
command.extend(self.archbuild_flags) command.extend(self.archbuild_flags)
command.extend(["--"] + self.makechrootpkg_flags) command.extend(["--"] + self.makechrootpkg_flags)
command.extend(["--"] + self.makepkg_flags) command.extend(["--"] + self.makepkg_flags)
if dry_run:
command.extend(["--nobuild"])
self.logger.info("using %s for %s", command, self.package.base) self.logger.info("using %s for %s", command, self.package.base)
environment: dict[str, str] = { environment: dict[str, str] = {
@ -159,25 +162,3 @@ class Task(LazyLogging):
patch.write(sources_dir / "PKGBUILD") patch.write(sources_dir / "PKGBUILD")
return last_commit_sha return last_commit_sha
def setup(self, sources_dir: Path) -> None:
"""
setup chroot environment without building package itself. This function, in particular, useful in case if it is
required to refresh pkgver to the actual value without package building
Args:
sources_dir(Path): path to where sources are
"""
command = [self.build_command, "-r", str(self.paths.chroot)]
command.extend(self.archbuild_flags)
command.extend(["--"] + self.makechrootpkg_flags)
command.extend(["--"] + self.makepkg_flags + ["--nobuild"])
self.logger.info("using %s for %s", command, self.package.base)
check_output(
*command,
exception=BuildError.from_process(self.package.base),
cwd=sources_dir,
logger=self.logger,
user=self.uid,
)

View File

@ -435,7 +435,7 @@ class Package(LazyLogging):
try: try:
# create fresh chroot environment, fetch sources and - automagically - update PKGBUILD # create fresh chroot environment, fetch sources and - automagically - update PKGBUILD
task.init(paths.cache_for(self.base), [], None) task.init(paths.cache_for(self.base), [], None)
task.setup(paths.cache_for(self.base)) task.build(paths.cache_for(self.base), dry_run=False)
pkgbuild = Pkgbuild.from_file(paths.cache_for(self.base) / "PKGBUILD") pkgbuild = Pkgbuild.from_file(paths.cache_for(self.base) / "PKGBUILD")

View File

@ -184,7 +184,7 @@ class Pkgbuild(Mapping[str, str | list[str]]):
raise ValueError("Function body wasn't found") raise ValueError("Function body wasn't found")
# read the specified interval from source stream # read the specified interval from source stream
io.seek(start_position - 1) # start from the previous symbol ({) io.seek(start_position - 1) # start from the previous symbol ("{")
content = io.read(end_position - start_position + 1) content = io.read(end_position - start_position + 1)
return content return content
@ -202,7 +202,7 @@ class Pkgbuild(Mapping[str, str | list[str]]):
tuple[str, PkgbuildPatch]: extracted a pair of key and its value tuple[str, PkgbuildPatch]: extracted a pair of key and its value
Raises: Raises:
StopIteration: if iteration reaches the end of the file' StopIteration: if iteration reaches the end of the file
""" """
# simple assignment rule # simple assignment rule
if (match := Pkgbuild._STRING_ASSIGNMENT.match(token)) is not None: if (match := Pkgbuild._STRING_ASSIGNMENT.match(token)) is not None:
@ -223,6 +223,14 @@ class Pkgbuild(Mapping[str, str | list[str]]):
value = Pkgbuild._parse_function(parser) value = Pkgbuild._parse_function(parser)
return token, PkgbuildPatch(key, value) # this is not mistake, assign to token without () return token, PkgbuildPatch(key, value) # this is not mistake, assign to token without ()
# special function case, where "(" and ")" are separated tokens, e.g. "pkgver ( )"
case PkgbuildToken.ArrayStarts if Pkgbuild._FUNCTION_DECLARATION.match(token):
next_token = parser.get_token()
if next_token == PkgbuildToken.ArrayEnds: # replace closing bracket with "()"
next_token = PkgbuildToken.FunctionDeclaration
parser.push_token(next_token) # type: ignore[arg-type]
return Pkgbuild._parse_token(token, parser)
# some random token received without continuation, lets guess it is empty assignment (i.e. key=) # some random token received without continuation, lets guess it is empty assignment (i.e. key=)
case other if other is not None: case other if other is not None:
return Pkgbuild._parse_token(other, parser) return Pkgbuild._parse_token(other, parser)