Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared-mime-info: 1.13.1 -> 2.1 #126050

Merged
merged 1 commit into from Jun 7, 2021
Merged

Conversation

est31
Copy link
Contributor

@est31 est31 commented Jun 7, 2021

Motivation for this change

Prior update was in #68732 . The main motivation: #125920 (no idea yet whether it's of any help tho)

https://gitlab.freedesktop.org/xdg/shared-mime-info/-/tags/2.1
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/releases#2.1

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@est31
Copy link
Contributor Author

est31 commented Jun 7, 2021

cc @mimame

@jtojnar
Copy link
Contributor

jtojnar commented Jun 7, 2021

Comparing the outputs of the old and new package, you probably need to run update-mime-database since there is ton of missing files.

Network also is not needed, you just need the appropriate dependencies (docbook_xml_dtd_412 and docbook-xsl-nons). But even if we build it, it is not actually installed so it is probably useless.

Lastly, could you please add freedesktop team to maintainers,

diff --git a/pkgs/data/misc/shared-mime-info/default.nix b/pkgs/data/misc/shared-mime-info/default.nix
index fefb7355ba3..63713d03e6d 100644
--- a/pkgs/data/misc/shared-mime-info/default.nix
+++ b/pkgs/data/misc/shared-mime-info/default.nix
@@ -1,4 +1,5 @@
-{ lib, stdenv
+{ stdenv
+, lib
 , fetchurl
 , fetchpatch
 , meson
@@ -20,6 +21,15 @@ stdenv.mkDerivation rec {
     sha256 = "0qw59rixlilrfzz730c55y8wzsbp7qzpn469yb83bs44vpy0rm5j";
   };
 
+  patches = [
+    # xmlto is only used for building spec, which is not installed anyway.
+    (fetchpatch {
+      name = "xmlto-optional.patch";
+      url = "https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/110.patch";
+      sha256 = "0p5gxlcmn8ji5bc7pd105s1halqwa1d28lfx9yj43rn6mav7allx";
+    })
+  ];
+
   nativeBuildInputs = [
     meson
     ninja
@@ -35,18 +45,15 @@ stdenv.mkDerivation rec {
     glib
   ];
 
-  # using xmlto involves using the network
-  patches = [(fetchpatch {
-    name = "xmlto-optional.patch";
-    url = "https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/110.patch";
-    sha256 = "0p5gxlcmn8ji5bc7pd105s1halqwa1d28lfx9yj43rn6mav7allx";
-  })];
+  mesonFlags = [
+    "-Dupdate-mimedb=true"
+  ];
 
   meta = with lib; {
     description = "A database of common MIME types";
     homepage = "http://freedesktop.org/wiki/Software/shared-mime-info";
     license = licenses.gpl2Plus;
     platforms = platforms.unix;
-    maintainers = [ maintainers.mimame ];
+    maintainers = teams.freedesktop.members ++ [ maintainers.mimame ];
   };
 }

@jtojnar
Copy link
Contributor

jtojnar commented Jun 7, 2021

Also this needs to target staging branch since it causes a mass rebuild.

@est31
Copy link
Contributor Author

est31 commented Jun 7, 2021

I've tried out github's "change base branch" feature to not have to open a new PR and apparently it requested tons of reviews as a result... sorry for the inbox spam.


src = fetchurl {
url = "https://gitlab.freedesktop.org/xdg/${pname}/uploads/5349e18c86eb96eee258a5c1f19122d0/${pname}-${version}.tar.xz";
sha256 = "1bic8z5nz08qxv1x6zlxnx2j4cmlzm12kygrn3rrh1djqxdhma3f";
url = "https://gitlab.freedesktop.org/xdg/${pname}/uploads/0ee50652091363ab0d17e335e5e74fbe/${pname}-${version}.tar.xz";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
url = "https://gitlab.freedesktop.org/xdg/${pname}/uploads/0ee50652091363ab0d17e335e5e74fbe/${pname}-${version}.tar.xz";
url = "https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/0ee50652091363ab0d17e335e5e74fbe/shared-mime-info-${version}.tar.xz";

Also why is this not using fetchFromGitLab?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you supposed to avoid pname? I'm very new to this so I have no idea. Also, I've adopted fetchFromGitlab now, using ${pname}, but can change it if requested.

@est31
Copy link
Contributor Author

est31 commented Jun 7, 2021

I've tried building the gtksourceview package again after applying @jtojnar 's suggestions and now the package works well.

@ofborg ofborg bot requested a review from jtojnar June 7, 2021 13:02
@jtojnar jtojnar merged commit b43f2e9 into NixOS:staging Jun 7, 2021
@jtojnar
Copy link
Contributor

jtojnar commented Jun 7, 2021

This has been on my to-do list for the past year so thanks for tackling this 😸

@est31 est31 deleted the update-shared-mime-info branch June 10, 2021 08:54
@Mindavi
Copy link
Contributor

Mindavi commented Jun 16, 2021

Note that this does break cross-compilation. I'll see if I can do anything about that. The first thing that I see is that libxml2 seems to be required in the nativeBuildInputs now, but after that it tries to run the update-mimedb tool, which is not configured correctly in meson as a tool that might need to be run on the 'build' platform (the terminology keeps confusing me...).

That's something that (ideally) needs to be addressed upstream though, I'll check if I can convince them to fix that :).

shared-mime-info 1.13.1 did seem to cross-compile ok.

@Mindavi
Copy link
Contributor

Mindavi commented Jun 23, 2021

I've made a PR upstream: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/136, hope that gets accepted and then it should be good again 👍.

Seems that it was a relatively easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants