RFR: 8301856: Generated .spec file for RPM installers uninstalls desktop launcher on update

Alexey Semenyuk asemenyuk at openjdk.org
Thu Nov 23 16:47:29 UTC 2023


On Thu, 23 Nov 2023 16:36:28 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:

> Fix uninstallation scripts in Linux installers to take action on desktop files only if these desktop files are not owned by another package. This prevents `xdg-mime uninstall`, `xdg-desktop-menu uninstall` commands from execution in case of upgrades.
> 
> Borrowed helper shell script function from "launchers as services" for the fix. Now on Linux there is shared code between "launchers as services" and "desktop integration" subsystems - "common_utils.sh". Added `ServiceAndDesktopTest.java` to test how they align.

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/desktop_utils.sh line 1:

> 1: #

Added `desktop_` prefix for all desktop integration functions

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/template.spec line 88:

> 86: COMMON_SCRIPTS
> 87: LAUNCHER_AS_SERVICE_SCRIPTS
> 88: if [ "$1" -gt 1 ]; then

The condition changed to comply with recommendations at https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax. 'true' replaced with "nop" (`:`)

src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java line 94:

> 92:         } catch (IOException ex) {
> 93:             throw new RuntimeException(ex);
> 94:         }

Redundant try/catch removed

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LauncherAsServiceVerifier.java line 289:

> 287:                 throw ex;
> 288:             }
> 289:         }

Fixed an issue that made it impossible to run tests for the "launcher as service" feature without starting jtreg under `sudo`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16800#discussion_r1403590951
PR Review Comment: https://git.openjdk.org/jdk/pull/16800#discussion_r1403593932
PR Review Comment: https://git.openjdk.org/jdk/pull/16800#discussion_r1403594531
PR Review Comment: https://git.openjdk.org/jdk/pull/16800#discussion_r1403596448


More information about the core-libs-dev mailing list