[bug#41293,1/3] gnu: Add sideload.
diff mbox series

Message ID 20200602012736.4292-2-rprior@protonmail.com
State New
Headers show
Series
  • Updated Pantheon packages
Related show

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Tobias Geerinckx-Rice via Guix-patches via June 2, 2020, 1:27 a.m. UTC
* gnu/packages/pantheon.scm (sideload): New variable.
---
 gnu/packages/pantheon.scm | 60 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

Comments

Marius Bakke June 22, 2020, 7:16 p.m. UTC | #1
Hello!

Sorry for the slooow response...

Ryan Prior via Guix-patches via <guix-patches@gnu.org> writes:

> * gnu/packages/pantheon.scm (sideload): New variable.

[...]

> +       (modify-phases %standard-phases
> +         (add-before 'install 'set-environment-variables
> +           (lambda _
> +             ;; Disable compiling schemas and updating desktop databases
> +             (setenv "DESTDIR" "/")
> +             #t))

That's an unorthodox workaround :-) does the build system ignore it when
DESTDIR is set, or do they just end up in a different location?

Is the "glib:bin" input still needed?

> +    (inputs
> +     `(("flatpak" ,flatpak)
> +       ("granite" ,granite)
> +       ("gtk" ,gtk+)
> +       ("libostree" ,libostree)))
> +    (propagated-inputs
> +     `(("glib-networking" ,glib-networking)))

Can you add a comment about why this needs to be propagated?

> +    (native-inputs
> +     `(("cmake" ,cmake)

Use 'cmake-minimal' if CMake is required (is it?).

> +       ("gettext" ,gettext-minimal)
> +       ("glib" ,glib)
> +       ("glib:bin" ,glib "bin")
> +       ("gobject-introspection" ,gobject-introspection)
> +       ("libgee" ,libgee)
> +       ("libxml2" ,libxml2)
> +       ("pkg-config" ,pkg-config)
> +       ("vala" ,vala)))
> +    (home-page "https://github.com/elementary/sideload")
> +    (synopsis "Graphical application to side-load Flatpaks")
> +    (description "Sideload handles flatpakref files, like those you might find
> +on Flathub or another third-party website providing a Flatpak app for
> +download.")
> +    (license license:gpl3)))

This should be 'gpl3+' because no source files say "GPL 3 only" (in fact
they explicitly mention GPL 3 or any later version).
Marius Bakke June 24, 2020, 7:39 p.m. UTC | #2
Hi Ryan,

(+ debbugs, please keep it in CC)

Ryan Prior <rprior@protonmail.com> writes:

> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Monday, June 22, 2020 7:16 PM, Marius Bakke <marius@gnu.org> wrote:
>
>
>> That's an unorthodox workaround :-) does the build system ignore it when
>> DESTDIR is set, or do they just end up in a different location?
>
> This is a common pattern in build systems for Pantheon software, one you'll see come up again and again as I add more Pantheon packages. The post-install script runs extra steps unless the DESTDIR env variable is set. For example: https://github.com/elementary/sideload/blob/master/meson/post_install.py#L9

OK.  Weird, but works.  :-)

>> Is the "glib:bin" input still needed?
>
> Yes, for glib-compile-resources, which is invoked here as it is with many other GNOME packages in Guix.

Right.

>> > -   (propagated-inputs
>> > -       `(("glib-networking" ,glib-networking)))
>> >
>> >
>>
>> Can you add a comment about why this needs to be propagated?
>
> I didn't take good notes, it was basically "it didn't work without this." And now that I try it again, it seems what I really need to propagate is gpgme and not glib-networking. I will add a note. (I want to get good at patching packages to remove the need for propagation but I don't know where to begin with this one.)

At least for GnuPG, substituting all references to 'gpg' with
(string-append gnupg "/bin/gpg") should work.  I guess something similar
will work for GPGME.

>>
>> > -   (native-inputs
>> > -       `(("cmake" ,cmake)
>> >
>> >
>>
>> Use 'cmake-minimal' if CMake is required (is it?).
>
> Nope was never needed, removed. (I think I was adding cmake to a lot of Meson packages for a while because they complain about not having it in their build output, but it's really just a warning.)

Yes, learning to ignore useless warnings is an important packaging
skill.  :-)

>> > -   (license license:gpl3)))
>>
>> This should be 'gpl3+' because no source files say "GPL 3 only" (in fact
>> they explicitly mention GPL 3 or any later version).
>
> Fixed & updated patch follows.

Applied!  I moved 'glib', 'libgee', and 'libxml2' to inputs because they
were referenced by the io.elementary.sideload binary.  Let me know if
you think this was wrong.

Will you submit updated patches for the other two in this series too?

Thanks!

Patch
diff mbox series

diff --git a/gnu/packages/pantheon.scm b/gnu/packages/pantheon.scm
index 72910e5470..6709cd2d8a 100644
--- a/gnu/packages/pantheon.scm
+++ b/gnu/packages/pantheon.scm
@@ -18,11 +18,14 @@ 
 
 (define-module (gnu packages pantheon)
   #:use-module (gnu packages cmake)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages package-management)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages)
   #:use-module (guix build-system meson)
   #:use-module (guix git-download)
@@ -107,3 +110,60 @@  in apps built for the Pantheon desktop.")
 arithmetic.  It is the default calculator application in the Pantheon
 desktop.")
     (license license:gpl3)))
+
+(define-public sideload
+  (package
+    (name "sideload")
+    (version "1.1.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/elementary/sideload.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0mlc3nm2navzxm8k1rwpbw4w6mv30lmhqybm8jqxd4v8x7my73vq"))))
+    (build-system meson-build-system)
+    (arguments
+     `(#:glib-or-gtk? #t
+       #:configure-flags (list (string-append "-Dflatpak="
+                                              (assoc-ref %build-inputs "flatpak")
+                                              "/include"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'install 'set-environment-variables
+           (lambda _
+             ;; Disable compiling schemas and updating desktop databases
+             (setenv "DESTDIR" "/")
+             #t))
+         (add-after 'install 'install-symlinks
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin/io.elementary.sideload"))
+                    (link (string-append out "/bin/sideload")))
+               (symlink bin link)))))))
+    (inputs
+     `(("flatpak" ,flatpak)
+       ("granite" ,granite)
+       ("gtk" ,gtk+)
+       ("libostree" ,libostree)))
+    (propagated-inputs
+     `(("glib-networking" ,glib-networking)))
+    (native-inputs
+     `(("cmake" ,cmake)
+       ("gettext" ,gettext-minimal)
+       ("glib" ,glib)
+       ("glib:bin" ,glib "bin")
+       ("gobject-introspection" ,gobject-introspection)
+       ("libgee" ,libgee)
+       ("libxml2" ,libxml2)
+       ("pkg-config" ,pkg-config)
+       ("vala" ,vala)))
+    (home-page "https://github.com/elementary/sideload")
+    (synopsis "Graphical application to side-load Flatpaks")
+    (description "Sideload handles flatpakref files, like those you might find
+on Flathub or another third-party website providing a Flatpak app for
+download.")
+    (license license:gpl3)))