Skip to content

Commit 7d19352

Browse files
xumiamssonicbld
authored andcommitted
[Build] Remove the additional space character in the mirrors.list file (sonic-net#13812)
Why I did it Fix all mirror is commented out in sources.list in slave image issue. It will have an issue when installing more packages in the slave container. It will add additional space character after running add-apt-repository command. For example: The original config in /etc/apt/sources.list #deb [arch=amd64] http://deb.debian.org/debian/ bullseye main contrib non-free Run the following command: add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable" Then the setting changed to: (added a new space character after #) # deb [arch=amd64] http://deb.debian.org/debian/ bullseye main contrib non-free How I did it Fix the regex string to add the space pattern. After fixed, whether there is a space character or not, it will not be an issue. How to verify it
1 parent d1d5bce commit 7d19352

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sonic-build-hooks/scripts/buildinfo_base.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ check_if_url_exist()
7171
set_reproducible_mirrors()
7272
{
7373
# Remove the charater # in front of the line if matched
74-
local expression="s/^#\(.*$REPR_MIRROR_URL_PATTERN\)/\1/"
74+
local expression="s/^#\s*\(.*$REPR_MIRROR_URL_PATTERN\)/\1/"
7575
# Add the character # in front of the line, if not match the URL pattern condition
7676
local expression2="/^#*deb.*$REPR_MIRROR_URL_PATTERN/! s/^#*deb/#&/"
7777
local expression3="\$a#SET_REPR_MIRRORS"
7878
if [ "$1" = "-d" ]; then
7979
# Add the charater # in front of the line if match
8080
expression="s/^deb.*$REPR_MIRROR_URL_PATTERN/#\0/"
8181
# Remove the character # in front of the line, if not match the URL pattern condition
82-
expression2="/^#*deb.*$REPR_MIRROR_URL_PATTERN/! s/^#(#*deb)/\1/"
82+
expression2="/^#*deb.*$REPR_MIRROR_URL_PATTERN/! s/^#\s*(#*deb)/\1/"
8383
expression3="/#SET_REPR_MIRRORS/d"
8484
fi
8585

0 commit comments

Comments
 (0)