Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unindex packages when they are removed #10791

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions common/hooks/post-pkg/00-register-pkg.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# This hook registers a XBPS binary package into the specified local repository.

registerpkg() {
local repo="$1" pkg="$2" arch="$3"
local repo="$1" pkg="$2" arch="$3" mode="add"

if [ ! -f ${repo}/${pkg} ]; then
msg_error "Unexistent binary package ${repo}/${pkg}!\n"
fi

printf "%s:%s:%s\n" "${arch}" "${repo}" "${pkg}" >> "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg"
if [ -n "${removed}" ]; then
mode="remove"
fi

printf "%s:%s:%s:%s\n" "${arch}" "${repo}" "${pkg}" "${mode}" >> "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg"
}

hook() {
Expand Down
21 changes: 17 additions & 4 deletions common/xbps-src/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,30 @@ done
# triggered for all new packages if any of them introduces inconsistencies.
cut -d: -f 1,2 ${XBPS_STATEDIR}/.${sourcepkg}_register_pkg | sort -u | \
while IFS=: read -r arch repo; do
paths=$(grep "^$arch:$repo:" "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg" | \
addpaths=$(grep "^$arch:$repo:.*:add$" "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg" | \
cut -d : -f 2,3 | tr ':' '/')
removepaths=$(grep "^$arch:$repo:.*:remove$" "${XBPS_STATEDIR}/.${sourcepkg}_register_pkg" | \
cut -d : -f 2,3 | tr ':' '/')
if [ -n "${arch}" ]; then
msg_normal "Registering new packages to $repo ($arch)\n"
XBPS_TARGET_ARCH=${arch} $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${paths}
if [ -n "${addpaths}" ]; then
XBPS_TARGET_ARCH=${arch} $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${addpaths}
fi
if [ -n "${removepaths}" ]; then
XBPS_TARGET_ARCH=${arch} $XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -R ${repo} ${removepaths}
fi
else
msg_normal "Registering new packages to $repo\n"
if [ -n "$XBPS_CROSS_BUILD" ]; then
$XBPS_RINDEX_XCMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${paths}
_rindex_cmd=$XBPS_RINDEX_XCMD
else
$XBPS_RINDEX_CMD ${XBPS_BUILD_FORCEMODE:+-f} -a ${paths}
_rindex_cmd=$XBPS_RINDEX_CMD
fi
if [ -n "${addpaths}" ]; then
$_rindex_cmd ${XBPS_BUILD_FORCEMODE:+-f} -a ${addpaths}
fi
if [ -n "${removepaths}" ]; then
$_rindex_cmd ${XBPS_BUILD_FORCEMODE:+-f} -R ${repo} ${removepaths}
fi
fi
done
Expand Down