[devel] [PATCH 2/2] gb: optimize rebuilt srpm if its identity is equal to identity of srpm in the repo

Vladimir D. Seleznev vseleznv на altlinux.org
Сб Апр 11 02:10:44 MSK 2020


---
 gb/gb-task-check-build-i | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gb/gb-task-check-build-i b/gb/gb-task-check-build-i
index 9017e12..38a6ab3 100755
--- a/gb/gb-task-check-build-i
+++ b/gb/gb-task-check-build-i
@@ -249,10 +249,26 @@ for arch in $GB_ARCH; do
 	fi
 done
 
+osrpm_identity=
+osrpm="$GB_REPO_DIR/files/SRPMS/$srpmsu"
+if [ -f "$osrpm" ]; then
+	echo >&2 "$I: Found $srpmsu in the repo, this means the package was rebuilt"
+	osrpm_identity="$(pkg_identity "$osrpm")"
+fi
+
 for arch in $GB_ARCH; do
 	[ -d "$arch/srpm" -o ! -s "$arch/excluded" ] || continue
 	f="$arch/srpm/$srpmsu"
 	[ -f "$f" ] || continue
+	srpm_identity="$(pkg_identity "$f")"
+	echo >&2 "$I: $arch $srpmsu identity = $srpm_identity"
+	# non-empty $osrpm_identity means the NEVR was rebuilt
+	# optimize rebuilt sourcerpm if identities of original and rebuilt sourcerpms are equal
+	if [ -n "$osrpm_identity" ] &&
+		   [ "$osrpm_identity" = "$srpm_identity" ]; then
+		echo >&2 "$I: $arch: optimize rebuilt $srpmsu cause its identity is equal to $srpmsu in the repo"
+		install -p "$osrpm" "$f"
+	fi
 	built_pkgname="$(rpmquery --qf '%{name}' -p -- "$f")"
 	echo "$built_pkgname" > pkgname
 	break
-- 
2.25.2



Подробная информация о списке рассылки Devel