[Build]: Cleanup the reproducible mirrors when build complete (#9132)
Why I did it The reproducible build mirrors are only used during the build, the mirrors can be removed after that.
This commit is contained in:
parent
467ae5beca
commit
5947406a45
@ -11,6 +11,7 @@ POST_VERSION_PATH=$BUILDINFO_PATH/post-versions
|
||||
VERSION_DEB_PREFERENCE=$BUILDINFO_PATH/versions/01-versions-deb
|
||||
WEB_VERSION_FILE=$VERSION_PATH/versions-web
|
||||
BUILD_WEB_VERSION_FILE=$BUILD_VERSION_PATH/versions-web
|
||||
REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/debian'
|
||||
|
||||
. $BUILDINFO_PATH/config/buildinfo.config
|
||||
|
||||
@ -59,6 +60,22 @@ check_if_url_exist()
|
||||
fi
|
||||
}
|
||||
|
||||
# Enable or disable the reproducible mirrors
|
||||
set_reproducible_mirrors()
|
||||
{
|
||||
# Remove the charater # in front of the line if matched
|
||||
local expression="s/^#\(.*$REPR_MIRROR_URL_PATTERN\)/\1/"
|
||||
if [ "$1" = "-d" ]; then
|
||||
# Add the charater # in front of the line if match
|
||||
expression="s/^deb.*$REPR_MIRROR_URL_PATTERN/#\0/"
|
||||
fi
|
||||
|
||||
local mirrors="/etc/apt/sources.list $(ls /etc/apt/sources.list.d/)"
|
||||
for mirror in $mirrors; do
|
||||
sed -i "$expression" "$mirror"
|
||||
done
|
||||
}
|
||||
|
||||
download_packages()
|
||||
{
|
||||
local parameters=("$@")
|
||||
|
@ -12,3 +12,4 @@ rm -rf $BUILD_VERSION_PATH/*
|
||||
|
||||
# Disable the build hooks
|
||||
symlink_build_hooks -d
|
||||
set_reproducible_mirrors -d
|
||||
|
@ -10,6 +10,7 @@ mkdir -p $LOG_PATH
|
||||
[ -d $PRE_VERSION_PATH ] && rm -rf $PRE_VERSION_PATH
|
||||
collect_version_files $PRE_VERSION_PATH
|
||||
symlink_build_hooks
|
||||
set_reproducible_mirrors
|
||||
|
||||
chmod -R a+rw $BUILDINFO_PATH
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user