Skip to content

Commit 5c150bb

Browse files
committed
Fix bug
1 parent c912a8f commit 5c150bb

File tree

10 files changed

+30
-34
lines changed

10 files changed

+30
-34
lines changed

dockers/docker-base-buster/Dockerfile.j2

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ FROM multiarch/debian-debootstrap:arm64-buster
77
FROM debian:buster
88
{% endif %}
99

10-
RUN echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free" >> /etc/apt/sources.list && \
11-
echo "deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free" >> /etc/apt/sources.list
12-
1310
# Clean documentation in FROM image
1411
RUN find /usr/share/doc -depth \( -type f -o -type l \) ! -name copyright | xargs rm || true
1512

dockers/docker-base-buster/sources.list

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster mai
66
deb [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free
77
deb-src [arch=amd64] http://debian-archive.trafficmanager.net/debian-security/ buster/updates main contrib non-free
88
deb [arch=amd64] http://debian-archive.trafficmanager.net/debian/ buster-backports main contrib non-free
9+
deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free
10+
deb [arch=amd64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free

dockers/docker-base-buster/sources.list.arm64

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ deb-src [arch=arm64] http://deb.debian.org/debian buster main contrib non-free
66
deb [arch=arm64] http://security.debian.org buster/updates main contrib non-free
77
deb-src [arch=arm64] http://security.debian.org buster/updates main contrib non-free
88
deb [arch=arm64] http://deb.debian.org/debian/ buster-backports main contrib non-free
9+
deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster main contrib non-free
10+
deb [arch=arm64] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free

dockers/docker-base-buster/sources.list.armhf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ deb-src [arch=armhf] http://deb.debian.org/debian buster main contrib non-free
66
deb [arch=armhf] http://security.debian.org buster/updates main contrib non-free
77
deb-src [arch=armhf] http://security.debian.org buster/updates main contrib non-free
88
deb [arch=armhf] http://deb.debian.org/debian/ buster-backports main contrib non-free
9+
deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster main contrib non-free
10+
deb [arch=armhf] http://packages.trafficmanager.net/debian/debian buster-updates main contrib non-free

files/build/scripts/apt-get

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
INSTALL=
44
. /usr/local/share/buildinfo/scripts/buildinfo_base.sh
55

6-
VERSION_FILE="/usr/local/share/buildinfo/base-versions/versions-deb"
6+
VERSION_FILE="/usr/local/share/buildinfo/versions/versions-deb"
77
if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ]; then
88
for para in $@
99
do
@@ -13,17 +13,11 @@ if [ "$ENABLE_VERSION_CONTROL_DEB" == "y" ]; then
1313
if [ ! -z "$INSTALL" ]; then
1414
if [[ "$para" == *=* ]]; then
1515
continue
16-
package=$(echo "$para" | cut -d= -f1)
17-
version=$(echo "$para" | cut -d= -f2)
18-
if grep "^${package}=" $VERSION_FILE; then
19-
if ! grep "^${package}==${version}$" $VERSION_FILE; then
20-
EXPECTED_VERSION=$(grep "^${package}=" $VERSION_FILE | cut -d= -f3)
21-
echo "${package}=${version}, expected version is ${EXPECTED_VERSION}"
22-
exit 1
23-
fi
24-
fi
16+
elif [[ "$para" == *=* ]]; then
17+
continue
2518
else
26-
if ! grep "^${package}=" $VERSION_FILE; then
19+
package=$para
20+
if ! grep -q "^${package}=" $VERSION_FILE; then
2721
echo "The version of the package ${package} is not specified."
2822
exit 1
2923
fi

files/build/scripts/buildinfo_base.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ check_version_control()
3232
ENABLE_VERSION_CONTROL_DEB=$(check_version_control "deb")
3333
ENABLE_VERSION_CONTROL_PY2=$(check_version_control "py2")
3434
ENABLE_VERSION_CONTROL_PY3=$(check_version_control "py3")
35-
ENABLE_VERSION_CONTROL_WEB=$(check_version_control "web")
35+
ENABLE_VERSION_CONTROL_WEB=$(check_version_control "url")
3636
ENABLE_VERSION_CONTROL_GIT=$(check_version_control "git")
37-
ENABLE_VERSION_CONTROL_DCK=$(check_version_control "dck")
37+
ENABLE_VERSION_CONTROL_DCK=$(check_version_control "docker")

files/build/scripts/wget

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
COMPONENT=web
55
VERSION_FILE=$VERSION_PATH/versions-web
66
BUILD_VERSION_FILE=$BUILD_VERSION_PATH/versions-web
7-
ENABLE_VERSION_CONTROL=$(check_version_control "$COMPONENT")
87

98
[ -z $REAL_COMMAND ] && REAL_COMMAND=/usr/bin/wget
109
PARAS=("$@")
@@ -73,10 +72,10 @@ process()
7372
fi
7473

7574
real_version=$(get_version "$package_url")
76-
if [ "$ENABLE_VERSION_CONTROL" == "y" ] && [ "$version" != "$real_version" ]; then
75+
if [ "$ENABLE_VERSION_CONTROL_WEB" == "y" ] && [ "$version" != "$real_version" ]; then
7776
return 1
7877
fi
79-
elif [ "$ENABLE_VERSION_CONTROL" == "y" ]; then
78+
elif [ "$ENABLE_VERSION_CONTROL_WEB" == "y" ]; then
8079
return 1
8180
fi
8281

@@ -85,7 +84,7 @@ process()
8584
echo "$package_url==$real_version" >> ${BUILD_VERSION_FILE}
8685

8786
# If the version is mismatched, exit the wget/curl
88-
if [ "$ENABLE_VERSION_CONTROL" == "y" ] && [ "$version" != "$real_version" ]; then
87+
if [ "$ENABLE_VERSION_CONTROL_WEB" == "y" ] && [ "$version" != "$real_version" ]; then
8988
return 1
9089
fi
9190

rules/config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ PACKAGE_URL_PREFIX ?= https://packages.trafficmanager.net/public/packages
169169
# TRUSTED_GPG_URLS - the trusted gpgs, separated by comma
170170
TRUSTED_GPG_URLS = https://packages.trafficmanager.net/debian/public_key.gpg,https://packages.microsoft.com/keys/microsoft.asc
171171

172-
# SONIC_VERSION_CONTROL_COMPONENTS - Valid values: none|all|components..., the components consist of one or multiple: deb,py2,py3,web,git,dck, seperated by comma
172+
# SONIC_VERSION_CONTROL_COMPONENTS - Valid values: none|all|components..., the components consist of one or multiple: deb,py2,py3,url,git,docker, seperated by comma
173173
# none : disable the version control
174174
# all : enable the version control for all components
175175
# deb : debian packages
176176
# py2 : python2 packages
177177
# py3 : python3 pakcages
178-
# web : web packages, downloaded by wget, curl
178+
# url : web packages, downloaded by wget, curl
179179
# git : git repositories, donloaded by git clone
180-
# dck : docker base images
180+
# docker: docker base images
181181
SONIC_VERSION_CONTROL_COMPONENTS ?= none

scripts/prepare_docker_buildinfo.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ARCH=$3
66
DOCKERFILE_TARGE=$4
77
DISTRO=$5
88

9+
[ -z "$BUILD_SLAVE" ] && BUILD_SLAVE=n
910
[ -z "$DOCKERFILE_TARGE" ] && DOCKERFILE_TARGE=$DOCKERFILE
1011
DOCKERFILE_PATH=$(dirname "$DOCKERFILE_TARGE")
1112
BUILDINFO_PATH="${DOCKERFILE_PATH}/buildinfo"
@@ -27,11 +28,6 @@ ENV OLDPATH=$PATH
2728
ENV PATH="/usr/local/share/buildinfo/scripts:$PATH"
2829
RUN pre_run_buildinfo'
2930

30-
DOCKERFILE_POST_SCRIPT="RUN post_run_buildinfo"
31-
[ "$BUILD_SLAVE" != "y" ] && DOCKERFILE_POST_SCRIPT="$DOCKERFILE_POST_SCRIPT
32-
ENV PATH=\$OLDPATH"
33-
34-
3531
# Add the auto-generate code if it is not added in the target Dockerfile
3632
if [ ! -f $DOCKERFILE_TARGE ] || ! grep -q "Auto-Generated for buildinfo" $DOCKERFILE_TARGE; then
3733
# Insert the docker build script before the RUN command
@@ -41,6 +37,7 @@ if [ ! -f $DOCKERFILE_TARGE ] || ! grep -q "Auto-Generated for buildinfo" $DOCKE
4137

4238
# Append the docker build script at the end of the docker file
4339
echo "RUN post_run_buildinfo" >> $TEMP_FILE
40+
[ -z "$BUILD_SLAVE" ] && BUILD_SLAVE=n
4441
[ "$BUILD_SLAVE" != "y" ] && echo "ENV PATH=\$OLDPATH" >> $TEMP_FILE
4542

4643
cat $TEMP_FILE > $DOCKERFILE_TARGE

scripts/versions_manager.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def dump_to_path(self, file_path, config=False, priority=999):
8484
os.makedirs(file_path)
8585
filename = self.get_filename()
8686
if config and self.ctype == 'deb':
87+
none_config_file_path = os.path.join(file_path, filename)
88+
self.dump_to_file(none_config_file_path, False, priority)
8789
filename = VERSION_DEB_PREFERENCE
8890
file_path = os.path.join(file_path, filename)
8991
self.dump_to_file(file_path, config, priority)
@@ -135,9 +137,10 @@ def get_order_keys(self):
135137
arch = ''
136138
return (self.ctype, dist, arch)
137139

138-
def clean_info(self, clean_dist=True, clean_arch=True):
139-
if clean_dist and self.ctype != 'deb':
140-
self.dist = ALL_DIST
140+
def clean_info(self, clean_dist=True, clean_arch=True, force=False):
141+
if clean_dist:
142+
if force or self.ctype != 'deb':
143+
self.dist = ALL_DIST
141144
if clean_arch:
142145
self.arch = ALL_ARCH
143146

@@ -296,9 +299,9 @@ def filter(self, ctypes=[]):
296299
components.append(component)
297300
self.components = components
298301

299-
def clean_info(self, clean_dist=True, clean_arch=True):
302+
def clean_info(self, clean_dist=True, clean_arch=True, force=False):
300303
for component in self.components:
301-
component.clean_info(clean_dist=clean_dist, clean_arch=clean_arch)
304+
component.clean_info(clean_dist=clean_dist, clean_arch=clean_arch, force=force)
302305

303306
def clone(self, ctypes=None, exclude_ctypes=None):
304307
components = []
@@ -633,7 +636,7 @@ def generate(self):
633636
default_module = VersionModule()
634637
default_module.load(default_module_path, filter_dist=args.distribution, filter_arch=args.architecture)
635638
config = module.get_config_module(default_module, args.distribution, args.architecture)
636-
config.clean_info()
639+
config.clean_info(force=True)
637640
config.dump(args.target_path, config=True, priority=args.priority)
638641

639642
if __name__ == "__main__":

0 commit comments

Comments
 (0)