Merge "Improve usability of the source-repositories cache"
This commit is contained in:
commit
9595197474
@ -42,7 +42,18 @@ function get_repos_for_element(){
|
|||||||
|
|
||||||
# Determine a unique cache path for this repo
|
# Determine a unique cache path for this repo
|
||||||
CACHE_NAME=$(echo "${REPOTYPE}_${REPOLOCATION}" | sha1sum | awk '{ print $1 }' )
|
CACHE_NAME=$(echo "${REPOTYPE}_${REPOLOCATION}" | sha1sum | awk '{ print $1 }' )
|
||||||
CACHE_PATH=~/.cache/image-create/repository-sources/$CACHE_NAME
|
OLD_CACHE_PATH=${CACHE_BASE}/${CACHE_NAME}
|
||||||
|
# Add the repo name to the sha1sum for readability
|
||||||
|
CACHE_NAME=${REPONAME//-/_}_${CACHE_NAME}
|
||||||
|
CACHE_PATH=${CACHE_BASE}/$CACHE_NAME
|
||||||
|
# If the old cache name exists, move it to the new cache name
|
||||||
|
if [ -e "$OLD_CACHE_PATH" ] ; then
|
||||||
|
if [ ! -e "$CACHE_PATH" ] ; then
|
||||||
|
mv -n $OLD_CACHE_PATH $CACHE_PATH
|
||||||
|
else
|
||||||
|
echo "Not replacing new cache location with old cache" && return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
case $REPOTYPE in
|
case $REPOTYPE in
|
||||||
git)
|
git)
|
||||||
@ -144,7 +155,17 @@ function get_repos_for_element(){
|
|||||||
done < $REPO_SOURCES
|
done < $REPO_SOURCES
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p ~/.cache/image-create/repository-sources/
|
CACHE_BASE=~/.cache/image-create/source-repositories
|
||||||
|
OLD_CACHE_BASE=~/.cache/image-create/repository-sources
|
||||||
|
# If the old cache name exists, move it to the new cache name
|
||||||
|
if [ -e "$OLD_CACHE_BASE" ] ; then
|
||||||
|
if [ ! -e "$CACHE_BASE" ] ; then
|
||||||
|
mv -n $OLD_CACHE_BASE $CACHE_BASE
|
||||||
|
else
|
||||||
|
echo "Not replacing new cache location with old cache" && return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
mkdir -p $CACHE_BASE
|
||||||
|
|
||||||
# Get source repositories for the target
|
# Get source repositories for the target
|
||||||
for _SOURCEREPO in $(find $TMP_HOOKS_PATH -maxdepth 1 -name "source-repository-*" -not -name '*~'); do
|
for _SOURCEREPO in $(find $TMP_HOOKS_PATH -maxdepth 1 -name "source-repository-*" -not -name '*~'); do
|
||||||
|
Loading…
Reference in New Issue
Block a user