Skip to content

Commit

Permalink
Use XDG_CACHE_HOME for non-root
Browse files Browse the repository at this point in the history
Allows building as regular user with arbitrary repos
  • Loading branch information
lnussel committed Jan 24, 2022
1 parent 1f7008c commit 953915d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ BUILD_FLAVOR=
OBS_PACKAGE=
OBSURL=
NO_TIMESTAMPS=
CACHE_DIR=/var/cache/build
BUILD_DIST_TMP=
BUILD_SUCCEEDED=
COPY_SOURCES_ASIS=
Expand Down Expand Up @@ -991,6 +990,8 @@ trap fail_exit EXIT

. $BUILD_DIR/common_functions || exit 1

detect_cache_dir

shopt -s nullglob

export PATH=$BUILD_DIR:/sbin:/usr/sbin:/bin:/usr/bin:$PATH
Expand Down
8 changes: 8 additions & 0 deletions common_functions
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,11 @@ assert_dir_path() {
test "$1" != "${1%/*}" && assert_dir_path "${1%/*}"
assert_dirs "$1"
}

detect_cache_dir() {
if test -w /; then
CACHE_DIR=/var/cache/build
else
CACHE_DIR=${XDG_CACHE_HOME:-~/.cache}/opensuse.org/build/cache
fi
}
3 changes: 2 additions & 1 deletion init_buildsystem
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ repos=()

. $BUILD_DIR/common_functions || exit 1

detect_cache_dir

# should RPMs be installed with --force ?
USE_FORCE=false
PREPARE_VM=
Expand All @@ -58,7 +60,6 @@ RPMLIST=
CLEAN_BUILD=
CREATE_BUILD_BINARIES=
DLNOSIGNATURE=
CACHE_DIR=/var/cache/build
OBSURL=
BUILD_SYSROOT=
test -z "$CONFIG_DIR" && CONFIG_DIR="$BUILD_DIR/configs"
Expand Down

0 comments on commit 953915d

Please sign in to comment.