From f8d2faf571b9c154dac0902bff512b91c98a4880 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Thu, 30 Sep 2021 17:48:15 +0200 Subject: [PATCH] After building a package, remove it from pacman cache if a same name file already exists (checksums will differ) --- packages.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages.py b/packages.py index e80afd1..9ed9ce4 100644 --- a/packages.py +++ b/packages.py @@ -458,6 +458,7 @@ def add_package_to_repo(package: Package): logging.info(f'Adding {package.path} to repo') binary_dir = os.path.join(config.get_path('packages'), package.repo) pkgbuild_dir = os.path.join(config.get_path('pkgbuilds'), package.path) + pacman_cache_dir = config.get_path('pacman') os.makedirs(binary_dir, exist_ok=True) for file in os.listdir(pkgbuild_dir): @@ -467,6 +468,10 @@ def add_package_to_repo(package: Package): os.path.join(pkgbuild_dir, file), os.path.join(binary_dir, file), ) + # clean up same name package from pacman cache + cache_file = os.path.join(pacman_cache_dir, file) + if os.path.exists(cache_file): + os.unlink(cache_file) result = subprocess.run([ 'repo-add', '--remove',