forked from kiss-community/kiss
kiss: super fast conflict checking
This commit is contained in:
parent
6458f56c70
commit
9493891ea5
31
kiss
31
kiss
@ -535,20 +535,27 @@ pkg_conflicts() {
|
|||||||
# This function takes a path to a KISS tar-ball as an argument.
|
# This function takes a path to a KISS tar-ball as an argument.
|
||||||
log "[$2] Checking for package conflicts"
|
log "[$2] Checking for package conflicts"
|
||||||
|
|
||||||
# Extract manifest from the tar-ball and only extract files entries.
|
|
||||||
tar xf "$1" -O "./$pkg_db/$2/manifest" | sed '/\/$/d' > "$cac_dir/$pid-m"
|
|
||||||
|
|
||||||
cd "$sys_db"
|
cd "$sys_db"
|
||||||
set +f
|
set +ef
|
||||||
|
|
||||||
# Iterate over each manifest and check it for conflicts.
|
# Extract manifest from tarball and only print file which
|
||||||
for db in *; do
|
# exist in the filesystem. It's pointless to check for conflicts
|
||||||
[ "$db" != "$2" ] &&
|
# with files which don't presently exist.
|
||||||
grep -HFxf "$cac_dir/$pid-m" "$db/manifest" 2>/dev/null &&
|
tar xf "$1" -O "./$pkg_db/$2/manifest" | while read -r file; do
|
||||||
die "Package '$2' conflicts with another package"
|
[ -f "$KISS_ROOT/$file" ] && printf '%s\n' "$file"
|
||||||
done ||:
|
done |
|
||||||
|
|
||||||
set -f
|
# Filter the existing file list through the manifest of the
|
||||||
|
# presently installed version of the package (if it exists).
|
||||||
|
grep -svFxf "$sys_db/$2/manifest" - 2>/dev/null > "$cac_dir/$pid-m"
|
||||||
|
|
||||||
|
# If the generated manifest contains matches, check the
|
||||||
|
# contents for conflicts.
|
||||||
|
[ -s "$cac_dir/$pid-m" ] &&
|
||||||
|
grep -Fxf "$cac_dir/$pid-m" -- */manifest &&
|
||||||
|
die "Package '$2' conflicts with another package"
|
||||||
|
|
||||||
|
set -ef
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_remove() {
|
pkg_remove() {
|
||||||
@ -845,7 +852,7 @@ pkg_clean() {
|
|||||||
# Block 'Ctrl+C' while cache is being cleaned.
|
# Block 'Ctrl+C' while cache is being cleaned.
|
||||||
trap '' INT
|
trap '' INT
|
||||||
|
|
||||||
# Remove temporary directories.
|
# Remove temporary items.
|
||||||
rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir" "$cac_dir/$pid-m"
|
rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir" "$cac_dir/$pid-m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user