platform/core/system/isu.git
6 months agoFix Tizen-Unified-X build 63/319263/3 accepted/tizen_unified_toolchain accepted/tizen/9.0/unified/20241030.231526 accepted/tizen/unified/20241020.073452 accepted/tizen/unified/toolchain/20241022.122545 accepted/tizen/unified/toolchain/20241022.123003 accepted/tizen/unified/x/20241020.083722 accepted/tizen/unified/x/asan/20241022.113517 tizen_9.0_m2_release
Adam Michalski [Fri, 18 Oct 2024 08:39:18 +0000 (10:39 +0200)]
Fix Tizen-Unified-X build

This commit fixes the following build error occurring on the
Tizen-Unified-X profile with the unit tests:

[   29s] /home/abuild/rpmbuild/BUILD/isu-9.0.6/tests/unit/test_libisu_internal.c: In function 'setup_copy_file_negative':
[   29s] /home/abuild/rpmbuild/BUILD/isu-9.0.6/tests/unit/test_libisu_internal.c:370:46: error: '_STAT_VER' undeclared (first use in this function)
[   29s]   370 |         expect_value(__wrap___fxstat64, ver, _STAT_VER);
[   29s]       |                                              ^~~~~~~~~
[   29s] /home/abuild/rpmbuild/BUILD/isu-9.0.6/tests/unit/test_libisu_internal.c:370:46: note: each undeclared identifier is reported only once for each function it appears in
[   29s] make[2]: *** [tests/unit/CMakeFiles/test_libisu_internal.dir/build.make:79: tests/unit/CMakeFiles/test_libisu_internal.dir/test_libisu_internal.c.o] Error 1

Additionally, the wrapping of the fstat64 function has been improved,
using the original implementation instead of the internal __fxstat64
and related internal constants, which may or may not be exposed
depending on the glibc version. With compiler optimizations disabled,
we are guaranteed that this specific function will be called,
eliminating the need to mock lower-level, implementation-dependent
internal functions.

Signed-off-by: Adam Michalski <a.michalski2@partner.samsung.com>
Change-Id: I509b6281f2788da9cdab36041930715cf59e868f

6 months agoRepack isu RPMs 03/319203/3
Adam Michalski [Thu, 17 Oct 2024 08:32:39 +0000 (10:32 +0200)]
Repack isu RPMs

Previously, the following files:

* /usr/bin/isud
* /etc/dbus-1/system.d/isud.conf
* /usr/lib/systemd/system/isud.service
* /usr/share/dbus-1/system-services/org.tizen.system.isu.service

related to the isud daemon and its DBus configuration, were delivered
by the libisu-.*.rpm package. This commit repacks these files into the
isu-.*.rpm package. Both packages are required, so from a functional
and system operation perspective, it doesn't matter which package
delivers these files. However, since they are not part of libisu but
rather the main package, it is more logical to package them accordingly.

Change-Id: I98cd71e18c4c87a7b2476638af005aea0c86d137

6 months agoRemove /etc/isu entry from systemd tmpfiles configuration 10/319110/1
Adam Michalski [Tue, 15 Oct 2024 09:48:24 +0000 (11:48 +0200)]
Remove /etc/isu entry from systemd tmpfiles configuration

This commit removes the /etc/isu entry from isu.conf, which is used
for tmpfiles configuration by the isu systemd-generator. /etc/isu is
non-modifiable, and this entry is unnecessary, causing unwanted error
messages during debugging.

Change-Id: I50d2ced66372b6a5d35d199a5a8b1faeb6ba7792
Signed-off-by: Adam Michalski <a.michalski2@partner.samsung.com>
6 months agoAdd unit tests 18/316818/51 accepted/tizen/unified/20241017.114702
Adam Michalski [Wed, 28 Aug 2024 14:15:22 +0000 (16:15 +0200)]
Add unit tests

This commit adds unit tests for libisu and libisu-internal. All functions
from the public libisu API are tested, as well as all internal (static)
functions used by this interface, the isu daemon, and the isu package
manager.

To ensure the widest possible test coverage of internal static functions
in libisu-internal, the following approaches were applied:

* building a separate static version of the libisu library with compiler
  optimizations disabled,
* using a trick to replace the static keyword (which enforces function
  privacy within a module) with STATIC and employing the preprocessor,
  allowing static functions in libisu-internal to be made public during
  testing while keeping them hidden in the dynamic version of libisu, which
  is linked with the binaries of the isu daemon and package manager.
* using CMocka as the testing framework, as it works well with code written
  in C.

Results:

LCOV - code coverage report:
* libisu.c (public libisu API interface)
  - function coverage: 100%
  - line coverage: 88.6%
* libisu-internal.c (libisu-internal.c: internal functions used by the
  public libisu API, the daemon, and the package manager)
  - function coverage: 100%
  - line coverage: 82.4%.

Build log (fragments):

[   41s] make[8]: Entering directory '/home/abuild/rpmbuild/BUILD/isu-9.0.6'
[   41s] Running tests...
[   41s] /usr/bin/ctest --force-new-ctest-process
[   41s] Test project /home/abuild/rpmbuild/BUILD/isu-9.0.6
[   41s]     Start 1: test_libisu
[   41s] 1/2 Test #1: test_libisu ......................   Passed    0.16 sec
[   41s]     Start 2: test_libisu_internal
[   41s] 2/2 Test #2: test_libisu_internal .............   Passed    0.13 sec
[   41s]
[   41s] 100% tests passed, 0 tests failed out of 2
[   41s]
[   41s] Total Test time (real) =   0.29 sec
[   41s] make[8]: Leaving directory '/home/abuild/rpmbuild/BUILD/isu-9.0.6'
...
[   53s] Writing data to coverage.info
[   53s] Summary coverage rate:
[   53s]   lines......: 83.3% (557 of 669 lines)
[   53s]   functions..: 100.0% (38 of 38 functions)
[   53s]   branches...: no data found
[   53s] /bin/genhtml -o coverage coverage.info
[   55s] Found 3 entries.
[   55s] Found common filename prefix "/home/abuild/rpmbuild/BUILD/isu-9.0.6/src"
[   55s] Generating output.
[   55s] Processing file libisu/libisu-internal.c
[   55s]   lines=580 hit=478 functions=29 hit=29
[   56s] Processing file /usr/include/glib-2.0/glib/gstrfuncs.h
[   56s]   lines=1 hit=1
[   56s] Processing file libisu/libisu.c
[   56s]   lines=88 hit=78 functions=9 hit=9
[   56s] Overall coverage rate:
[   56s]   lines......: 83.3% (557 of 669 lines)
[   56s]   functions......: 100.0% (38 of 38 functions)

Co-author: Mateusz Mościcki <m.moscicki2@samsung.com>

Signed-off-by: Adam Michalski <a.michalski2@partner.samsung.com>
Change-Id: I19c74deb90b7b5db8760898817ada728cd241e93

6 months agofix: libisu-internal: Add missing return value when logging in isu_dbus_call 75/318775/1 accepted/tizen/unified/20241011.010654 accepted/tizen/unified/x/20241011.021818 accepted/tizen/unified/x/asan/20241014.000229
Adam Michalski [Tue, 8 Oct 2024 07:15:48 +0000 (09:15 +0200)]
fix: libisu-internal: Add missing return value when logging in isu_dbus_call

Change-Id: I8ee13ab683b1833ee2666098f520f2a46690a318

6 months agoisud: fix SVACE issues 10/318610/2 accepted/tizen/unified/20241004.144542 accepted/tizen/unified/x/20241006.082034
Adam Michalski [Thu, 3 Oct 2024 09:11:00 +0000 (11:11 +0200)]
isud: fix SVACE issues

This commit fixes the following SVACE issues:
- DOUBLE_FREE_EX issue #WGID=246168
- DEREF_AFTER_FREE.EX issue #WGID=246169.

This situation may occur in the call_handler function, which handles DBus
requests for the ISU daemon. During the handling of the List method, the
function isu_list_init_internal is called, which, among other things,
allocates memory for the ISU package list and its associated information,
which may fail. In such a case, accessing the list is invalid, so it should
be done conditionally. Additionally, after constructing the DBus response,
the list that was not created should not be freed.

Change-Id: I92e7b59f305d50185e56b2b9bbd53670809607f1

6 months agolibisu: Add the missing return value when logging 42/318542/1 accepted/tizen/unified/20241006.053259 accepted/tizen/unified/x/20241007.013545
Chanwoo Choi [Wed, 2 Oct 2024 02:42:34 +0000 (11:42 +0900)]
libisu: Add the missing return value when logging

Change-Id: I9d32f22726069511e9553512f9037c65d021c5e5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 months agolibisu-internal: require at least one service in the system-services section 18/318218/3 accepted/tizen/unified/20241001.004102 accepted/tizen/unified/toolchain/20241004.101847 accepted/tizen/unified/x/20241001.154012
Adam Michalski [Wed, 25 Sep 2024 15:46:34 +0000 (17:46 +0200)]
libisu-internal: require at least one service in the system-services section

This commit changes the behavior of the get_pkg_info function that
reads and accepts/rejects the isu configuration to require at least
one service in the system-services section.

Change-Id: Ia5adcec04d1d95216786e5720d19476c438829e1

7 months agolibisu-internal: refactor isu_get_version_internal function 16/318216/2
Adam Michalski [Wed, 25 Sep 2024 15:21:46 +0000 (17:21 +0200)]
libisu-internal: refactor isu_get_version_internal function

This commit significantly refactors the isu_get_version_internal
function to make it look simpler (fewer if/else ladders). At the
cost of one additional strdup/free, we achieve a significant
simplification of the logic, making the code easier to maintain.

Change-Id: Ibb57b9b2ab811cc4066afd0dc1d8af489b7cd50d

7 months agolibisu-internal: properly handle strdup memory allocation errors 10/318210/2
Adam Michalski [Wed, 25 Sep 2024 09:47:09 +0000 (11:47 +0200)]
libisu-internal: properly handle strdup memory allocation errors

libisu-internal.c: properly handle memory allocation errors when
using strdup function which can fail (as it may return NULL if
insufficient memory was available).

Change-Id: I4b2ed05ddb574bb445191d346dd589d8d324e391

7 months agolibisu: refactoring: unify indentation in isu_pkg_info_free function 12/318112/1
Adam Michalski [Tue, 24 Sep 2024 17:42:49 +0000 (19:42 +0200)]
libisu: refactoring: unify indentation in isu_pkg_info_free function

We want to stick to a consistent style of indentation and comments
throughout the entire project. This commit removes unnecessary
indentations in the isu_pkg_info_free function in libisu.

Change-Id: I3a599127321406cf0609f3bd3c334f171459a115

7 months agolibisu: properly handle nulls in isu_pkg_get_name/isu_pkg_get_version 11/318111/1
Adam Michalski [Tue, 24 Sep 2024 17:20:42 +0000 (19:20 +0200)]
libisu: properly handle nulls in isu_pkg_get_name/isu_pkg_get_version

This commit fixes the incorrect dereferencing of pointers when
retrieving data from the name/version members of the pkg_info
structure in the isu_pkg_get_name/isu_pkg_get_version functions
of the libisu public API.

Although a situation where an instance of the pkg_info structure is
correctly allocated, but its name/version components are NULL, should
not occur during normal usage, public functions must be resilient to
such malformed arguments and respond with an appropriate error rather
than a segfault.

Change-Id: I641b003568a0db79eab79f192c2f612bb6900721

7 months agoAdd script to build ISU test package 37/317537/3
Mateusz Moscicki [Wed, 11 Sep 2024 09:16:42 +0000 (11:16 +0200)]
Add script to build ISU test package

This commit adds a description for integration tests, and a script that
allows to build an ISU test package, in case it needs to be modified.

Change-Id: I46230f7830efbd2e5aa5f664402f40cd87fb7e25

7 months agoAllow to use "isu list" by non-privileged user 63/316863/8 accepted/tizen_unified_dev accepted/tizen/unified/20240911.161949 accepted/tizen/unified/dev/20240913.055527 accepted/tizen/unified/x/20240912.013819
Mateusz Moscicki [Wed, 28 Aug 2024 12:33:35 +0000 (14:33 +0200)]
Allow to use "isu list" by non-privileged user

Previously, libisu loaded isu package information on the system by
referencing the file system, reading data directly from
/opt/isu/$PKG_NAME/isu.cfg. However, the latter is often only
accessible from the "system" user, thus preventing non-privileged
users such as “owner” from obtaining package information via this
route.

The proper way is to put isud in charge and return package list and
single package information via DBus, as isud is a privileged process
and has full access to the configuration files of isu services.

This commit introduces two new DBus calls in isud:
- List: returns a list of isu packages, allowing "isu list" to be
called by an unprivileged user such as "owner",
- PkgInfo: returns information such as name, version, list of systemd
   services associated with a given isu package.

Change-Id: Ia07f218492692098303d9f4a4428fa32d5fb5017
Signed-off-by: Mateusz Moscicki <m.moscicki2@samsung.com>
7 months agoAdd integration tests 47/316747/2
Mateusz Moscicki [Tue, 27 Aug 2024 11:29:30 +0000 (13:29 +0200)]
Add integration tests

This change adds integration testing to isu validation. It is tested:
* package listing.
* installing a package using isu command
* uninstalling a package using isu command
* installing a package with pkgcmd command
* uninstalling a package with pkgcmd commmand
* checking the version of an installed package

To perform the tests:
1. Install isu-tests package
2. Run /usr/libexec/isu/isu-integration-tests.sh script
3. The result will be displayed on the console

Change-Id: Ib605e1197e624e6936bb0bc7ce9845188b542cba
Signed-off-by: Mateusz Moscicki <m.moscicki2@samsung.com>
8 months agolibisu: Unify indentation 71/316671/1 accepted/tizen/unified/20240828.082357 accepted/tizen/unified/dev/20240829.043842 accepted/tizen/unified/x/20240829.020354
Adam Michalski [Mon, 26 Aug 2024 14:25:30 +0000 (16:25 +0200)]
libisu: Unify indentation

Everything except the copy_content function uses spaces as indentation
characters. Make copy_content consistent with the rest.

Change-Id: Ic6576ee66a5099267971e41f5d6668e0899f8c90

8 months agolibisu: fix path construction 70/316670/1
Adam Michalski [Mon, 26 Aug 2024 13:45:47 +0000 (15:45 +0200)]
libisu: fix path construction

Since the constants defining the prefixes of paths such as "/opt/isu"
or "/etc/isu" previously contained a trailing "/", redundant "/"
characters often appeared when constructing paths using them, e.g.
"/opt/isu//deviced". While redundant "/" characters in the Unix path
are not necessarily a problem, it is redundant and undesirable.

Change-Id: I2e8e137eb3597890bdedb006c3b544d41fd7e157

8 months agoAllow owner user to call DBus methods from org.tizen.system.isu 69/316669/1
Adam Michalski [Mon, 26 Aug 2024 13:25:34 +0000 (15:25 +0200)]
Allow owner user to call DBus methods from org.tizen.system.isu

This is necessary for isu_get_version to be permitted to be called by
the service app user.

Change-Id: I70e7b7b79814132ce63fbca45ef6951a82341146

8 months agolibisu: Add support for function call between C and C++ 26/316326/1 accepted/tizen/unified/20240820.163508 accepted/tizen/unified/20240827.163732 accepted/tizen/unified/dev/20240821.053450 accepted/tizen/unified/x/20240821.014008
Chanwoo Choi [Mon, 19 Aug 2024 09:34:48 +0000 (18:34 +0900)]
libisu: Add support for function call between C and C++

Add support for function call between C and C++
to allow libisu function call on C++ program.

Change-Id: I8a7c79d21f55a519a23ec7fc68c612fe40797350
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
8 months agoImplement isu_get_version routine 79/315279/8 accepted/tizen/unified/20240807.010714 accepted/tizen/unified/20240814.180439 accepted/tizen/unified/dev/20240807.093007 accepted/tizen/unified/toolchain/20240812.133224 accepted/tizen/unified/x/20240807.014248 accepted/tizen/unified/x/20240819.023331 accepted/tizen/unified/x/asan/20240813.231611
Adam Michalski [Mon, 29 Jul 2024 10:05:05 +0000 (12:05 +0200)]
Implement isu_get_version routine

As per DA requirement, there is a need for the new API to get
the latest version of the package, taking into account both
RO (/) and RW (/opt/isu) packages.

The isu_get_version should return newer version of the package,
taking into account all the special cases:

|------------|------------|--------------------------------|
| RO version | RW version |         Return values          |
|------------|------------|--------------------------------|
|      O     |      X     | isu_result: ISU_RES_OK         |
|            |            | version: RO version            |
|------------|------------|--------------------------------|
|      X     |      O     | isu_result: ISU_RES_OK         |
|            |            | version: RW version            |
|------------|------------|--------------------------------|
|      O     |      O     | isu_result: ISU_RES_OK         |
|            |            | version: newer (RW or RO)      |
|------------|------------|--------------------------------|
|      X     |      X     | isu_result: ISU_RES_NOT_EXISTS |
|            |            | version: NULL                  |
|------------|------------|--------------------------------|

Change-Id: Iaa3a521527e0c23a68497c423e96379007cda51b

8 months agoSeparate ISU data migration part from system RW-upgrade script 53/314953/4
Adam Michalski [Tue, 23 Jul 2024 14:53:53 +0000 (16:53 +0200)]
Separate ISU data migration part from system RW-upgrade script

This commit is the second in the pair of commits that are going to
move ISU data migration part from the main OS-Upgrade script to
the component RW-upgrade scripts (/usr/share/upgrade/scripts/).

Change-Id: I418e5eb156f8929790be5b13d820196e7e4e933e

8 months agopkg_manager: Modify to check if malloc failed 48/315448/2 accepted/tizen/unified/20240802.160140 accepted/tizen/unified/dev/20240805.054451 accepted/tizen/unified/x/20240805.012859
SangYoun Kwak [Thu, 1 Aug 2024 03:56:10 +0000 (12:56 +0900)]
pkg_manager: Modify to check if malloc failed

While creating isu package list, if malloc is failed, then free the
previously allocated memories and return NULL.

This will solve SVACE issues with WGID is 210345 and 210586.

Change-Id: I87ba195a949e24e29d45edbfbc45711d4792cbad
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
9 months agoisu_pkgs_maker: Fix version attr in app xml being filled with api_version 84/314884/2
Karol Lewandowski [Mon, 22 Jul 2024 13:45:36 +0000 (15:45 +0200)]
isu_pkgs_maker: Fix version attr in app xml being filled with api_version

Additonally, this commit switches to using key=val in format string to avoid
errors like this in future.

Change-Id: Ibf2f60132888ba0cc7167b6da4cf9b61b6a48a0c

9 months agopkg_maker: Make the --sign-cmd option not required 92/314692/2
Adam Michalski [Wed, 17 Jul 2024 13:01:44 +0000 (15:01 +0200)]
pkg_maker: Make the --sign-cmd option not required

When the --sign-cmd option is not used, signing the checksum.sha256
file with an external tool is not performed. The call to the external
signing tool has also been slightly improved: in addition to simply
checking whether the signing succeeded, stdout and stderr are logged
in case of failure.

Change-Id: I5495251749a4c5d3d5cc43b7974e5b1fe11100e6

9 months agoFix: isu-generator: Check whether the public key actually exists 72/314572/1 accepted/tizen/unified/20240717.060543 accepted/tizen/unified/dev/20240718.035912 accepted/tizen/unified/x/20240718.022904
Adam Michalski [Mon, 15 Jul 2024 15:32:38 +0000 (17:32 +0200)]
Fix: isu-generator: Check whether the public key actually exists

Before using the PUBKEY variable, check whether the public key
actually exists or not.

Change-Id: Icc561e283c4326e39e1f36bf2f50cda7ec09b846

10 months agoSupport for other signing methods of ISU packages 61/313061/3 accepted/tizen/unified/20240705.082054 accepted/tizen/unified/dev/20240708.053938 accepted/tizen/unified/x/20240705.112627
Adam Michalski [Tue, 18 Jun 2024 13:40:00 +0000 (15:40 +0200)]
Support for other signing methods of ISU packages

As per DA requirement, there is a need to support the new option of
ISU package maker for signing the checksum file in the rpk package.
In addition to the existing '--key <private_key>' method, DA wants to
add the new one: '--sign-cmd <signing command>' option for signing the
checksum file. As soon as this option is added to the isu_pkgs_maker
command line arguments, the following command will be invoked:

    $ ./<signing command> checksum.sha256 checkcsum.sha256.sign

If signing succeeds, the checksum.sha256.sign file is eventually stored
in the rpk package.

Additionally, the PUBKEY variable has been defined in the isu-generator.

Change-Id: Ia8a9078a726705a90b89be8bb7eb085c8af23790

10 months agogcc14 fix: Add missing include 84/312284/1 accepted/tizen/unified/20240611.123035 accepted/tizen/unified/dev/20240620.005730 accepted/tizen/unified/toolchain/20240610.172618 accepted/tizen/unified/x/20240610.223207 accepted/tizen/unified/x/asan/20240625.092549
Karol Lewandowski [Wed, 5 Jun 2024 12:22:47 +0000 (14:22 +0200)]
gcc14 fix: Add missing include

Change-Id: I923374f6ab1dfa4a4870151004c6f3a41b6e987f

11 months agoExtract file copying to a function 36/304636/2
Michal Bloch [Mon, 22 Jan 2024 16:01:56 +0000 (17:01 +0100)]
Extract file copying to a function

Change-Id: I7ae7c3f5d9d833ab477659800a20100eddd1a285

11 months agoisu_pkgs_maker: Tailor tizen-manifest.xml according to DA requirements 50/310250/9
Adam Michalski [Wed, 24 Apr 2024 11:13:15 +0000 (13:13 +0200)]
isu_pkgs_maker: Tailor tizen-manifest.xml according to DA requirements

DA requires the change of tizen_manifest.xml as following:

- add the `profile_name` section
- set `api-version` value to the Tizen version
- set `exec` value to the executable command file name (e.g. amd for /usr/bin/amd binary)
- set 'appid' value to 'org.tizen.isu.[pkg_name]' (e.g. 'org.tizen.isu.amd')

Change-Id: Ib6a2ca85c066114c36cfd2e8ef9a66d98016594c

12 months agoMerge isu-cleaner service into isud service 20/309420/3 accepted/tizen/unified/20240423.164550 accepted/tizen/unified/x/20240425.051125
Adam Michalski [Tue, 9 Apr 2024 14:34:28 +0000 (16:34 +0200)]
Merge isu-cleaner service into isud service

According to Tizen platform pollicy, we have to reduce the number of
services.

Change-Id: Ie31e87085b8b724c5b4cebecf09a9c85fd985b4a

13 months agoAdd isu-cleaner service 61/308661/6
Adam Michalski [Thu, 28 Mar 2024 10:24:20 +0000 (11:24 +0100)]
Add isu-cleaner service

isu-cleaner adds two components to the Individual Service Upgrade:
* isu-cleaner tool - cleans up the /opt/usr/globalapps/org.tizen.isu.*
                     subdirectories from the remanants that may have
                     remained after removing duplicate install files
* isu-cleaner service - starts from delayed.target and executes the
                        isu-cleaner. This way we assure that all
                        possible remanents in globalapps are cleaned
                        up.

Change-Id: I7e4e5f7b6138095681b9a9fe73eb5a2430425c09

14 months agoRemove isu installation dir content duplication 47/305447/10 accepted/tizen/8.0/unified/20240215.155619 accepted/tizen/unified/20240214.163937 accepted/tizen/unified/toolchain/20240311.065558 accepted/tizen/unified/x/20240219.013900
Adam Michalski [Thu, 1 Feb 2024 16:24:15 +0000 (17:24 +0100)]
Remove isu installation dir content duplication

Change-Id: Ie4e54c3e5c4eaa75ea78fb6e8c7831d525e600ee

15 months agoFix Coverity issues 31/304631/2 accepted/tizen/8.0/unified/20240123.170040 accepted/tizen/unified/20240125.112655 accepted/tizen/unified/x/20240205.063946
Adam Michalski [Mon, 22 Jan 2024 13:08:42 +0000 (14:08 +0100)]
Fix Coverity issues

Ref.: CIDs #1749002, #1749004.

Change-Id: Ie652e892c770210b48c5844376f56b370430a21c

15 months agoUpdate GUIDE.md to reflect the change in ISU format from TPK to RPK 50/304250/3 accepted/tizen_unified_riscv accepted/tizen/8.0/unified/20240117.162915 accepted/tizen/unified/20240117.163222 accepted/tizen/unified/riscv/20240118.054550
Adam Michalski [Fri, 12 Jan 2024 16:20:48 +0000 (17:20 +0100)]
Update GUIDE.md to reflect the change in ISU format from TPK to RPK

Change-Id: I98dc36eb81363ad41bba8e5c7dca63c357c500c5

15 months agoisu_pkgs_maker: Add support for isu.cfg.d 85/304185/4
Adam Michalski [Thu, 11 Jan 2024 15:40:03 +0000 (16:40 +0100)]
isu_pkgs_maker: Add support for isu.cfg.d

isu.cfg.d allows custom ISU configuration to be provided. Custom
configration should be stored in the /etc/isu/[PKG_NAME]/isu.cfg.d
subdirectory in the same format as the main isu config file except
that it only contains the [files] section.

Custom configuration could be provided by additional modules depending
on the target image. All files in the aformentioned path will be
searched by the isu_pkgs_maker and all listed addition files will be
included in the ISU package.

Change-Id: Ia35b4805ded9428365a2d6aafc133521071fafe3

15 months agoUpdate isu_pkg_maker for Python 3 77/303777/2
Mateusz Moscicki [Tue, 2 Jan 2024 13:58:01 +0000 (14:58 +0100)]
Update isu_pkg_maker for Python 3

Change-Id: I887304fb353180a7df59c772f7f451b74358d0ce

15 months agoAdd workflow to allow building ISU package(s) for test purposes
Karol Lewandowski [Tue, 2 Jan 2024 13:52:55 +0000 (14:52 +0100)]
Add workflow to allow building ISU package(s) for test purposes

16 months agoFix SVACE and Coverity issues 97/303297/6 accepted/tizen/8.0/unified/20240101.155039 accepted/tizen/unified/20240101.155404 accepted/tizen/unified/riscv/20240103.054627
Adam Michalski [Fri, 22 Dec 2023 15:08:41 +0000 (16:08 +0100)]
Fix SVACE and Coverity issues

Co-author: Mateusz Majewski <m.majewski2@samsung.com>

Change-Id: I6811590979486570f564b332398e6cd0ed8565c3

16 months agoPackage ISU generation tools to isu-tools package 07/303007/3 accepted/tizen/8.0/unified/20231228.170214 accepted/tizen/unified/20231228.165724
Karol Lewandowski [Mon, 18 Dec 2023 15:21:27 +0000 (16:21 +0100)]
Package ISU generation tools to isu-tools package

Change-Id: I98eff28d121e5f09546de0179aa77ef5ab85c902

16 months agoDisable check of ISU feature by default 15/302715/2 accepted/tizen/8.0/unified/20231214.164511 accepted/tizen/unified/20231213.162124 accepted/tizen/unified/20231214.164949 accepted/tizen/unified/riscv/20231215.050311
Mateusz Moscicki [Tue, 12 Dec 2023 11:42:34 +0000 (12:42 +0100)]
Disable check of ISU feature by default

Change-Id: I08ee65496dbfcb2581b76d34902ba83af9f15200

16 months agoAdd package requirement 83/302483/2
Mateusz Moscicki [Thu, 7 Dec 2023 13:14:22 +0000 (14:14 +0100)]
Add package requirement

Change-Id: Ib32f8f46be6824b52746c03378f37cb7e60fbf59

16 months agoChange the dbus policy to allow app_fw to call dbus methods 82/302482/1
Mateusz Moscicki [Thu, 7 Dec 2023 11:24:58 +0000 (12:24 +0100)]
Change the dbus policy to allow app_fw to call dbus methods

Change-Id: I54d607be35178ac8b54da364c332855b75648e49

16 months agoVersion 9.0.0 82/302182/2
Mateusz Moscicki [Fri, 1 Dec 2023 13:02:53 +0000 (14:02 +0100)]
Version 9.0.0

Change-Id: Idd7dfe2d4dce6068451096ac67866ea062c82684

16 months agoAdd python 2 version of the ISU pkg maker 49/301849/4
Mateusz Moscicki [Fri, 24 Nov 2023 11:26:35 +0000 (12:26 +0100)]
Add python 2 version of the ISU pkg maker

As there is no python 3 support in the current mic-bootstrap, this
python 2 version of pkg_maker allows ISU Packages to be built during
image creation.

Usage example:

At the end of the *.ks file in the %post --nochroot section add:

  mkdir -p isu_out
  /usr/bin/python2 isu_pkgs_maker_py2.py --src $INSTALL_ROOT/ --out isu_out --rpk \
       --rpk-author-key <author_key_file> --rpk-author-key-pass <author_key_pass> \
       --rpk-dist-key <distributor_key_file> --rpk-dist-key-pass <distributor_key_pass>

After building the image, the isu_out directory should contain the
generated ISU packags.

Change-Id: Ide9be3c5c17c82e31d664a27aa55e27dd79a3d88

16 months agoAdd a package manager parser plugin 17/301417/6
Mateusz Moscicki [Tue, 14 Nov 2023 14:04:12 +0000 (15:04 +0100)]
Add a package manager parser plugin

This is a plugin library of package manager to install ISU Packages in
the RPK format.

The RPK package should contain:
 * the content of the ISU zip archive and,
 * tizen-manifest.xml,
 * correctly generated signature files.

The tizen-manifest.xml file should contain a description of the ISU
package, for example:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <manifest xmlns="http://tizen.org/ns/packages" api-version="1.0.0"
     package="org.tizen.isu.example_service"
     res-type="tizen.sample.resource" res-version="1.5.0" version="1.0.0">
      <isu>
  <name>example_service</name>
  <version>1.0.0</version>
      </isu>
      <allowed-package id="org.tizen.*"/>
    </manifest>

Change-Id: I3978b3e507f368ce87e47932f04b26dfaddf9a73

16 months agoAdd a new ISU package manager 27/299627/19
Mateusz Moscicki [Tue, 24 Oct 2023 10:36:59 +0000 (12:36 +0200)]
Add a new ISU package manager

Change-Id: I5c10d71bbc9fcf8d0ae89fd6aa43b049e1fda723

16 months agoAdd ISU API 90/299090/23
Mateusz Moscicki [Tue, 3 Oct 2023 11:23:21 +0000 (13:23 +0200)]
Add ISU API

Change-Id: I935c5e76b7cf061d3f8ef451ca527b0be96e0121

17 months agoisu_pkgs_maker: add support for optional files 11/301611/3
Adam Michalski [Mon, 20 Nov 2023 16:36:52 +0000 (17:36 +0100)]
isu_pkgs_maker: add support for optional files

This commit introduces optional files/directories in isu.cfg.
From now on, files that are from optional rpm packages can be marked
as optional by adding a '-' prefix in the pathname. Optional files from
optional rpm packages will be included in the final ISU package only if
they are actually installed on the platform given platform image from
which the ISU package is built.

Change-Id: I44b69912493348f10431fcabafcbc475b370d2c0

17 months agoChange the ISU archive format to .tpk 46/299746/2 accepted/tizen/unified/20231101.174500
Mateusz Moscicki [Mon, 9 Oct 2023 12:46:21 +0000 (14:46 +0200)]
Change the ISU archive format to .tpk

Change-Id: I3c517514a6bfb52417eb5a62d8620d1d396175de

18 months agoAdd isu status option 31/299031/26
Adam Michalski [Mon, 18 Sep 2023 15:01:50 +0000 (17:01 +0200)]
Add isu status option

Change-Id: I56b1c5c9b676d9a4da8685db35a4a92867516b80

18 months agogenerator: Do not error out when there are no isu packages 41/299541/1
Karol Lewandowski [Wed, 4 Oct 2023 10:00:17 +0000 (12:00 +0200)]
generator: Do not error out when there are no isu packages

Change-Id: I6fd2a0045d0bb20fc9981518a224111ef0c51c0d

18 months agogenerator: Ensure isu.cfg is also available in /run/isu/<PKG_NAME> 40/299540/1
Karol Lewandowski [Wed, 4 Oct 2023 09:53:24 +0000 (11:53 +0200)]
generator: Ensure isu.cfg is also available in /run/isu/<PKG_NAME>

Package in /opt/isu/<PKG_NAME> can be removed/upgraded/etc. so we
can't depend on it to have valid run-time info

Change-Id: Ie86249f509dd688e76393723ca1d2b3612926a97

19 months agotmpfiles: Ensure /run/isu is always created 33/299433/1
Karol Lewandowski [Tue, 26 Sep 2023 08:52:49 +0000 (10:52 +0200)]
tmpfiles: Ensure /run/isu is always created

This will prevent some other process taking over this name for
its purpose.

Change-Id: Ia45209768735eac4c2dc02bb687934e9291c4d77

19 months agogenerator: Fix ability to setup more than one .service & .unit in isu package 05/299305/2 accepted/tizen/8.0/unified/20231005.093804 accepted/tizen/unified/20230926.032106 tizen_8.0_m2_release
Karol Lewandowski [Mon, 25 Sep 2023 11:57:08 +0000 (13:57 +0200)]
generator: Fix ability to setup more than one .service & .unit in isu package

This commit fixes incorrect use of compgen -G as in example below:

   compgen -G "/bin/"b*

results in '/bin/bash', while we need behaviour like this:

   compgen -G "/bin/b*"

resulting in '/bin/bash /bin/basename /bin/b..'.

Change-Id: I0abd06fb0fd340023c9d6d87cddbb80ff96fa1ef

19 months agoUse symlinks for directories that are symlinked 72/298772/2 accepted/tizen/unified/20230914.164932
Mateusz Moscicki [Wed, 13 Sep 2023 08:38:25 +0000 (10:38 +0200)]
Use symlinks for directories that are symlinked

In the system the directory like /lib is a link to /usr/lib
In the sandbox we have performed two binds, which resulted in the fact
that from the sandbox perspective, the modificaiton (bind) in directory
/usr/lib was not visible in /lib

By using symlinks inside the sandbox the ISU package that
provides some libraries can bind it to one path:

  --bind #ISU_RUN_PATH#/service/rootfs/usr/lib/libservice.so.1 /usr/lib/libservice.so.1

instead of:

  --bind #ISU_RUN_PATH#/service/rootfs/usr/lib/libservice.so.1 /usr/lib/libservice.so.1
  --bind #ISU_RUN_PATH#/service/rootfs/usr/lib/libservice.so.1 /lib/libservice.so.1

Change-Id: I9c7c8854261546b2bc9f7111b3f90e9f9cd07c41

19 months agoAdd `user-service-common.inc` to ISU configuration 14/298614/1 accepted/tizen/unified/20230913.172613
Adam Michalski [Mon, 11 Sep 2023 11:40:11 +0000 (13:40 +0200)]
Add `user-service-common.inc` to ISU configuration

`user-service-common.inc` is similar to `service-common.inc` except
that it is tailored for user services.

Change-Id: I2f08e534afc654acbabf17b6fb42d717f00a20f2

19 months agogenerator: Log to standard error by default 86/298486/2 accepted/tizen/unified/20230908.185301
Karol Lewandowski [Thu, 7 Sep 2023 12:24:10 +0000 (14:24 +0200)]
generator: Log to standard error by default

Additionally, prepend each log with program name.

Change-Id: I9fec53490de6d56268959f7517b24be1ceb7c593

19 months agogenerator: Fix .service/.mount service installation 85/298485/2
Karol Lewandowski [Thu, 7 Sep 2023 12:15:43 +0000 (14:15 +0200)]
generator: Fix .service/.mount service installation

This commit fixes cases where service provided .mount but not .service
unit. Previously .mount unit would not be installed due to isu_prepare()
terminating early.

Additionally, this commit silents the warning when .mount unit is not
provided as it's rarely used feature.

Change-Id: I40da3ec35deed3023ad15664379f2c07237665b8

19 months agogenerator: Fix invalid variable reference in error message 84/298484/1
Karol Lewandowski [Thu, 7 Sep 2023 12:05:57 +0000 (14:05 +0200)]
generator: Fix invalid variable reference in error message

Change-Id: I53d635a44c5d5b57b63dba0d8e47a6049041ed85

19 months agoAdd configuration file for OS Upgrade & ISU interoperability 08/298408/1
Karol Lewandowski [Wed, 6 Sep 2023 11:23:10 +0000 (13:23 +0200)]
Add configuration file for OS Upgrade & ISU interoperability

This file can be used to list which fields from isu.cfg and platform
image must match for both to be assumed compatible.

Change-Id: Ib73456fd41dd88a6913625273108ea332144b985

19 months agoAdd tmpfiles.d snippet to guarantee permissions of /opt/isu 07/298407/1 accepted/tizen/unified/20230907.055354
Karol Lewandowski [Wed, 6 Sep 2023 11:17:40 +0000 (13:17 +0200)]
Add tmpfiles.d snippet to guarantee permissions of /opt/isu

Change-Id: I21ae22abe0888eda540abf9ede65e4c2cdab956c

19 months agopkg_manager, generator: Ensure files are installed accessible 05/298405/1
Karol Lewandowski [Wed, 6 Sep 2023 10:36:13 +0000 (12:36 +0200)]
pkg_manager, generator: Ensure files are installed accessible

All files should be readable except for rootfs.img, which are used only
for mounting data filesystem.

Additionally, change generator to check rootfs.img accessability only
when mount unit is being setup (to skip it during user-services setup).

Change-Id: Id7740cbd91aa6c08277813bd6d116cb82f73b282

19 months agogenerator: Drop $SYSTEMD_SCOPE in favor of $INSTANCE 04/298404/1
Karol Lewandowski [Wed, 6 Sep 2023 09:42:45 +0000 (11:42 +0200)]
generator: Drop $SYSTEMD_SCOPE in favor of $INSTANCE

$SYSTEMD_SCOPE is not set when running the script manually.

Change-Id: Ia754a81ea916b38030d474f00dbc7a39969774db

19 months agogenerator: Ensure mount units are started at boot 03/298403/1
Karol Lewandowski [Tue, 5 Sep 2023 22:32:56 +0000 (00:32 +0200)]
generator: Ensure mount units are started at boot

User session units can not depend on .mount units, so system
units have to start these even if it will be used much later.

Change-Id: I54c26a1e8eb57cbf6cbe0ea73c742630b9d0bdbf

19 months agogenerator: Rewrite handling of user service units 02/298402/1
Karol Lewandowski [Tue, 5 Sep 2023 20:47:27 +0000 (22:47 +0200)]
generator: Rewrite handling of user service units

Fix issue with isu-user-generator generating .mount units, which can't be
properly handled by `systemd --user` instance.

This commit changes mechanics to always create mount unit per ISU package
in system instance, so that user units can be sure mount is already available.

Additionally, improve logging a bit explicitly stating why we fail at given
stage.

Change-Id: Ice756587e86085b6b181d2644be599fefe10c465

19 months agoguide: Describe how extended platform compatibility check 07/298307/1
Karol Lewandowski [Tue, 5 Sep 2023 09:22:08 +0000 (11:22 +0200)]
guide: Describe how extended platform compatibility check

Change-Id: I100359f746c6d4eb7ebbf909e23d375727b17b96

19 months agoBump version 82/298182/1 accepted/tizen/unified/20230906.014621
Karol Lewandowski [Fri, 1 Sep 2023 13:15:10 +0000 (15:15 +0200)]
Bump version

Change-Id: Ic80714d13e6cd4cc9905c8c4efa2d1fa87de4f96

19 months agogenerator: Move PATH= setting to 2nd line as required by security-config scripts 80/298180/1
Karol Lewandowski [Fri, 1 Sep 2023 11:58:33 +0000 (13:58 +0200)]
generator: Move PATH= setting to 2nd line as required by security-config scripts

Change-Id: I070f8961d0ab3e04a51ef76ce744afe4548fbcaf

19 months agogenerator: Move mount unit to separate isu.conf 63/298163/2
Karol Lewandowski [Fri, 1 Sep 2023 09:02:31 +0000 (11:02 +0200)]
generator: Move mount unit to separate isu.conf

Having isu.conf (always) will make it easier to detect if service uses ISU
or not.

Change-Id: I9e4cb46db7d1114ce1760c21f143f4a6997b3428

20 months agoBump version 12/297812/1 accepted/tizen/unified/20230825.044301
Karol Lewandowski [Thu, 24 Aug 2023 14:32:24 +0000 (16:32 +0200)]
Bump version

Change-Id: Iff651509763004df799189103e2bdf9dbfc2c258

20 months agoUpdate documentation: Interaction with OS Upgrade section 34/297734/2
Adam Michalski [Wed, 23 Aug 2023 09:53:53 +0000 (11:53 +0200)]
Update documentation: Interaction with OS Upgrade section

Change-Id: I45d23a57ee956a8204f684036190d7baf937c17c

20 months agogenerator: .mount unit is always needed, not depending on existence of original servi... 10/297610/3
Karol Lewandowski [Mon, 21 Aug 2023 11:35:45 +0000 (13:35 +0200)]
generator: .mount unit is always needed, not depending on existence of original service file

Change-Id: I70d217a9cf42b65092b7051063a7c99e4248a70d

20 months agoDrop redunddant generator guide 09/297609/1
Karol Lewandowski [Mon, 21 Aug 2023 11:31:43 +0000 (13:31 +0200)]
Drop redunddant generator guide

Same information has been already moved to doc/GUIDE.md

Change-Id: I0be2f17eb45e46d2ddc71e3398af4e94fdd597cf

20 months agogenerator: Drop fallback mechanism (OnFailure=nonisuNAME.service) 08/297608/1
Karol Lewandowski [Mon, 21 Aug 2023 11:28:48 +0000 (13:28 +0200)]
generator: Drop fallback mechanism (OnFailure=nonisuNAME.service)

Unfortunately, the fallback mechanism, used when ISU service fails
to start can not be used in practice because:

 - it breaks socket activated services, as socket passing is defined
   in .socket units explicitly (ie. .socket specifies eg. Service=a.service,
   and if fallaback uinit would be started then sockets would not be
   passed correctly),

 - it breaks dbus-activated services, as copying original service file
   to nonisuNAME.service causes two services to specify same BusName= name

Change-Id: I7dc187ff367920bc2bfcf3988506f513278a932a

20 months agoUpdate guide to take `PidFile=` for double-forking services into account 05/297305/2
Adam Michalski [Wed, 16 Aug 2023 15:03:14 +0000 (17:03 +0200)]
Update guide to take `PidFile=` for double-forking services into account

Change-Id: I0dbc4decea02f5e19694ddf0f7b8c5ef336a9216

20 months agoAdd a simple ISU package manager 42/296942/9
Mateusz Moscicki [Mon, 7 Aug 2023 12:07:10 +0000 (14:07 +0200)]
Add a simple ISU package manager

Change-Id: I19cdd38341ae3a1d4cb671f1b031990946f8cba3

20 months agoUpdate ISU guide 03/297203/4
Adam Michalski [Fri, 11 Aug 2023 11:27:12 +0000 (13:27 +0200)]
Update ISU guide

Co-author: Karol Lewandowski<k.lewandowsk@samsung.com>

Change-Id: Ib4084ffa0d916878782c47532b3aca32d4fedbbe

20 months agoSupport for mount unit filenames containing a dash 73/296473/6
Adam Michalski [Fri, 28 Jul 2023 11:05:34 +0000 (13:05 +0200)]
Support for mount unit filenames containing a dash

A mount unit file having a dash in its name must be escaped.

Change-Id: I051489c876ffa9eca73ea8b5e63598033e62feb4

20 months agoAdd support for *.mount units 46/296646/2
Mateusz Moscicki [Wed, 2 Aug 2023 08:48:24 +0000 (10:48 +0200)]
Add support for *.mount units

Change-Id: Ib7b0c3ac07d428cb7ad2183d7276cc375237460e

20 months agoAdd support for new services provided by ISU 45/296645/2
Mateusz Moscicki [Wed, 2 Aug 2023 08:44:30 +0000 (10:44 +0200)]
Add support for new services provided by ISU

Add support for the situation where the ISU package provides a service
file that did not previously exist in the system

Change-Id: I1b5f09e9db7e073d9c729d6fcb19310cb4286a04

20 months agoAdd support for wildards in files section in isu.cfg 44/296644/2
Mateusz Moscicki [Wed, 2 Aug 2023 08:38:10 +0000 (10:38 +0200)]
Add support for wildards in files section in isu.cfg

Change-Id: I948a4791b37bb0f8d6b4ffef5d9b2ecbb883a8e5

21 months agoModify isu service common include file to conform to Tizen 6.0 46/295546/1 accepted/tizen/unified/20230726.020655 accepted/tizen/unified/dev/20230801.061614 accepted/tizen/unified/dev/20230801.062820
Adam Michalski [Mon, 10 Jul 2023 15:06:53 +0000 (17:06 +0200)]
Modify isu service common include file to conform to Tizen 6.0

Tizen 6.0 does not have the `hal` partition.

Change-Id: If59c09d523743e0e9659c3798f4d4cfdfefb6291

22 months agoAdd ISU guide 24/293424/7 accepted/tizen/unified/20230621.023246
Mateusz Moscicki [Fri, 26 May 2023 10:25:32 +0000 (12:25 +0200)]
Add ISU guide

Change-Id: Id7c3e0082883568f9a6d18db75a0c0aab6f8f7df

22 months agoAdd PATH environment variable 89/294289/1
Adam Michalski [Thu, 15 Jun 2023 15:28:10 +0000 (17:28 +0200)]
Add PATH environment variable

The PATH variable is required in scripts by the security-config.

Change-Id: I22b9a94a46ec7d302324868ef7c3bcf4f2a6e93e

22 months agoAdd `service-common.inc` to ISU configuration 40/293640/7
Adam Michalski [Thu, 1 Jun 2023 10:38:05 +0000 (12:38 +0200)]
Add `service-common.inc` to ISU configuration

Change-Id: Ie27126a2768ab6e0716e7f7bd54b496f23266f9d

22 months agoisu_pkgs_maker: Return exit code on error 57/293457/3
Mateusz Moscicki [Mon, 29 May 2023 14:31:13 +0000 (16:31 +0200)]
isu_pkgs_maker: Return exit code on error

Change-Id: Iffe109fad430ec88da6833a1eb65b0124e3aaa09

22 months agoAdd support for multiple service files 52/293452/3 accepted/tizen/unified/20230605.170308
Mateusz Moscicki [Mon, 29 May 2023 12:14:02 +0000 (14:14 +0200)]
Add support for multiple service files

Change-Id: I9cd65c94e165a8312267b64eeaef805c569db489

23 months agoAdd isu_pkgs_maker.py 92/293092/4
Mateusz Moscicki [Fri, 19 May 2023 11:15:54 +0000 (13:15 +0200)]
Add isu_pkgs_maker.py

The isu_pkgs_maker.py is a script that is used to generate ISU packages
based on configuration in `/etc/isu/` on rootfs.

Change-Id: I2190a031b87425bf7c48e3123d800879139e6b45

23 months agoAdd ISU systemd generator
Mateusz Moscicki [Fri, 19 May 2023 09:37:50 +0000 (11:37 +0200)]
Add ISU systemd generator

Generator is responsible for mounting the image with the updated service
and generating the service files that run it.
For more information see README.

Change-Id: I0caae33614adb9807c7d93ba34fdd9a209b02ab6

23 months agoInitial empty repository master
Tizen Infrastructure [Fri, 19 May 2023 01:49:46 +0000 (01:49 +0000)]
Initial empty repository