commit:     2a35343c7e4ebde7a6d509b546c9d66e9f8da9a7
Author:     Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 31 02:56:06 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Jan 31 07:36:46 2020 +0000
URL:        https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=2a35343c

crossdev: update profiles/categories during uninstall

If we remove the category cross-${CTARGET} in the output overlay,
remove the category itself from profiles/categories.

Signed-off-by: Göktürk Yüksek <gokturk <AT> gentoo.org>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 crossdev | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/crossdev b/crossdev
index b460d53..9427cf1 100755
--- a/crossdev
+++ b/crossdev
@@ -555,8 +555,13 @@ uninstall() {
        ewarn "Uninstalling target '${CTARGET}' ..."
 
        # clean out portage config files
-       [[ -d ${CROSSDEV_OVERLAY}/cross-${CTARGET} ]] \
-               && rm -r ${CROSSDEV_OVERLAY}/cross-${CTARGET}
+       if [[ -d ${CROSSDEV_OVERLAY}/cross-${CTARGET} ]]; then
+               rm -r "${CROSSDEV_OVERLAY}"/cross-${CTARGET}
+               # if we remove all the package in the category,
+               # might as well remove the category itself
+               sed -e "/cross-${CTARGET}/d" \
+                   -i "${CROSSDEV_OVERLAY}"/profiles/categories
+       fi
        # crossdev stopped creating 'package.keywords' in Jan 2020
        for f in categories package.{accept_keywords,env,mask,keywords,use} 
profile/package.use.{force,mask} ; do
                f="${CONFIGROOT}/${f}"

Reply via email to