From 679a09aea210dc9b5d54c7008cc8a7c6b26466d0 Mon Sep 17 00:00:00 2001 From: Marcel Saegebarth Date: Sat, 11 Mar 2017 00:14:05 +0700 Subject: [PATCH] sqg: Added a simple filesystem cache. Closed #27. Signed-off-by: Willy Sudiarto Raharjo --- src/usr/libexec/sbopkg/sqg/functions | 16 ++++++++++++++-- tools/ChangeLog-latest.txt | 6 +++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/usr/libexec/sbopkg/sqg/functions b/src/usr/libexec/sbopkg/sqg/functions index b5b81d6..e8580ed 100644 --- a/src/usr/libexec/sbopkg/sqg/functions +++ b/src/usr/libexec/sbopkg/sqg/functions @@ -1,5 +1,8 @@ #!/bin/sh +# use filesystem for caching SlackBuilds +SQG_TMP_DIR=${SQG_TMP_DIR:-/tmp/sqg} + sanity_checks () { if [ ! -e "$SBOPKG_CONF" ]; then echo "$SBOPKG_CONF not found." @@ -21,6 +24,9 @@ sanity_checks () { echo "Check the configurable variables at the top of the script." exit 1 fi + + rm -rf "$SQG_TMP_DIR" + mkdir -p "$SQG_TMP_DIR" } has_parallel () { @@ -74,8 +80,14 @@ search_package () { local REPO_DIR="$1" local SRCHAPP="$2" - cd $REPO_DIR - PKGPATH=($(find -type d -mindepth 2 -maxdepth 2 -name "$SRCHAPP" | sort)) + if [[ -f "$SQG_TMP_DIR/$SRCHAPP" ]]; then + PKGPATH=$(cat "$SQG_TMP_DIR/$SRCHAPP") + else + cd $REPO_DIR + PKGPATH=($(find -type d -mindepth 2 -maxdepth 2 -name "$SRCHAPP" | sort)) + echo "$PKGPATH" > "$SQG_TMP_DIR/$SRCHAPP" + fi + if [ -z "$PKGPATH" ]; then return 1 else diff --git a/tools/ChangeLog-latest.txt b/tools/ChangeLog-latest.txt index dd8d4fe..ed1fe38 100644 --- a/tools/ChangeLog-latest.txt +++ b/tools/ChangeLog-latest.txt @@ -1,10 +1,14 @@ SBOPKG NEWS -sbopkg-dev (2017-03-11 17:05 UTC) +sbopkg-dev (2017-03-11 17:34 UTC) FEATURES * sqg: Parallelize building of all packages by option -j. Requires GNU Parallel. Patch by Marcel Saegebarth. + * sqg: Introduced new simple filesystem cache. + This will reduce queue generation time significantly when + invoked with -j N+1 (N: Number of cores) + Patch by Marcel Saegebarth. MODIFICATIONS * bash-completion: Complete -i and -b when git repo is used