Unverified Commit b23f4dd3 authored by Marcin Serwin's avatar Marcin Serwin
Browse files

sourcehut.hgsrht: 0.33.0 -> 0.36.1

parent 2200d554
Loading
Loading
Loading
Loading
+41 −27
Original line number Diff line number Diff line
{
  lib,
  fetchFromSourcehut,
  fetchpatch,
  buildGoModule,
  buildPythonPackage,
  srht,
@@ -11,65 +12,71 @@
  unzip,
  pip,
  pythonOlder,
  setuptools,
  setuptools-scm,
}:

let
  version = "0.33.0";
  version = "0.36.1";
  gqlgen = import ./fix-gqlgen-trimpath.nix {
    inherit unzip;
    gqlgenVersion = "0.17.45";
    gqlgenVersion = "0.17.64";
  };

  pyproject = true;

  disabled = pythonOlder "3.7";
  patches = [
    (fetchpatch {
      name = "update-core-go-and-gqlgen.patch";
      url = "https://hg.sr.ht/~sircmpwn/hg.sr.ht/rev/2765f086c3a67e00219cabe9a1dd01b2012c5c12.patch";
      hash = "sha256-MLZG07tD7vrfvx2GDRUvFd/7VxxZLrAa/C3bB/IvQpI=";
    })
    ./patches/core-go-update/hg/patch-deps.patch
  ];

  src = fetchFromSourcehut {
    owner = "~sircmpwn";
    repo = "hg.sr.ht";
    rev = version;
    hash = "sha256-+BYeE+8dXY/MLLYyBBLD+eKqmrPiKyyCGIZLkCPzNYM=";
    hash = "sha256-EeWRUb/BZ+KJXNqmzCFYHkvWUaPvF/F7ZaOYM0IEYwk=";
    vc = "hg";
  };

  hgsrht-api = buildGoModule (
    {
      inherit src version;
      inherit src version patches;
      pname = "hgsrht-api";
      modRoot = "api";
      vendorHash = "sha256-K+KMhcvkG/qeQTnlHS4xhLCcvBQNNp2DcScJPm8Dbic=";
      vendorHash = "sha256-elaVmyaO5IbzsnBYRjJvmoOFR8gx1xCfzd3z01KNXVA=";
    }
    // gqlgen
  );

  hgsrht-keys = buildGoModule {
    inherit src version;
    inherit src version patches;
    pname = "hgsrht-keys";
    modRoot = "hgsrht-keys";
    vendorHash = "sha256-7ti8xCjSrxsslF7/1X/GY4FDl+69hPL4UwCDfjxmJLU=";
    modRoot = "keys";
    vendorHash = "sha256-U5NtgyUgVqI25XBg51U7glNRpR5MZBCcsuuR6f+gZc8=";

    postPatch = ''
      substituteInPlace hgsrht-keys/main.go \
        --replace /var/log/hgsrht-keys /var/log/sourcehut/hgsrht-keys
      substituteInPlace keys/main.go \
        --replace-fail /var/log/hg.sr.ht-keys /var/log/sourcehut/hg.sr.ht-keys
    '';
  };
in
buildPythonPackage rec {
  inherit src version;
  inherit src version patches;
  pname = "hgsrht";

  postPatch = ''
    substituteInPlace Makefile \
      --replace "all: api hgsrht-keys" ""
  pyproject = true;

    substituteInPlace hgsrht-shell \
      --replace /var/log/hgsrht-shell /var/log/sourcehut/hgsrht-shell
  disabled = pythonOlder "3.7";

  postPatch = ''
    substituteInPlace hg.sr.ht-shell \
      --replace-fail /var/log/hg.sr.ht-shell /var/log/sourcehut/hg.sr.ht-shell
  '';

  nativeBuildInputs = [
    pip
    setuptools
    setuptools-scm
  ];

  propagatedBuildInputs = [
@@ -79,20 +86,27 @@ buildPythonPackage rec {
    unidiff
  ];

  preBuild = ''
    export PKGVER=${version}
    export SRHT_PATH=${srht}/${python.sitePackages}/srht
  env = {
    PKGVER = version;
    SRHT_PATH = "${srht}/${python.sitePackages}/srht";
    PREFIX = placeholder "out";
  };

  postBuild = ''
    make SASSC_INCLUDE=-I${srht}/share/sourcehut/scss/ all-share
  '';

  postInstall = ''
    ln -s ${hgsrht-api}/bin/api $out/bin/hgsrht-api
    ln -s ${hgsrht-keys}/bin/hgsrht-keys $out/bin/hgsrht-keys
    ln -s ${hgsrht-api}/bin/api $out/bin/hg.sr.ht-api
    ln -s ${hgsrht-keys}/bin/hgsrht-keys $out/bin/hg.sr.ht-keys
    install -Dm644 schema.sql $out/share/sourcehut/hg.sr.ht-schema.sql
    make install-share
  '';

  pythonImportsCheck = [ "hgsrht" ];

  meta = with lib; {
    homepage = "https://git.sr.ht/~sircmpwn/hg.sr.ht";
    homepage = "https://hg.sr.ht/~sircmpwn/hg.sr.ht";
    description = "Mercurial repository hosting service for the sr.ht network";
    license = licenses.agpl3Only;
    maintainers = with maintainers; [
+25 −0
Original line number Diff line number Diff line
diff --git a/go.mod b/go.mod
index ba49458..3a31083 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.22.5
 toolchain go1.24.0
 
 require (
-	git.sr.ht/~sircmpwn/core-go v0.0.0-20250304085405-cbf919e45b5b
+	git.sr.ht/~sircmpwn/core-go v0.0.0-20250311210855-6ba248d8be1b
 	git.sr.ht/~sircmpwn/dowork v0.0.0-20241216125407-2b00aa42322c
 	github.com/99designs/gqlgen v0.17.64
 	github.com/Masterminds/squirrel v1.5.4
diff --git a/go.sum b/go.sum
index 61766aa..e01c045 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,7 @@
 git.sr.ht/~sircmpwn/core-go v0.0.0-20250304085405-cbf919e45b5b h1:d76irAQODAtl5G1zmKfwf60544fyGz74YT9k+7yYVxc=
 git.sr.ht/~sircmpwn/core-go v0.0.0-20250304085405-cbf919e45b5b/go.mod h1:UHi3kXwgfZ/DIbMu5LeqZb3KrY/jsdUDefc8+3YWC3c=
+git.sr.ht/~sircmpwn/core-go v0.0.0-20250311210855-6ba248d8be1b h1:UuQxEJrh/NNdmaVcK34opEz7ypXnPyxeRcT7Aigz+7E=
+git.sr.ht/~sircmpwn/core-go v0.0.0-20250311210855-6ba248d8be1b/go.mod h1:UHi3kXwgfZ/DIbMu5LeqZb3KrY/jsdUDefc8+3YWC3c=
 git.sr.ht/~sircmpwn/dowork v0.0.0-20241216125407-2b00aa42322c h1:v2opuaN0C5ZpuCifRNR9ZQ8V9IG+Ja80otK1MFj5RnI=
 git.sr.ht/~sircmpwn/dowork v0.0.0-20241216125407-2b00aa42322c/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=
 git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw=