From 750355e021ead44213aea904700759699c161e00 Mon Sep 17 00:00:00 2001
From: jfkw <>
Date: May 10 2021 14:19:31 +0000
Subject: Update wsl-appx to version 1 / rev 10 via SR 891336
https://build.opensuse.org/request/show/891336
by user jfkw + dimstar_suse
- Set appx version for Microsoft Store using first segment for OS
VERSION_ID, segments two and three for OS image release version.
* Applies only to SLE and Leap at this time, no change to Tumbleweed
* printf "%d.%d.%d.0" "${VERSION_ID//\./}" "${RELEASE%.*}" "${RELEASE#*.}"
* Preserves image build versions, previous concatenation was lossy
* Version 153.2.283.0 formerly represented as 15.3.2283.0
- Trim os-release PRETTY_NAME to exclude snapshot or release label
consistent with Microsoft Store registered display name.
* PRETTY_NAME on SLE has release label in parentheses
* Microsoft Store rejects mismatch with display name
* Trim PRETTY_NAME from space, open paren to end of string
* SUSE Linux Enterprise Server 15 SP3 (Snapshot 16) becomes
SUSE Linux Enterprise Serve
---
diff --git a/.files b/.files
index 5b78137..fdabcda 100644
Binary files a/.files and b/.files differ
diff --git a/.rev b/.rev
index cd8f054..b159534 100644
--- a/.rev
+++ b/.rev
@@ -83,4 +83,26 @@
* Zero diff between template and kiwi output helps debugging (forwarded request 886831 from jfkw)
886832
+
+ 0b202a2cf64c77805652559c7b80b4cf
+ 1
+
+ dimstar_suse
+ - Set appx version for Microsoft Store using first segment for OS
+ VERSION_ID, segments two and three for OS image release version.
+ * Applies only to SLE and Leap at this time, no change to Tumbleweed
+ * printf "%d.%d.%d.0" "${VERSION_ID//\./}" "${RELEASE%.*}" "${RELEASE#*.}"
+ * Preserves image build versions, previous concatenation was lossy
+ * Version 153.2.283.0 formerly represented as 15.3.2283.0
+- Trim os-release PRETTY_NAME to exclude snapshot or release label
+ consistent with Microsoft Store registered display name.
+ * PRETTY_NAME on SLE has release label in parentheses
+ * Microsoft Store rejects mismatch with display name
+ * Trim PRETTY_NAME from space, open paren to end of string
+ * SUSE Linux Enterprise Server 15 SP3 (Snapshot 16) becomes
+ SUSE Linux Enterprise Server 15 SP3
+- When reading os-release variables spell out bash builtin source
+ for readability instead of '.' (forwarded request 891335 from jfkw)
+ 891336
+
diff --git a/wsl-appx.changes b/wsl-appx.changes
index add6100..9770dcb 100644
--- a/wsl-appx.changes
+++ b/wsl-appx.changes
@@ -1,4 +1,23 @@
-------------------------------------------------------------------
+Thu May 6 17:32:35 UTC 2021 - Jeff Kowalczyk
+
+- Set appx version for Microsoft Store using first segment for OS
+ VERSION_ID, segments two and three for OS image release version.
+ * Applies only to SLE and Leap at this time, no change to Tumbleweed
+ * printf "%d.%d.%d.0" "${VERSION_ID//\./}" "${RELEASE%.*}" "${RELEASE#*.}"
+ * Preserves image build versions, previous concatenation was lossy
+ * Version 153.2.283.0 formerly represented as 15.3.2283.0
+- Trim os-release PRETTY_NAME to exclude snapshot or release label
+ consistent with Microsoft Store registered display name.
+ * PRETTY_NAME on SLE has release label in parentheses
+ * Microsoft Store rejects mismatch with display name
+ * Trim PRETTY_NAME from space, open paren to end of string
+ * SUSE Linux Enterprise Server 15 SP3 (Snapshot 16) becomes
+ SUSE Linux Enterprise Server 15 SP3
+- When reading os-release variables spell out bash builtin source
+ for readability instead of '.'
+
+-------------------------------------------------------------------
Fri Mar 5 08:29:47 UTC 2021 - Jeff Kowalczyk
- Format AppxManifest.xml template for min diff to kiwi output
diff --git a/wsl-appx.spec b/wsl-appx.spec
index 92ed5a8..8928e5b 100644
--- a/wsl-appx.spec
+++ b/wsl-appx.spec
@@ -67,7 +67,7 @@ fi
# This is dirty. The CN of the AppxManifest needs to match the
# signing certificate's CN. In OBS the CN is the project name. The
# project itself may not have a cert so we can't use %_project. So
-# we abuse %vendor which is the project whith the key.
+# we abuse %vendor which is the project with the key.
#PROJECT="%vendor"
#PROJECT="${PROJECT##*/}"
#OBS="%vendor"
@@ -80,7 +80,15 @@ if [ -e "%{_sourcedir}/_projectcert.crt" ]; then
else
PUBLISHER="nobody"
fi
-. "$os_release_file"
+
+# Evaluate os-release file as bash variable assignments
+source "$os_release_file"
+
+# PRETTY_NAME on SLE frequently has release label in parentheses as suffix.
+# The Microsoft Store rejects this spelling for not matching the display name.
+# Trim PRETTY_NAME from space, open paren to end of string:
+# SUSE Linux Enterprise Server 15 SP3 (Snapshot 16) -> SUSE Linux Enterprise Server 15 SP3
+PRETTY_NAME="${PRETTY_NAME// (*/}"
APPID="${PRETTY_NAME//[^[:alnum:]]/}"
IDENTITYAPPID="${PRETTY_NAME//[^[:alnum:]\.]/}"
LAUNCHERNAME="${PRETTY_NAME//[^[:alnum:].]/-}.exe"
@@ -92,6 +100,7 @@ LAUNCHERNAME="${PRETTY_NAME//[^[:alnum:].]/-}.exe"
# 'SUSE Linux Enterprise Server 15 SP3 (Snapshot11)' -> 'SUSE Linux Enterprise Server 15 SP3'
SHORT_NAME="${PRETTY_NAME::35}"
+# Use the release number of the image package to set appx version submitted to the MS Store
RELEASE="`rpm -q --qf '%%{release}' %image_package`"
ARCH="%_arch"
case "$ARCH" in
@@ -107,12 +116,17 @@ PUBLISHER_DISPLAY_NAME="SUSE"
# for actual store submission there are more rules:
# https://docs.microsoft.com/en-us/windows/uwp/publish/package-version-numbering
# So we need to mangle the versions in a creative way
+# Summarized, the digits of the four segments are limited to the following ranges:
+# 0-65535, 0-65535, 0-65535, 0
+# Where the fourth segment is reserved for the MS Store use.
if [ "$ID" = "opensuse-tumbleweed" ]; then
VERSION=`printf "%d.%d.%d%02d.0" "${VERSION_ID:2:4}" "${VERSION_ID:6}" "${RELEASE%.*}" "${RELEASE#*.}"`
APPXNAME="${PRETTY_NAME//[^[:alnum:].]/-}-$ARCH-Build$VERSION_ID.$RELEASE.appx"
else
RELEASE="${RELEASE/lp???./}"
- VERSION=`printf "%s.%d%02d.0" "${VERSION_ID}" "${RELEASE%.*}" "${RELEASE#*.}"`
+ # Concatenate digits of VERSION_ID to consume only one segment 0-65535 e.g. 15.3 -> 153
+ # Retain image package version number in the two remaining segments 0-65535.0-65535
+ VERSION=`printf "%d.%d.%d.0" "${VERSION_ID//\./}" "${RELEASE%.*}" "${RELEASE#*.}"`
APPXNAME="${PRETTY_NAME//[^[:alnum:].]/-}-$ARCH-Build$RELEASE.appx"
fi