Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

chore: package example as a snap #137

Merged
merged 4 commits into from
Jun 30, 2023
Merged

Conversation

Jupi007
Copy link
Member

@Jupi007 Jupi007 commented Feb 24, 2023

@kenvandine I simply copied that you did here: ubuntu/yaru.dart#367
But I'd like to have your review and your help to publish it.

Fixes #135

snap/snapcraft.yaml Outdated Show resolved Hide resolved
@Jupi007 Jupi007 changed the title Package example as snap chore: package example as a snap Jun 30, 2023
@jpnurmi
Copy link
Member

jpnurmi commented Jun 30, 2023

There's a mismatch (example vs. yaru_icons_example) in the name of the binary:

Cannot pack snap file: Command '['snap', 'pack', '--filename', 'yaru-icons-example_0+git.327401c_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1. (2023/06/30 07:08:25.354155 container.go:215: in snap "yaru-icons-example": path "bin/yaru_icons_example" does not exist
error: cannot pack "/root/prime": snap is unusable due to missing files)                                                                                               
Failed to execute pack in instance.                                                                                                                                      

Either tell snapcraft that the binary is bin/example:

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index a9d9875..b9d38c3 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -49,7 +49,7 @@ parts:
 
 apps:
   yaru-icons-example:
-    command: bin/yaru_icons_example
+    command: bin/example
     desktop: snap/gui/yaru-icons-example.desktop
     extensions: [gnome]
     plugs:

Or rename the binary to yaru_icons_example:

diff --git a/example/linux/CMakeLists.txt b/example/linux/CMakeLists.txt
index a558bc4..9ffa4f2 100644
--- a/example/linux/CMakeLists.txt
+++ b/example/linux/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.10)
 project(runner LANGUAGES CXX)
 
-set(BINARY_NAME "example")
+set(BINARY_NAME "yaru_icons_example")
 set(APPLICATION_ID "com.example.example")
 
 cmake_policy(SET CMP0063 NEW)

@Jupi007
Copy link
Member Author

Jupi007 commented Jun 30, 2023

@jpnurmi I just checked the yaru_widgets repo and the binary has been renamed. So I replicated that here.

Btw, I also changed the APPLICATION_ID, is it fine?

Copy link
Member

@jpnurmi jpnurmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

$ snapcraft 
Launching instance...                                                                                                                                                    
...                                                                                                                             
Version has been set to '0+git.e38151b'                                                                                                                                  
Created snap package yaru-icons-example_0+git.e38151b_amd64.snap
$ snap install yaru-icons-example_0+git.e38151b_amd64.snap --dangerous
yaru-icons-example 0+git.e38151b installed
$ yaru-icons-example

Works :)

@jpnurmi
Copy link
Member

jpnurmi commented Jun 30, 2023

Btw, I also changed the APPLICATION_ID, is it fine?

Yes, thanks for fixing it!

@Jupi007
Copy link
Member Author

Jupi007 commented Jun 30, 2023

Awesome, thanks.
Let's merge this.

I had another question: I looked at the snapcraft doc, and I didn't saw how to do automated uploads. Is it possible?

@Jupi007 Jupi007 merged commit 67d5e40 into ubuntu:master Jun 30, 2023
@Jupi007 Jupi007 deleted the Jupi007/issue135 branch June 30, 2023 07:53
@jpnurmi
Copy link
Member

jpnurmi commented Jun 30, 2023

I had another question: I looked at the snapcraft doc, and I didn't saw how to do automated uploads. Is it possible?

On snapcraft.io, you can link a snap to a GitHub repo. :)

@Jupi007
Copy link
Member Author

Jupi007 commented Jun 30, 2023

Oh okay, great!
Thanks :)

@Jupi007
Copy link
Member Author

Jupi007 commented Jun 30, 2023

Snap published!

https://snapcraft.io/yaru-icons-example

Still only in edge branch, I want to update the example before moving to stable.

@github-actions github-actions bot mentioned this pull request Jul 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package example as snap
2 participants