From 38de2e6d04cdca4c10f6a4a76dbe8bf444488020 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Mon, 7 Oct 2019 12:07:25 +0000 Subject: kiss: add options to remove junk files FossilOrigin-Name: 2f76d12705ce7d092a95330ee7822c3d3663aab6937076f465a19163dce0753f --- kiss | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/kiss b/kiss index 93ba4ed..3d8ac4e 100755 --- a/kiss +++ b/kiss @@ -304,6 +304,61 @@ pkg_fixdeps() { rm -f depends-copy } +pkg_junk() ( + # Optionally remove "junk" files from packages. This includes 'info' + # files, 'man' pages, gettext files, etc. This is configurable by the + # user to enable choice. + # + # This funcion runs as a sub-shell to avoid having to 'cd' back to the + # prior directory before being able to continue. + cd "$pkg_dir/$1" + + # Man pages (kept by default). + [ "${KISS_KEEP_MAN:-1}" = 1 ] || { + log "$1" "Removing man pages" + + rm -rf usr/share/man + } + + # Info files (deleted by default). + [ "${KISS_KEEP_INFO:-0}" = 1 ] || { + log "$1" "Removing info files" + + rm -rf usr/share/info + } + + # Intl files (deleted by default). + [ "${KISS_KEEP_INTL:-0}" = 1 ] || { + log "$1" "Removing intl files" + + rm -rf usr/share/gettext + rm -rf usr/share/locale + } + + # Documentation (deleted by default). + [ "${KISS_KEEP_DOC:-0}" = 1 ] || { + log "$1" "Removing documentation" + + rm -rf usr/share/doc + rm -rf usr/share/gtk-doc + } + + # Shell completions (deleted by default). + [ "${KISS_KEEP_SHCOMP:-0}" = 1 ] || { + log "$1" "Removing shell completions" + + rm -rf etc/bash_completion.d + rm -rf usr/share/zsh + } + + # Misc junk (deleted by default). + [ "${KISS_KEEP_JUNK:-0}" = 1 ] || { + log "$1" "Removing junk" + + rm -rf usr/share/polkit-1 + } +) + pkg_manifest() ( # Generate the package's manifest file. This is a list of each file # and directory inside the package. The file is used when uninstalling @@ -467,6 +522,7 @@ pkg_build() { pkg_strip "$pkg" pkg_fixdeps "$pkg" + pkg_junk "$pkg" pkg_manifest "$pkg" pkg_tar "$pkg" -- cgit v1.2.3 From 3286ba1311df21afd526777d2c32bb2eaa0ef8ad Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Mon, 7 Oct 2019 12:48:35 +0000 Subject: kiss: better junk removal. FossilOrigin-Name: 93bd28a4112ff532a71f6785f634ea277d7ed1afb65c1940bafa9a7414145cbd --- kiss | 60 +++++++++++++++++------------------------------------------- 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/kiss b/kiss index 3d8ac4e..692e0e2 100755 --- a/kiss +++ b/kiss @@ -307,56 +307,30 @@ pkg_fixdeps() { pkg_junk() ( # Optionally remove "junk" files from packages. This includes 'info' # files, 'man' pages, gettext files, etc. This is configurable by the - # user to enable choice. + # user. # # This funcion runs as a sub-shell to avoid having to 'cd' back to the # prior directory before being able to continue. cd "$pkg_dir/$1" - # Man pages (kept by default). - [ "${KISS_KEEP_MAN:-1}" = 1 ] || { - log "$1" "Removing man pages" + # Default list of directories and their contents to be removed from + # built packages. This default assumes a prefix of '/usr' though the + # user can further configure it to search whatever paths they desire. + rm_default=usr/share/doc:usr/share/gtk-doc:usr/share/info:usr/share/polkit-1 + rm_default=$rm_default:usr/share/gettext:usr/share/locale + rm_default=$rm_default:etc/bash_completion.d:usr/share/zsh - rm -rf usr/share/man - } - - # Info files (deleted by default). - [ "${KISS_KEEP_INFO:-0}" = 1 ] || { - log "$1" "Removing info files" - - rm -rf usr/share/info - } - - # Intl files (deleted by default). - [ "${KISS_KEEP_INTL:-0}" = 1 ] || { - log "$1" "Removing intl files" - - rm -rf usr/share/gettext - rm -rf usr/share/locale - } - - # Documentation (deleted by default). - [ "${KISS_KEEP_DOC:-0}" = 1 ] || { - log "$1" "Removing documentation" - - rm -rf usr/share/doc - rm -rf usr/share/gtk-doc - } - - # Shell completions (deleted by default). - [ "${KISS_KEEP_SHCOMP:-0}" = 1 ] || { - log "$1" "Removing shell completions" - - rm -rf etc/bash_completion.d - rm -rf usr/share/zsh - } - - # Misc junk (deleted by default). - [ "${KISS_KEEP_JUNK:-0}" = 1 ] || { - log "$1" "Removing junk" + # Split the environment variable on ':' and turn it into an argument + # list. This works exactly like '$KISS_PATH'. + # + # shellcheck disable=2046,2086 + { IFS=:; set -- ${KISS_RM:-$rm_default}; IFS=$old_ifs; } - rm -rf usr/share/polkit-1 - } + # Loop over each junk entry and delete it if it exists. + for junk; do + [ -e "./$junk" ] && find "./$junk" -delete && + log "${PWD##*/}" "Removed $junk" + done ||: ) pkg_manifest() ( -- cgit v1.2.3 From 5d31b4db98509f683d52a311f3ee2d5ecbb6264e Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Mon, 7 Oct 2019 12:50:53 +0000 Subject: kiss: Just use rm FossilOrigin-Name: d32f19559f213e05c7b09fec984f114ef9332e3cc5888df10c131ec385763b73 --- kiss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiss b/kiss index 692e0e2..bff16d6 100755 --- a/kiss +++ b/kiss @@ -328,7 +328,7 @@ pkg_junk() ( # Loop over each junk entry and delete it if it exists. for junk; do - [ -e "./$junk" ] && find "./$junk" -delete && + [ -e "./$junk" ] && rm -rf "./$junk" && log "${PWD##*/}" "Removed $junk" done ||: ) -- cgit v1.2.3 From 74e7dc2b6f8eb2d650711233f41f799b9a62ac6b Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Mon, 7 Oct 2019 12:58:36 +0000 Subject: kiss: Fix KISS_RM when blank but set FossilOrigin-Name: dbbfb457aeaeec001d196ccd723165c0cb2343eca513410a771e4e15df04ddcb --- kiss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiss b/kiss index bff16d6..11e1f4e 100755 --- a/kiss +++ b/kiss @@ -324,7 +324,7 @@ pkg_junk() ( # list. This works exactly like '$KISS_PATH'. # # shellcheck disable=2046,2086 - { IFS=:; set -- ${KISS_RM:-$rm_default}; IFS=$old_ifs; } + { IFS=:; set -- ${KISS_RM-$rm_default}; IFS=$old_ifs; } # Loop over each junk entry and delete it if it exists. for junk; do -- cgit v1.2.3