sqg: Added a simple filesystem cache.

Closed #27.

Signed-off-by: Willy Sudiarto Raharjo <willysr@sbopkg.org>
This commit is contained in:
Marcel Saegebarth 2017-03-11 00:14:05 +07:00 committed by Willy Sudiarto Raharjo
parent 93591f2036
commit 679a09aea2
No known key found for this signature in database
GPG Key ID: 887B8374D7333381
2 changed files with 19 additions and 3 deletions

View File

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
# use filesystem for caching SlackBuilds
SQG_TMP_DIR=${SQG_TMP_DIR:-/tmp/sqg}
sanity_checks () { sanity_checks () {
if [ ! -e "$SBOPKG_CONF" ]; then if [ ! -e "$SBOPKG_CONF" ]; then
echo "$SBOPKG_CONF not found." echo "$SBOPKG_CONF not found."
@ -21,6 +24,9 @@ sanity_checks () {
echo "Check the configurable variables at the top of the script." echo "Check the configurable variables at the top of the script."
exit 1 exit 1
fi fi
rm -rf "$SQG_TMP_DIR"
mkdir -p "$SQG_TMP_DIR"
} }
has_parallel () { has_parallel () {
@ -74,8 +80,14 @@ search_package () {
local REPO_DIR="$1" local REPO_DIR="$1"
local SRCHAPP="$2" local SRCHAPP="$2"
cd $REPO_DIR if [[ -f "$SQG_TMP_DIR/$SRCHAPP" ]]; then
PKGPATH=($(find -type d -mindepth 2 -maxdepth 2 -name "$SRCHAPP" | sort)) 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 if [ -z "$PKGPATH" ]; then
return 1 return 1
else else

View File

@ -1,10 +1,14 @@
SBOPKG NEWS SBOPKG NEWS
sbopkg-dev (2017-03-11 17:05 UTC) sbopkg-dev (2017-03-11 17:34 UTC)
FEATURES FEATURES
* sqg: Parallelize building of all packages by option -j. * sqg: Parallelize building of all packages by option -j.
Requires GNU Parallel. Requires GNU Parallel.
Patch by Marcel Saegebarth. 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 MODIFICATIONS
* bash-completion: Complete -i and -b when git repo is used * bash-completion: Complete -i and -b when git repo is used