summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authoreroen <eroen-overlay@occam.eroen.eu>2016-10-10 13:41:27 +0200
committereroen <eroen-overlay@occam.eroen.eu>2016-10-10 13:41:27 +0200
commitc2524a7956fb2cacdcd4295db6355caed057d40b (patch)
treea1a3b9456b9fe97026ddc3d114f27d92a0633c6e /eclass
parentsteamcmd-bin - don't install useless script (diff)
downloaderoen-c2524a7956fb2cacdcd4295db6355caed057d40b.tar.gz
eroen-c2524a7956fb2cacdcd4295db6355caed057d40b.tar.bz2
eroen-c2524a7956fb2cacdcd4295db6355caed057d40b.zip
steam.eclass - enable optional cache
Diffstat (limited to 'eclass')
-rw-r--r--eclass/steam.eclass41
1 files changed, 36 insertions, 5 deletions
diff --git a/eclass/steam.eclass b/eclass/steam.eclass
index a1b919a..fc0a99b 100644
--- a/eclass/steam.eclass
+++ b/eclass/steam.eclass
@@ -76,6 +76,15 @@ DEPEND="${PYTHON_DEPS}
# Only the folder named "INBOX" will be checked.
: ${STEAM_CREDS:=/etc/portage/creds_steam}
+# @ECLASS-VARIABLE: STEAM_CACHEDIR
+# @DESCRIPTION:
+# Location for caching downloaded files between runs. To disable caching, set
+# this to zero-length string.
+#
+# This should not be set by ebuilds or profiles, it is meant for user
+# configuration.
+# STEAM_CACHEDIR ?= ${DISTDIR}/steam-cache
+
# @ECLASS-VARIABLE: STEAM_FILESDIR
# @INTERNAL
# @DESCRIPTION:
@@ -224,10 +233,32 @@ steam_src_unpack() {
local cmd_platform=
[[ -n $STEAM_platform ]] && cmd_platform="+@sSteamCmdForcePlatformType ${STEAM_platform}"
- # fetch our thing to $S
+ local distdir=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}
+ : ${STEAM_CACHEDIR:=${distdir}/steam-cache}
+ if [[ -n $STEAM_CACHEDIR ]]; then
+ local fetchdir=$STEAM_CACHEDIR/$STEAM_app_id
+ if [[ ! -d $fetchdir ]]; then
+ (
+ addwrite /
+ mkdir -p "$fetchdir"
+ ) || die "Unable to create ${fetchdir}"
+ fi
+ else
+ local fetchdir=$S
+ fi
+
+ # fetch our thing
einfo "Install app_id ${STEAM_app_id}"
- esteamcmd \
- "$cmd_platform" \
- "+force_install_dir ${S}" \
- "+app_update ${STEAM_app_id} verify"
+ (
+ addwrite "${fetchdir}"
+ esteamcmd \
+ "$cmd_platform" \
+ "+force_install_dir \"$fetchdir\"" \
+ "+app_update ${STEAM_app_id} verify"
+ )
+
+ if [[ -n $STEAM_CACHEDIR ]]; then
+ einfo "Copying from cache to \$S"
+ cp -fPpR "$fetchdir" "$S" || die
+ fi
}