fix: force dry run build on task initialization for VCS packages

Previously if package is VCS and version in PKGBUILD doesn't match to
AUR one, then makepkg will update pkgbuild ignoring all previous pkgrel
patches

With this change during task init dry ryn process is always run for vcs
packages
This commit is contained in:
2025-01-27 15:46:41 +02:00
parent a07b20bf50
commit a9505386c2
4 changed files with 20 additions and 7 deletions

View File

@ -149,8 +149,11 @@ class Task(LazyLogging):
str | None: current commit sha if available
"""
last_commit_sha = Sources.load(sources_dir, self.package, patches, self.paths)
if local_version is None:
return last_commit_sha # there is no local package or pkgrel increment is disabled
if self.package.is_vcs: # if package is VCS, then make sure to update PKGBUILD to the latest version
self.build(sources_dir, dry_run=True)
if local_version is None: # there is no local package or pkgrel increment is disabled
return last_commit_sha
# load fresh package
loaded_package = Package.from_build(sources_dir, self.architecture, None)

View File

@ -432,8 +432,6 @@ class Package(LazyLogging):
with self.suppress_logging():
# create fresh chroot environment, fetch sources and - automagically - update PKGBUILD
task.init(paths.cache_for(self.base), [], None)
task.build(paths.cache_for(self.base), dry_run=True)
pkgbuild = Pkgbuild.from_file(paths.cache_for(self.base) / "PKGBUILD")
return full_version(pkgbuild.get("epoch"), pkgbuild["pkgver"], pkgbuild["pkgrel"])