Skip to content

Commit

Permalink
Merge branch 'master' into fixes
Browse files Browse the repository at this point in the history
* master:
  bee-cache: New command 'grep [grep-options] [pattern]'
  bee-cache: let cache_verify rebuild the main INVENTORY on error
  • Loading branch information
mariux committed Aug 13, 2012
2 parents cd594ff + e1a0957 commit 610774f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/bee-cache.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ VERSION=${BEE_VERSION}
: ${BEECACHE_INVENTORY=${BEECACHE_CACHEDIR}/INVENTORY}

function cache_verify() {
if ! ${BEEFLOCK} --shared "${BEECACHE_INVENTORY}" \
if ${BEEFLOCK} --shared "${BEECACHE_INVENTORY}" \
sort -c -u -r -k8 -k1 "${BEECACHE_INVENTORY}" 2>/dev/null ; then
rm -fr "${BEECACHE_CACHEDIR}"
return
fi

rm -fr "${BEECACHE_CACHEDIR}"
mkdir -p "${BEECACHE_CACHEDIR}"

${BEEFLOCK} ${BEECACHE_INVENTORY} \
${BEE_LIBEXECDIR}/bee/bee-cache-update >/dev/null
}

function cache_update() {
Expand All @@ -67,6 +71,11 @@ function cache_update_pkg() {
return 0
}

function cache_grep() {
${BEEFLOCK} --shared ${BEECACHE_INVENTORY} \
grep "${@}" ${BEECACHE_INVENTORY}
}

function print_conflicts() {
local pkg=${1}

Expand Down Expand Up @@ -235,6 +244,9 @@ cache_verify
tmpinstall_to_filenames

case "${cmd}" in
grep)
cache_grep "${@}" | cut -d ' ' -f${FIELDS}
;;
update)
cache_update "${@}"
;;
Expand Down

0 comments on commit 610774f

Please sign in to comment.