diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2018-08-21 14:06:18 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2018-08-23 08:59:11 +0200 |
commit | 03203669f4006f64632def1216c83b09fbcec81e (patch) | |
tree | b7576c166c71ba84ef4f1ead0f6ff62074d162f0 | |
parent | f8cb0159ff4ebcf74dbf2ea2df484c0160fbb460 (diff) |
dim: sanity-check config settings
Shashank wanted to reuse his drm-tip repo for DIM_REPO, which doesn't
work great. Catch this.
Also group the various check functions all together for a bit of OCD.
Cc: Shashank Sharma <shashank.sharma@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
-rwxr-xr-x | dim | 43 |
1 files changed, 26 insertions, 17 deletions
@@ -316,20 +316,6 @@ function dim_uptodate fi } -function check_for_updates -{ - local stamp stampfile - - stampfile=$HOME/.dim-update-check-timestamp - - # daily check for updates based on file timestamp - stamp=$(stat --printf=%Y $stampfile 2>/dev/null || echo -n 0) - if [[ $((stamp + 24*60*60)) -lt $(date +%s) ]]; then - dim_uptodate || true - touch $stampfile - fi -} - function git_fetch_helper # remote { local remote @@ -373,7 +359,21 @@ function git_committer_email echo $committer_email } -function git_version_check +function check_for_updates +{ + local stamp stampfile + + stampfile=$HOME/.dim-update-check-timestamp + + # daily check for updates based on file timestamp + stamp=$(stat --printf=%Y $stampfile 2>/dev/null || echo -n 0) + if [[ $((stamp + 24*60*60)) -lt $(date +%s) ]]; then + dim_uptodate || true + touch $stampfile + fi +} + +function check_git_version { local min_version="git version 2.8" @@ -382,6 +382,14 @@ function git_version_check fi } +function check_dim_config +{ + if [[ "$DIM_REPO" == "drm-tip" || "$DIM_REPO" == "drm-rerere" || "$DIM_REPO" == "maintainer-tools" ]]; then + echoerr "WARNING: setting $DIM_REPO for DIM_REPO not allowed" + exit 1 + fi +} + # get message id from file # $1 = file message_get_id () @@ -2389,6 +2397,8 @@ if [[ -n "${__dim_running:-}" ]]; then fi export __dim_running=1 +check_dim_config + # Commands useful for developers don't need a full dim setup if list_developer_commands | grep -qx $subcmd; then if [ -r $DIM_PREFIX/drm-rerere/$dim_integration_config ]; then @@ -2404,9 +2414,8 @@ else read_integration_config - # occasional check for dim updates check_for_updates - git_version_check + check_git_version fi # throw away to not confuse list-aliases |