From f250049cca24d7178cb52569c1da4273884e5aa8 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Tue, 03 Mar 2026 00:47:01 +0000
Subject: [PATCH] Rebuild if in config repo

---
 src/archrepobuild/repo.py |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/archrepobuild/repo.py b/src/archrepobuild/repo.py
index 54093b9..8c64d71 100644
--- a/src/archrepobuild/repo.py
+++ b/src/archrepobuild/repo.py
@@ -211,8 +211,16 @@
             # Remove package files
             removed = 0
             for f in self.config.repository.path.glob(f"{package}-*.pkg.tar.*"):
-                f.unlink()
-                removed += 1
+                if f.name.endswith(".sig"):
+                    continue
+                name, _, _ = self._parse_pkg_filename(f.name)
+                if name == package:
+                    f.unlink()
+                    removed += 1
+                    # Also remove signature
+                    sig = f.with_suffix(f.suffix + ".sig")
+                    if sig.exists():
+                        sig.unlink()
 
             logger.info(f"Removed {package} ({removed} files)")
             return True
@@ -232,6 +240,8 @@
         # Find all package files
         files = list(self.config.repository.path.glob(pattern))
         files = [f for f in files if not f.name.endswith(".sig")]
+        # Filter to ensure exact package name match (to avoid matching sub-packages)
+        files = [f for f in files if self._parse_pkg_filename(f.name)[0] == package]
 
         if len(files) <= keep_versions:
             return 0

--
Gitblit v1.10.0