diff options
author | 2016-04-11 16:22:19 +1200 | |
---|---|---|
committer | 2017-09-17 12:06:56 +1200 | |
commit | 3b8ec968f0c46d9448aa5cc3c3a84bf3843e4587 (patch) | |
tree | 70ee11c1aaf518f97fe81eccbef12034078a75b7 /eclass | |
parent | perl-functions.eclass: Sync documentation only (diff) | |
download | perl-overlay-3b8ec968f0c46d9448aa5cc3c3a84bf3843e4587.tar.gz perl-overlay-3b8ec968f0c46d9448aa5cc3c3a84bf3843e4587.tar.bz2 perl-overlay-3b8ec968f0c46d9448aa5cc3c3a84bf3843e4587.zip |
perl-functions.eclass: Sync perl_fix_packlist from ::gentoo
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/perl-functions.eclass | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/eclass/perl-functions.eclass b/eclass/perl-functions.eclass index 0ba96d5ef..3b6222b5d 100644 --- a/eclass/perl-functions.eclass +++ b/eclass/perl-functions.eclass @@ -159,6 +159,39 @@ perl_delete_packlist() { fi } +# @FUNCTION: perl_fix_packlist +# @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 +} + # @FUNCTION: perl_remove_temppath # @DESCRIPTION: # Look through ${D} for text files containing the temporary installation |