From 435ff3118e8bbf9b74989fb2884caaddc35f747d Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 10 Apr 2020 22:54:06 +0200 Subject: [PATCH] subsurface: 4.8.2 -> 4.9.3 This bumps subsurface to 4.9.3. As the subsurface-specific libdivecomputer source is shipped as a git submodule these days, we can avoid having to fetch a separate tarball that needs to be kept in sync (and is only uploaded for each release). This also applies a patch on top of 4.9.3 to properly handle libgit2 versions 1.0 and later - conditional code for older libgit versions has been removed upstream, but that's a nontrivial backport, which is why this patch was added. --- ...ifdef-to-handle-libgit2-v1.0-and-onw.patch | 41 +++++++++++++++++++ pkgs/applications/misc/subsurface/default.nix | 24 +++++++---- 2 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 pkgs/applications/misc/subsurface/0001-core-fix-libgit-ifdef-to-handle-libgit2-v1.0-and-onw.patch diff --git a/pkgs/applications/misc/subsurface/0001-core-fix-libgit-ifdef-to-handle-libgit2-v1.0-and-onw.patch b/pkgs/applications/misc/subsurface/0001-core-fix-libgit-ifdef-to-handle-libgit2-v1.0-and-onw.patch new file mode 100644 index 000000000000..027e3f493e12 --- /dev/null +++ b/pkgs/applications/misc/subsurface/0001-core-fix-libgit-ifdef-to-handle-libgit2-v1.0-and-onw.patch @@ -0,0 +1,41 @@ +From dfa4bcafec4425659a409550085417af3c5c787b Mon Sep 17 00:00:00 2001 +From: Florian Klink +Date: Sat, 11 Apr 2020 12:38:38 +0200 +Subject: [PATCH] core: fix libgit ifdef to handle libgit2 v1.0 and onwards + +Conditional code for older libgit versions was removed in +https://github.com/Subsurface-divelog/subsurface/pull/2737, +but it's a non-trivial backport, and master currently isn't really ready +for a release. + +So instead ship a patch fixing the one broken libgit2 conditional until +a 4.10 release has been made. + +Note the inverted logic - the if branch now handles the old libgit +condition, and the else branch the newer versions, consistent with how +it's done in the rest of the subsurface codebase. +--- + core/git-access.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/core/git-access.c b/core/git-access.c +index 3688cb90c..9997fc8fd 100644 +--- a/core/git-access.c ++++ b/core/git-access.c +@@ -359,10 +359,10 @@ static int try_to_git_merge(git_repository *repo, git_reference **local_p, git_r + } + + git_merge_init_options(&merge_options, GIT_MERGE_OPTIONS_VERSION); +-#if !LIBGIT2_VER_MAJOR && LIBGIT2_VER_MINOR > 23 +- merge_options.flags = GIT_MERGE_FIND_RENAMES; +-#else ++#if !LIBGIT2_VER_MAJOR && LIBGIT2_VER_MINOR <= 22 + merge_options.tree_flags = GIT_MERGE_TREE_FIND_RENAMES; ++#else ++ merge_options.flags = GIT_MERGE_FIND_RENAMES; + #endif + merge_options.file_favor = GIT_MERGE_FILE_FAVOR_UNION; + merge_options.rename_threshold = 100; +-- +2.25.1 + diff --git a/pkgs/applications/misc/subsurface/default.nix b/pkgs/applications/misc/subsurface/default.nix index 960b7b9eeef5..d4b2f8cad308 100644 --- a/pkgs/applications/misc/subsurface/default.nix +++ b/pkgs/applications/misc/subsurface/default.nix @@ -4,16 +4,22 @@ }: let - version = "4.8.2"; + version = "4.9.3"; + + subsurfaceSrc = (fetchFromGitHub { + owner = "Subsurface-divelog"; + repo = "subsurface"; + rev = "v${version}"; + sha256 = "1i07f7appifx9j205x5a7ng01wsipxr6n9a3692pm60jli2nsir5"; + fetchSubmodules = true; + }); libdc = stdenv.mkDerivation { pname = "libdivecomputer-ssrf"; inherit version; - src = fetchurl { - url = "https://subsurface-divelog.org/downloads/libdivecomputer-subsurface-branch-${version}.tgz"; - sha256 = "167qan59raibmilkc574gdqxfjg2f5ww2frn86xzk2kn4qg8190w"; - }; + src = subsurfaceSrc; + sourceRoot = "source/libdivecomputer"; nativeBuildInputs = [ autoreconfHook ]; @@ -70,10 +76,10 @@ in stdenv.mkDerivation { pname = "subsurface"; inherit version; - src = fetchurl { - url = "https://subsurface-divelog.org/downloads/Subsurface-${version}.tgz"; - sha256 = "1fzrq6rqb6pzs36wxar2453cl509dqpcy9w7nq4gw7b1v2331wfy"; - }; + src = subsurfaceSrc; + + # remove with the 4.10 release + patches = [ ./0001-core-fix-libgit-ifdef-to-handle-libgit2-v1.0-and-onw.patch ]; buildInputs = [ libdc googlemaps