summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2016-04-10 20:11:03 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2016-04-10 20:12:17 +0200
commitabee95677957faab99ba412b96b2da40fb23c133 (patch)
tree88ad23e9c5595033249d7177a5a4e928c4c797fb /eclass
parentdev-perl/Pango: Remove old (diff)
downloadgentoo-abee95677957faab99ba412b96b2da40fb23c133.tar.gz
gentoo-abee95677957faab99ba412b96b2da40fb23c133.tar.bz2
gentoo-abee95677957faab99ba412b96b2da40fb23c133.zip
eclass: Improve packlist fixing, based on work by kent\n; bug 579492 and more
Diffstat (limited to 'eclass')
-rw-r--r--eclass/perl-functions.eclass19
1 files changed, 19 insertions, 0 deletions
diff --git a/eclass/perl-functions.eclass b/eclass/perl-functions.eclass
index 756847318366..e9c3fcbda0f6 100644
--- a/eclass/perl-functions.eclass
+++ b/eclass/perl-functions.eclass
@@ -131,12 +131,31 @@ perl_delete_emptybsdir() {
# @DESCRIPTION:
# Look through ${D} for .packlist text files containing the temporary installation
# folder (i.e. ${D}). If the pattern is found, silently replace it with `/'.
+# Remove duplicate entries; then validate all entries in the packlist against ${D}
+# and prune entries that do not correspond to installed files.
perl_fix_packlist() {
debug-print-function $FUNCNAME "$@"
+ local packlist_temp="${T}/.gentoo_packlist_temp"
find "${D}" -type f -name '.packlist' -print0 | while read -rd '' f ; do
if file "${f}" | grep -q -i " text" ; then
+ einfo "Fixing packlist file /${f#${D}}"
+
+ # remove the temporary build dir path
sed -i -e "s:${D}:/:g" "${f}"
+
+ # remove duplicate entries
+ sort -u "${f}" > "${packlist_temp}"
+ mv "${packlist_temp}" "${f}"
+
+ # remove files that dont exist
+ cat "${f}" | while read -r entry; do
+ if [ ! -e "${D}/${entry}" ]; then
+ einfo "Pruning surplus packlist entry ${entry}"
+ grep -v -x -F "${entry}" "${f}" > "${packlist_temp}"
+ mv "${packlist_temp}" "${f}"
+ fi
+ done
fi
done
}