-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathrepo.sh
executable file
·36 lines (29 loc) · 1.48 KB
/
repo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -e
# Set OMNI_REPO_ROOT early so `repo` bootstrapping can target the repository
# root when writing out Python dependencies.
export OMNI_REPO_ROOT="$( cd "$(dirname "$0")" ; pwd -P )"
# By default custom caching is disabled in repo_man. But if a repo-cache.json
# caching configuration file is generated via the `repo cache` command, it's
# presence will trigger the configuration of custom caching.
if [[ -f "${OMNI_REPO_ROOT}/repo-cache.json" ]]; then
PM_PACKAGES_ROOT=$(grep '"PM_PACKAGES_ROOT"' "${OMNI_REPO_ROOT}/repo-cache.json" | sed 's/.*"PM_PACKAGES_ROOT": "\(.*\)".*/\1/')
# PM_PACKAGES_ROOT is present in the config file. We set this early
# so Packman will reference our cached package repository.
if [[ -n "${PM_PACKAGES_ROOT}" ]]; then
# Use eval to resolve ~ and perform parameter expansion
RESOLVED_PACKAGES_ROOT=$(eval echo "$PM_PACKAGES_ROOT")
if [[ "${RESOLVED_PACKAGES_ROOT}" != /* ]]; then
# PM_PACKAGES_ROOT is not an abs path, assumption is then
# that it is a relative path to the repository root.
PM_PACKAGES_ROOT="${OMNI_REPO_ROOT}/${RESOLVED_PACKAGES_ROOT}"
else
PM_PACKAGES_ROOT=${RESOLVED_PACKAGES_ROOT}
fi
export PM_PACKAGES_ROOT
fi
fi
SCRIPT_DIR=$(dirname ${BASH_SOURCE})
cd "$SCRIPT_DIR"
# Use "exec" to ensure that envrionment variables don't accidentally affect other processes.
exec "tools/packman/python.sh" tools/repoman/repoman.py "$@"