summaryrefslogtreecommitdiffstats
path: root/build/create_repo.sh
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-11-20 12:51:17 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-11-23 08:56:24 +0100
commit7f8b8e7cdc41ef31a11516340aa58b28e23e2175 (patch)
tree208a5ec5e0b9ee13b91453e6cb66b980463d9247 /build/create_repo.sh
parentaefd99bf33417653d779b44a9e2365cdfd6b53ab (diff)
Enhance repo creation scripts idempotency by supporting caching
While 'yumdownloader' and 'apt-get download' commands do not re-download packages that are already present in working dir, scripts still need to perform package dependencies resolution which is a time consuming activity hence a feature was added to skip any further actions (download or deps resolution) on packages that are already present locally. For cold versus warm cache the gain in run time is: cold warm RPM 90s 10s DEB 7m 90s Change-Id: Ie502934cff6484844557832251e7ce0991789cfb Issue-ID: OOM-2635 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'build/create_repo.sh')
-rwxr-xr-xbuild/create_repo.sh21
1 files changed, 19 insertions, 2 deletions
diff --git a/build/create_repo.sh b/build/create_repo.sh
index e70d69b2..f2bde32d 100755
--- a/build/create_repo.sh
+++ b/build/create_repo.sh
@@ -18,6 +18,9 @@ container_repo_volume="/mnt/repo/"
# Additional packages lists files path within container
container_list_volume="/mnt/additional-lists/"
+# Use cache by default
+drop_cache=false
+
# Show script usage
help () {
cat <<EOF
@@ -34,6 +37,7 @@ usage: create_repo.sh [OPTION]...
-t | --target-platform target repository platform type (ubuntu/rhel/centos)
-a | --additional-list additional packages list; can be used multiple times for more additional lists
-n | --container-name-suffix add custom suffix to docker container name
+ -r | --drop-cache remove cached packages (use package cache by default)
-h | --help show this help
If build folder from offline repository is not specified current one will be used by default.
@@ -82,24 +86,33 @@ do
# Directory parameter
# Set path to offline-installer build directory
volume_offline_directory="$2"
+ shift
;;
-d|--destination-repository)
# Repository directory parameter
# Set destination path for created repository
volume_repo_directory="$2"
+ shift
;;
-t|--target-platform)
# Repository type (rpm/deb)
# Set target platform for repository
target_input="$2"
+ shift
;;
-a|--additional-list)
# Array of additional packages lists
additional_lists+=("$2")
+ shift
;;
-n|--container-name-suffix)
# Set custom container name suffix
container_name_suffix="_${2}"
+ shift
+ ;;
+ -r|--drop-cache)
+ # Set flag to clean cache
+ drop_cache=true
;;
*)
# unknown option
@@ -107,7 +120,7 @@ do
exit 1
;;
esac
- shift;shift
+ shift
done
# Check if user specified repository type
@@ -148,6 +161,10 @@ then
param_array+=(--directory ${container_repo_volume})
param_array+=(--list ${container_offline_volume}data_lists/)
param_array+=(--packages-lists-path ${container_list_volume})
+ if ${drop_cache};
+ then
+ param_array+=(--drop-cache)
+ fi
[[ ! ${#additional_lists[@]} -eq 0 ]] && \
for array_list in "${additional_lists[@]}";
do
@@ -155,7 +172,7 @@ then
mounted_lists+=(-v ${array_list}:${container_list_volume}${array_list##*/})
done
- docker run --name $container_name \
+ docker run --name $container_name \
-v ${volume_offline_directory}:${container_offline_volume} \
-v ${volume_repo_directory}:${container_repo_volume} \
"${mounted_lists[@]}" \