Skip to content

Commit

Permalink
bee_cache: allow pattern metacharacter in package names
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Aug 24, 2016
1 parent 3dd3c8e commit abd6507
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/bee-cache.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ VERSION=${BEE_VERSION}
: ${BEECACHE_CACHEDIR=${BEE_CACHEDIR}/bee-cache}
: ${BEECACHE_INVENTORY=${BEECACHE_CACHEDIR}/INVENTORY}

function ere_quote() {
sed 's/[]\.|$(){}?+*^]/\\&/g' <<< "$*"
}

function cache_verify() {
if ${BEEFLOCK} --shared "${BEECACHE_INVENTORY}" \
sort -c -u -r -k8 -k1 "${BEECACHE_INVENTORY}" 2>/dev/null ; then
Expand Down Expand Up @@ -92,7 +96,7 @@ function print_conflicts() {

grep --file=<(print_conflicting_files "${pkg}" | cut -d ' ' -f8- | sed -e 's,.*, &$,') \
<( tmp_merge_install_inventory_files "${TMPINSTALL[@]}" ) \
| grep -v -E "^${pkgfullname}-[^-]+-[^-]+ "
| grep -v -E "^$(ere_quote "${pkgfullname}")-[^-]+-[^-]+ "
}

function cache_conflicts() {
Expand All @@ -118,7 +122,7 @@ function print_conflicting_files_for_pkg() {
local inventory=$2

cache_conflicts ${inventory} \
| grep -E "^${pkg} "
| grep -E "^$(ere_quote "${pkg}")"
}

function cache_uniq() {
Expand All @@ -144,7 +148,7 @@ function print_uniq_files_for_pkg() {
local inventory=$2

cache_uniq ${inventory} \
| grep -E "^${pkg} "
| grep -E "^$(ere_quote "${pkg}")"
}

function print_missing_files() {
Expand All @@ -161,7 +165,7 @@ function print_missing_files() {
echo "${line}"
fi
done < <( tmp_merge_install_inventory_files "${TMPINSTALL[@]}" ) \
| grep -E "^${pkg} "
| grep -E "^$(ere_quote "${pkg}")"
}

function tmp_merge_install_inventory_files() {
Expand Down

0 comments on commit abd6507

Please sign in to comment.