xbps-src: fixed some bugs in autoremove_pkg_dependencies().
- Do not remove subpkgs, only the sourcepkg. - Do not rmeove the pkg we wanted to install. - Simplify the code a bit.
This commit is contained in:
parent
43b83532bf
commit
2a01a90588
1 changed files with 9 additions and 19 deletions
|
@ -92,7 +92,7 @@ install_pkg_from_repos()
|
||||||
|
|
||||||
autoremove_pkg_dependencies()
|
autoremove_pkg_dependencies()
|
||||||
{
|
{
|
||||||
local cmd saved_pkgname x f found
|
local cmd curpkgname f
|
||||||
|
|
||||||
[ -n "$1" ] && return 0
|
[ -n "$1" ] && return 0
|
||||||
|
|
||||||
|
@ -111,29 +111,19 @@ autoremove_pkg_dependencies()
|
||||||
fi
|
fi
|
||||||
# Maybe some dependency wasn't available in repositories and it had
|
# Maybe some dependency wasn't available in repositories and it had
|
||||||
# to be built from source, remove them too.
|
# to be built from source, remove them too.
|
||||||
saved_pkgname=$pkgname
|
|
||||||
for f in $($XBPS_BIN_CMD list|awk '{print $1}'); do
|
for f in $($XBPS_BIN_CMD list|awk '{print $1}'); do
|
||||||
pkgname=$($XBPS_PKGDB_CMD getpkgname $f)
|
curpkgname=$($XBPS_PKGDB_CMD getpkgname $f)
|
||||||
[ "$pkgname" = "$saved_pkgname" ] && continue
|
[ "${_ORIGINPKG}" = "$curpkgname" ] && continue
|
||||||
if [ -f $XBPS_PKGMETADIR/$pkgname/flist ]; then
|
if [ -f $XBPS_PKGMETADIR/$curpkgname/flist ]; then
|
||||||
setup_tmpl $pkgname
|
# ignore subpkgs.
|
||||||
for x in ${subpackages}; do
|
setup_subpkg_tmpl $curpkgname
|
||||||
if [ "$pkgname" = "$x" ]; then
|
[ -n "$SUBPKG" ] && continue
|
||||||
found=1
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ -n "$found" ]; then
|
|
||||||
# ignore subpkgs.
|
|
||||||
unset found
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
# remove pkg.
|
# remove pkg.
|
||||||
msg_warn "removing package $pkgname installed from source...\n"
|
msg_warn "removing package $curpkgname installed from source...\n"
|
||||||
remove_pkg
|
remove_pkg
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
setup_tmpl $saved_pkgname
|
setup_tmpl ${_ORIGINPKG}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue