[PATCH] cnf/repo.postsync.d/example: add egencache --update-pkg-desc-index (bug 735626)

Zac Medico <[email protected]>
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
Add an egencache --update-pkg-desc-index example for users
of app-portage/esearch to migrate to.

Bug: https://bugs.gentoo.org/735626
Signed-off-by: Zac Medico <[email protected]>
---
 cnf/repo.postsync.d/example | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/cnf/repo.postsync.d/example b/cnf/repo.postsync.d/example
index 533bf719c..6c349ab3c 100644
--- a/cnf/repo.postsync.d/example
+++ b/cnf/repo.postsync.d/example
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Example /etc/portage/repo.postsync.d script. Make it executable (chmod +x) for
 # Portage to process it.
 #
@@ -45,6 +45,19 @@ if [ -n "${repository_name}" ]; then
 			ret=1
 		fi
 	fi
+
+	# Regenerate the metadata/pkg_desc_index file if needed. It's not
+	# needed for https://gitweb.gentoo.org/repo/sync/gentoo.git which
+	# provides a freshly generated copy.
+	if [[ ! -e ${repository_path}/metadata/pkg_desc_index || (
+		-d ${repository_path}/metadata/md5-cache &&
+		-n "$(find "${repository_path}/metadata/md5-cache" -type f -newer "${repository_path}/metadata/pkg_desc_index" -print -quit)" ) ]]; then
+		if ! egencache --update-pkg-desc-index --repo="${repository_name}"
+		then
+			echo "!!! egencache failed!"
+			ret=1
+		fi
+	fi
 fi
 
 # Return explicit status.
-- 
2.25.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.