Skip to content

Commit

Permalink
Merge 7.3 hotfixes (#4066)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiusens authored Mar 10, 2023
2 parents abe37bc + 61b98a1 commit 8b3ed19
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 43 deletions.
3 changes: 0 additions & 3 deletions extensions/desktop/kde-neon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ BIN_DIR := $(DESTDIR)/snap/command-chain
LIB_DIR := $(DESTDIR)/lib
DEST_LAUNCHER := desktop-launch
LOCALE_GENERATOR := locale-gen
BINDTEXTDOMAIN := bindtextdomain.so
DEST_CONFIGURE_HOOK := hooks-configure-desktop

build: $(DEST_LAUNCHER) $(DEST_CONFIGURE_HOOK)
Expand All @@ -23,7 +22,6 @@ $(DEST_LAUNCHER):
@tail -n +2 $(SRC_DIR)/desktop-exports | sed -e "s/%PLATFORM_PLUG%/$${PLATFORM_PLUG:?}/" >> $(DEST_LAUNCHER)
@tail -n +2 $(SRC_DIR)/launcher-specific >> $(DEST_LAUNCHER)
@tail -n +2 $(SRC_DIR)/mark-and-exec >> $(DEST_LAUNCHER)
gcc -Wall -O2 -o $(BINDTEXTDOMAIN) -fPIC -shared $(SRC_DIR)/../src/bindtextdomain.c -ldl

$(DEST_CONFIGURE_HOOK):
@cat $(SRC_DIR)/fonts > $(DEST_CONFIGURE_HOOK)
Expand All @@ -33,5 +31,4 @@ install: $(DEST_LAUNCHER) $(DEST_CONFIGURE_HOOK)
install -d $(DATA_DIR)/kf5
install -D -m755 $(DEST_LAUNCHER) "$(BIN_DIR)"/$(DEST_LAUNCHER)
install -D -m755 $(LOCALE_GENERATOR) "$(BIN_DIR)"/$(LOCALE_GENERATOR)
install -D -m644 $(BINDTEXTDOMAIN) "$(LIB_DIR)"/$(BINDTEXTDOMAIN)
install -D -m755 $(DEST_CONFIGURE_HOOK) "$(BIN_DIR)"/$(DEST_CONFIGURE_HOOK)
27 changes: 13 additions & 14 deletions snapcraft/extensions/kde_neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ def kde_snaps(self) -> KDESnaps:
for part in self.yaml_data["parts"].values():
build_snaps.extend(part.get("build-snaps", []))

matcher = re.compile(r"kde-frameworks-\d+-qt-\d+" + base + r"sd.*")
matcher = re.compile(r"kde-frameworks-\d+-\d+-qt-\d+.*-" + base + r"-sd.*")
sdk_snap_candidates = [s for s in build_snaps if matcher.match(s)]
if sdk_snap_candidates:
sdk_snap = sdk_snap_candidates[0].split("/")[0]
builtin = False
else:
builtin = True
# The same except the trailing -sdk
# The same except the trailing -sd
content = sdk_snap[:-3]

return KDESnaps(sdk=sdk_snap, content=content, builtin=builtin)
Expand Down Expand Up @@ -220,26 +220,25 @@ def get_part_snippet(self) -> Dict[str, Any]:

@overrides
def get_parts_snippet(self) -> Dict[str, Any]:
source = get_extensions_data_dir() / "desktop" / "command-chain"
# We can change this to the lightweight command-chain when
# the content snap includes the desktop-launch from
# https://github.com/snapcore/snapcraft-desktop-integration
source = get_extensions_data_dir() / "desktop" / "kde-neon"

if self.kde_snaps.builtin:
base = self.yaml_data["base"]
sdk_snap = _SDK_SNAP[base]
provider = self.kde_snaps.content
return {
"kde-neon-extension/sdk": {
"kde-neon/sdk": {
"source": str(source),
"source-subdir": "kde-neon",
"plugin": "make",
"make-parameters": [f"PLATFORM_PLUG={provider}"],
"build-packages": ["g++"],
"build-snaps": [f"{sdk_snap}/current/stable"],
}
"make-parameters": [f"PLATFORM_PLUG={self.kde_snaps.content}"],
"build-snaps": [self.kde_snaps.sdk],
},
}

return {
"kde-neon-extension/sdk": {
"kde-neon/sdk": {
"source": str(source),
"plugin": "make",
}
"make-parameters": [f"PLATFORM_PLUG={self.kde_snaps.content}"],
},
}
16 changes: 10 additions & 6 deletions tests/spread/extensions/kde-neon/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ systems:
- ubuntu-20.04
- ubuntu-20.04-64
- ubuntu-20.04-amd64
- ubuntu-22.04
- ubuntu-22.04-64
- ubuntu-22.04-amd64

environment:
SNAP_DIR: ../snaps/neon-hello
Expand All @@ -16,11 +19,6 @@ prepare: |
. "$TOOLS_DIR/snapcraft-yaml.sh"
set_base "$SNAP_DIR/snap/snapcraft.yaml"
if [[ "$SPREAD_SYSTEM" =~ ubuntu-20.04 ]]; then
sed -i 's|command: bin/hello|command: usr/local/bin/hello|' "${SNAP_DIR}/snap/snapcraft.yaml"
sed '/build-snaps: .*/d' "${SNAP_DIR}/snap/snapcraft.yaml"
fi
restore: |
cd "$SNAP_DIR"
snapcraft clean
Expand All @@ -44,9 +42,15 @@ execute: |
[ -f "$snap_user_data/.last_revision" ]
[ "$(cat "$snap_user_data/.last_revision")" = "SNAP_DESKTOP_LAST_REVISION=x1" ]
# Verify content snap was installed for dependency checks.
snap list kde-frameworks-5-99-qt-5-15-7-core20
snap list gtk-common-themes
if [[ "$SPREAD_SYSTEM" =~ ubuntu-20.04 ]]; then
snap list kde-frameworks-5-99-qt-5-15-7-core20
elif [[ "$SPREAD_SYSTEM" =~ ubuntu-22.04 ]]; then
snap list kde-frameworks-5-102-qt-5-15-8-core22
fi
# Verify all dependencies were found.
if echo "$output" | grep -q "part is missing libraries"; then
Expand Down
4 changes: 1 addition & 3 deletions tests/spread/extensions/snaps/neon-hello/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ description: It simply prints a hello world

grade: devel
confinement: strict
base: core18

apps:
neon-hello:
command: bin/hello
command: usr/local/bin/hello
extensions: [kde-neon]

parts:
hello:
build-snaps: [kde-frameworks-5-core18-sdk]
plugin: cmake
source: .
24 changes: 7 additions & 17 deletions tests/unit/extensions/test_kde_neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,53 +297,43 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap):


def test_get_parts_snippet(kde_neon_extension):
source = get_extensions_data_dir() / "desktop" / "command-chain"
source = get_extensions_data_dir() / "desktop" / "kde-neon"

assert kde_neon_extension.get_parts_snippet() == {
"kde-neon-extension/sdk": {
"kde-neon/sdk": {
"source": str(source),
"source-subdir": "kde-neon",
"plugin": "make",
"make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"],
"build-packages": ["g++"],
"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"],
"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"],
}
}


def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap):
source = get_extensions_data_dir() / "desktop" / "command-chain"
source = get_extensions_data_dir() / "desktop" / "kde-neon"

assert kde_neon_extension_with_build_snap.get_parts_snippet() == {
"kde-neon-extension/sdk": {
"kde-neon/sdk": {
"source": str(source),
"source-subdir": "kde-neon",
"plugin": "make",
"make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"],
"build-packages": ["g++"],
"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"],
}
}


def test_get_parts_snippet_with_external_sdk_different_channel(
kde_neon_extension_with_default_build_snap_from_latest_edge,
):
source = get_extensions_data_dir() / "desktop" / "command-chain"
source = get_extensions_data_dir() / "desktop" / "kde-neon"
assert (
kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet()
== {
"kde-neon-extension/sdk": {
"kde-neon/sdk": {
"source": str(source),
"source-subdir": "kde-neon",
"plugin": "make",
"make-parameters": [
"PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"
],
"build-packages": ["g++"],
"build-snaps": [
"kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"
],
}
}
)

0 comments on commit 8b3ed19

Please sign in to comment.