|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
# set -o errexit -o noglob are assumed.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
pkgp_fetch_git() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d01c02 |
local _tgtdir="${1}" _subdir="${2}" _url="${3}" _branch="${4}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d5afb4 |
if [ "${ARG_OFFLINE:-0}" -eq 0 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
if [ -e "${DLCACHEDIR}/${_subdir}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
(ex_build_fileop cd "${DLCACHEDIR}/${_subdir}" &&\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d5afb4 |
git pull origin "${_branch:-main}");
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d5afb4 |
git clone "${_url}" "${DLCACHEDIR}/${_subdir}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
if [ -n "${_branch}" -a \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
\( -z "${_branch#main}" \) -a \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
\( -z "${_branch#master}" \) ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
(ex_build_fileop cd "${DLCACHEDIR}/${_subdir}" &&\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d5afb4 |
git checkout -b "${_branch}");
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_build_fileop rm "${_tgtdir}/${_subdir}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
ex_build_fileop cp "${DLCACHEDIR}/${_subdir}" "${_tgtdir}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
pkgp_fetch_urls_git() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
local _tgtdir _url_spec _subdir _url _git_branch;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
_tgtdir="${1}"; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
for _url_spec in "${@}"; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d5afb4 |
_subdir="${_url_spec%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d5afb4 |
_url="${_url_spec#*=}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d5afb4 |
_url="${_url%@*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
if [ "${_url_spec#*@}" != "${_url_spec}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
802215 |
_git_branch=${_url_spec#*@};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d01c02 |
pkgp_fetch_git "${_tgtdir}" "${_subdir}" "${_url}" "${_git_branch}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
pkg_fetch_git() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
if [ ${#} -gt 0 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
pkgp_fetch_urls_git "${PKG_BASE_DIR}" "${@}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
if [ -n "${PKG_URLS_GIT}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
pkgp_fetch_urls_git "${PKG_BASE_DIR}" ${PKG_URLS_GIT};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
03a637 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
# vim:filetype=sh
|