about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorOTABI Tomoya <tomoya.otabi@gmail.com>2024-03-20 09:00:42 +0900
committerGitHub <noreply@github.com>2024-03-20 09:00:42 +0900
commitf7341d3c92339c0196bfef109ac59008f6ca60ae (patch)
treea81cfbd46cc2ec4c63ad02f49aa3e293a893d10d /pkgs
parent7b715c5023ecf745d4a1056f4f5053d5b7c1ce91 (diff)
parentf3fbb9d016f3c3a0360fc1f2d1f0a482bb19a9dd (diff)
downloadnixlib-f7341d3c92339c0196bfef109ac59008f6ca60ae.tar
nixlib-f7341d3c92339c0196bfef109ac59008f6ca60ae.tar.gz
nixlib-f7341d3c92339c0196bfef109ac59008f6ca60ae.tar.bz2
nixlib-f7341d3c92339c0196bfef109ac59008f6ca60ae.tar.lz
nixlib-f7341d3c92339c0196bfef109ac59008f6ca60ae.tar.xz
nixlib-f7341d3c92339c0196bfef109ac59008f6ca60ae.tar.zst
nixlib-f7341d3c92339c0196bfef109ac59008f6ca60ae.zip
Merge pull request #288999 from aiotter/dev/git-filter-repo
git-filter-repo: fix broken --help option
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/python-modules/git-filter-repo/default.nix36
1 files changed, 33 insertions, 3 deletions
diff --git a/pkgs/development/python-modules/git-filter-repo/default.nix b/pkgs/development/python-modules/git-filter-repo/default.nix
index f617eccb51a3..fa0fa0148b8d 100644
--- a/pkgs/development/python-modules/git-filter-repo/default.nix
+++ b/pkgs/development/python-modules/git-filter-repo/default.nix
@@ -1,15 +1,19 @@
 { lib
 , buildPythonPackage
-, fetchpatch
+, fetchFromGitHub
 , fetchPypi
+, fetchpatch
+, installShellFiles
 , pythonOlder
 , setuptools-scm
+, writeScript
 }:
 
 buildPythonPackage rec {
   pname = "git-filter-repo";
   version = "2.38.0";
-  format = "setuptools";
+  docs_version = "01ead411966a83dfcfb35f9d2e8a9f7f215eaa65";
+  pyproject = true;
 
   disabled = pythonOlder "3.5";
 
@@ -18,6 +22,13 @@ buildPythonPackage rec {
     hash = "sha256-/hdT4Y8L1tPJtXhoyAEa59BWpuurcGcGOWoV71MScl4=";
   };
 
+  docs = fetchFromGitHub {
+    owner = "newren";
+    repo = "git-filter-repo";
+    rev = docs_version;
+    hash = "sha256-Z/3w3Rguo8sfuc/OQ25eFbMfiOHjxQqPY6S32zuvoY4=";
+  };
+
   patches = [
     # https://github.com/newren/git-filter-repo/pull/498
     (fetchpatch {
@@ -28,8 +39,13 @@ buildPythonPackage rec {
     })
   ];
 
+  postInstall = ''
+    installManPage ${docs}/man1/git-filter-repo.1
+  '';
+
   nativeBuildInputs = [
     setuptools-scm
+    installShellFiles
   ];
 
   # Project has no tests
@@ -44,6 +60,20 @@ buildPythonPackage rec {
     mainProgram = "git-filter-repo";
     homepage = "https://github.com/newren/git-filter-repo";
     license = with licenses; [ mit /* or */ gpl2Plus ];
-    maintainers = with maintainers; [ fab ];
+    maintainers = with maintainers; [ aiotter fab ];
   };
+
+  passthru.updateScript = writeScript "update-${pname}" ''
+    #!/usr/bin/env nix-shell
+    #!nix-shell -i bash -p common-updater-scripts curl jq nix-update
+
+    set -eu -o pipefail
+
+    # Update program
+    nix-update ${pname}
+
+    # Update docs
+    docs_latest=$(curl -s https://api.github.com/repos/newren/git-filter-repo/commits/heads/docs/status | jq -r '.sha')
+    [[ "${docs_version}" = "$docs_latest" ]] || update-source-version ${pname} "$docs_latest" --version-key=docs_version --source-key=docs
+  '';
 }