Skip to content

Commit 3844ae8

Browse files
Fix docker-sonic-mgmt reproducible related issue. (#9647)
Reproducible build script breaks docker-sonic-mgmt build.
1 parent 98da6eb commit 3844ae8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ REPR_MIRROR_URL_PATTERN='http:\/\/packages.trafficmanager.net\/debian'
1717

1818
URL_PREFIX=$(echo "${PACKAGE_URL_PREFIX}" | sed -E "s#(//[^/]*/).*#\1#")
1919

20+
if [ $USER != 'root' ] && [ -n $(which sudo) ];then
21+
SUDO=sudo
22+
else
23+
SUDO=''
24+
fi
25+
2026
log_err()
2127
{
2228
echo "$1" >> $LOG_PATH/error.log
@@ -72,7 +78,7 @@ set_reproducible_mirrors()
7278

7379
local mirrors="/etc/apt/sources.list $(find /etc/apt/sources.list.d/ -type f)"
7480
for mirror in $mirrors; do
75-
sed -i "$expression" "$mirror"
81+
$SUDO sed -i "$expression" "$mirror"
7682
done
7783
}
7884

@@ -161,7 +167,7 @@ run_pip_command()
161167
install=y
162168
elif [[ "$para" == *.whl ]]; then
163169
package_name=$(echo $para | cut -d- -f1 | tr _ .)
164-
sed "/^${package_name}==/d" -i $tmp_version_file
170+
$SUDO sed "/^${package_name}==/d" -i $tmp_version_file
165171
fi
166172
done
167173

0 commit comments

Comments
 (0)