Skip to content

Commit cb2c1cc

Browse files
arkqj-ororke
authored andcommitted
[Tizen] Download all packages from dedicated Tizen version (project-chip#37374)
* [Tizen] Use 7zip for extracting RPM files * Download all packages from dedicated Tizen version
1 parent 3ccdb1c commit cb2c1cc

File tree

3 files changed

+48
-33
lines changed

3 files changed

+48
-33
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
106 : Upgrade android docker with java 17 and adjust the location for android cmdline tool
1+
107 : Tizen - do not mix snapshot and Tizen 8.0 release

integrations/docker/images/stage-2/chip-build-tizen/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ LABEL org.opencontainers.image.source https://github.com/project-chip/connectedh
77
RUN set -x \
88
&& apt-get update \
99
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
10+
7zip \
1011
cpio \
1112
libncurses6 \
12-
obs-build \
1313
openjdk-8-jre-headless \
1414
wget \
1515
zip \

integrations/docker/images/stage-2/chip-build-tizen/tizen-sdk-installer/install.sh

+46-31
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ SECRET_TOOL=false
2626

2727
SCRIPT_NAME=$(basename -- "$(readlink -f "${BASH_SOURCE:?}")")
2828
SCRIPT_DIR=$(dirname -- "$(readlink -f "${BASH_SOURCE:?}")")
29-
DEPENDENCIES=('cpio' 'openjdk-8-jre-headless' 'obs-build' 'wget' 'zip')
29+
DEPENDENCIES=('7zip' 'cpio' 'openjdk-8-jre-headless' 'wget' 'zip')
3030

3131
# If color is available use colors
3232
if which tput >/dev/null 2>&1 && [[ $(tput -T $TERM colors) -ge 8 ]]; then
@@ -45,16 +45,18 @@ function show_help() {
4545
echo
4646
echo "Options:"
4747
echo " -h, --help Display this information"
48-
echo " --tizen-sdk-path Set directory where Tizen will be installed. Default is $TIZEN_SDK_ROOT"
49-
echo " --tizen-sdk-data-path Set directory where Tizen have data. Default is $TIZEN_SDK_DATA_PATH"
50-
echo " --install-dependencies This options install all dependencies."
48+
echo " --tizen-sdk-path Set directory for Tizen SDK installation. Default is $TIZEN_SDK_ROOT"
49+
echo " --tizen-sdk-data-path Set directory for Tizen SDK runtime data. Default is $TIZEN_SDK_DATA_PATH"
50+
echo " --install-dependencies This option installs all required dependencies"
5151
echo " --tizen-version Select Tizen version. Default is $TIZEN_VERSION"
52-
echo " --override-secret-tool Circumvent the requirement of having functional D-Bus Secrets service."
52+
echo " --override-secret-tool Circumvent the requirement of having functional D-Bus Secrets service"
5353
echo
5454
echo "Note:"
55-
echo "The script should run fully with ubuntu. For other distributions you may have to manually"
56-
echo "install all needed dependencies. Use the script specifying --tizen-sdk-path with or"
57-
echo "without --tizen-version. The script will only install Tizen platform for Matter."
55+
echo "This script does not install full Tizen SDK. It installs only the necessary"
56+
echo "parts for Matter SDK to be able to build Tizen applications."
57+
echo "The option '--install-dependencies' should be able to install all required"
58+
echo "dependencies on any Debian-based distribution. For other distributions the"
59+
echo "dependencies should be installed manually."
5860
}
5961

6062
# ------------------------------------------------------------------------------
@@ -78,12 +80,12 @@ function warning() {
7880
# ------------------------------------------------------------------------------
7981
# Show dependencies
8082
function show_dependencies() {
81-
warning "Need dependencies for use this script installation SDK: cpio unrpm unzip wget"
82-
warning "Need dependencies for Tizen SDK: JAVA JRE >=8.0"
83+
warning "Required dependencies for Tizen SDK installation: 7z cpio unzip wget"
84+
warning "Required dependencies for Tizen SDK: JAVA JRE >=8.0"
8385
}
8486

8587
# ------------------------------------------------------------------------------
86-
# Function helper massive download
88+
# Helper function for downloading packages.
8789
# Usage: download "url_dir_package" ${package_array[@]}
8890
function download() {
8991
echo "$COLOR_BLUE"
@@ -92,6 +94,10 @@ function download() {
9294
for PKG in "${@:2}"; do
9395
PKGS+=("-A" "$PKG")
9496
done
97+
98+
# Skip downloading if no packages are specified
99+
[[ ${#PKGS[@]} -eq 0 ]] && return
100+
95101
wget -r -nd --no-parent -e robots=off --progress=dot:mega "${PKGS[@]}" "$1"
96102

97103
# Check if the files have been downloaded
@@ -106,7 +112,7 @@ function download() {
106112
}
107113

108114
# ------------------------------------------------------------------------------
109-
# Function install all dependencies.
115+
# Function for installing all dependencies.
110116
function install_dependencies() {
111117
if ! command -v apt-get &>/dev/null; then
112118
show_dependencies
@@ -120,13 +126,22 @@ function install_dependencies() {
120126
}
121127

122128
# ------------------------------------------------------------------------------
123-
# Function clean on EXIT
129+
# Function for unpacking RPM packages.
130+
function unrpm() {
131+
for PKG in "${@}"; do
132+
echo "Extracting $PKG..."
133+
7z x -so "$PKG" | cpio -idmv
134+
done
135+
}
136+
137+
# ------------------------------------------------------------------------------
138+
# Function for cleaning up temporary files on exit.
124139
function cleanup() {
125140
rm -rf "${TMP_DIR:?}"
126141
}
127142

128143
# ------------------------------------------------------------------------------
129-
# Function install tizen sdk.
144+
# Function for installing Tizen SDK.
130145
function install_tizen_sdk() {
131146

132147
mkdir -p "$TIZEN_SDK_ROOT" || return
@@ -194,9 +209,17 @@ function install_tizen_sdk() {
194209
'app-core-common-*.rpm'
195210
'aul-0*.armv7l.rpm'
196211
'aul-devel-*.armv7l.rpm'
212+
'bluetooth-frwk-0*.armv7l.rpm'
197213
'bundle-0*.armv7l.rpm'
198214
'bundle-devel-*.armv7l.rpm'
199215
'buxton2-*.armv7l.rpm'
216+
'capi-network-bluetooth-0*.armv7l.rpm'
217+
'capi-network-bluetooth-devel-*.armv7l.rpm'
218+
'capi-network-nsd-*.armv7l.rpm'
219+
'capi-network-thread-*.armv7l.rpm'
220+
'capi-system-peripheral-io-*.armv7l.rpm'
221+
'capi-system-peripheral-io-devel-*.armv7l.rpm'
222+
'capi-system-resource-1*.armv7l.rpm'
200223
'cynara-devel-*.armv7l.rpm'
201224
'dbus-1*.armv7l.rpm'
202225
'dbus-devel-*.armv7l.rpm'
@@ -209,12 +232,14 @@ function install_tizen_sdk() {
209232
'libcynara-commons-*.armv7l.rpm'
210233
'libdns_sd-*.armv7l.rpm'
211234
'libjson-glib-*.armv7l.rpm'
235+
'libnsd-dns-sd-*.armv7l.rpm'
212236
'libsessiond-0*.armv7l.rpm'
213237
'libsystemd-*.armv7l.rpm'
214238
'libtzplatform-config-*.armv7l.rpm'
215239
'parcel-0*.armv7l.rpm'
216240
'parcel-devel-*.armv7l.rpm'
217241
'pkgmgr-info-*.armv7l.rpm'
242+
'sensord-*.armv7l.rpm'
218243
'sensord-devel-*.armv7l.rpm'
219244
'sensord-dummy-*.armv7l.rpm'
220245
'vconf-compat-*.armv7l.rpm'
@@ -223,22 +248,13 @@ function install_tizen_sdk() {
223248

224249
# Unified packages (snapshots)
225250
URL="http://download.tizen.org/snapshots/TIZEN/Tizen/Tizen-Unified/latest/repos/standard/packages/armv7l/"
226-
PKG_ARR=(
227-
'bluetooth-frwk-0*.armv7l.rpm'
228-
'capi-network-bluetooth-0*.armv7l.rpm'
229-
'capi-network-bluetooth-devel-*.armv7l.rpm'
230-
'capi-network-nsd-*.armv7l.rpm'
231-
'capi-network-thread-*.armv7l.rpm'
232-
'capi-system-peripheral-io-*.armv7l.rpm'
233-
'capi-system-peripheral-io-devel-*.armv7l.rpm'
234-
'capi-system-resource-1*.armv7l.rpm'
235-
'libnsd-dns-sd-*.armv7l.rpm'
236-
'sensord-*.armv7l.rpm')
251+
PKG_ARR=()
237252
download "$URL" "${PKG_ARR[@]}"
238253

239254
# Tizen Developer Platform Certificate
240255
URL="http://download.tizen.org/sdk/extensions/Tizen_IoT_Headless/binary/"
241-
# Tizen site do not has this package available in version 8.0. Certificates are the same for 7.0 and 8.0.
256+
# Tizen site does not have this package available in version 8.0.
257+
# Certificates are the same for 7.0 and 8.0, though.
242258
PKG_ARR=(
243259
"7.0-iot-things-add-ons_*_ubuntu-64.zip")
244260
download "$URL" "${PKG_ARR[@]}"
@@ -255,8 +271,7 @@ function install_tizen_sdk() {
255271
# Install secret tool or not
256272
if ("$SECRET_TOOL"); then
257273
info "Overriding secret tool..."
258-
cp "$SCRIPT_DIR/secret-tool.py" "$TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool"
259-
chmod 0755 "$TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool"
274+
install "$SCRIPT_DIR/secret-tool.py" "$TIZEN_SDK_ROOT/tools/certificate-encryptor/secret-tool"
260275
fi
261276

262277
# Configure Tizen CLI
@@ -331,16 +346,16 @@ info "Created tmp directory $TMP_DIR"
331346
# Checks if the user need install dependencies
332347
if [ "$INSTALL_DEPENDENCIES" = true ]; then
333348
if ! install_dependencies; then
334-
error "Cannot install dependencies, please use this script as sudo user or root. Use --help"
349+
error "Cannot install dependencies, please use this script as sudo user or root."
335350
show_dependencies
336351
exit 1
337352
fi
338353
fi
339354

340355
# ------------------------------------------------------------------------------
341356
# Checking dependencies needed to install Tizen platform
342-
info "Checking required tools: cpio, java, unrpm, unzip, wget"
343-
for PKG in 'cpio' 'java' 'unrpm' 'unzip' 'wget'; do
357+
info "Checking required tools: 7z, cpio, java, unzip, wget"
358+
for PKG in '7z' 'cpio' 'java' 'unzip' 'wget'; do
344359
if ! command -v "$PKG" &>/dev/null; then
345360
error "Required tool not found: $PKG"
346361
dep_lost=1

0 commit comments

Comments
 (0)