summary refs log tree commit diff
diff options
context:
space:
mode:
authorJade Lovelace <jadel@mercury.com>2022-07-20 15:24:12 -0700
committerJade Lovelace <jadel@mercury.com>2022-07-20 15:27:52 -0700
commit30ff3e31460f1220dfeed0048e5a9f78a32c762d (patch)
tree4d67a8e808cc35e5ae0bd133b0379ab8a1e1f460
parent6d626b5e11ba5b3c0a2d98e953f3b624385ab969 (diff)
downloadnixpkgs-30ff3e31460f1220dfeed0048e5a9f78a32c762d.tar
nixpkgs-30ff3e31460f1220dfeed0048e5a9f78a32c762d.tar.gz
nixpkgs-30ff3e31460f1220dfeed0048e5a9f78a32c762d.tar.bz2
nixpkgs-30ff3e31460f1220dfeed0048e5a9f78a32c762d.tar.lz
nixpkgs-30ff3e31460f1220dfeed0048e5a9f78a32c762d.tar.xz
nixpkgs-30ff3e31460f1220dfeed0048e5a9f78a32c762d.tar.zst
nixpkgs-30ff3e31460f1220dfeed0048e5a9f78a32c762d.zip
schemaspy: 6.1.0 -> dev
Unfortunately, schemaspy is broken with graphviz 3.0.0, and they haven't
tagged their releases in a very long time.

Let's just build from source and not worry about it.
-rw-r--r--pkgs/development/tools/database/schemaspy/default.nix74
1 files changed, 63 insertions, 11 deletions
diff --git a/pkgs/development/tools/database/schemaspy/default.nix b/pkgs/development/tools/database/schemaspy/default.nix
index 7a755d0186b..30100bac08a 100644
--- a/pkgs/development/tools/database/schemaspy/default.nix
+++ b/pkgs/development/tools/database/schemaspy/default.nix
@@ -1,30 +1,83 @@
-{ lib, stdenv, fetchurl, jre, makeWrapper, graphviz }:
+{ lib
+, stdenv
+, callPackage
+, maven
+, jdk
+, jre
+, buildMaven
+, makeWrapper
+, git
+, fetchFromGitHub
+, graphviz
+, ensureNewerSourcesHook
+}:
 
-stdenv.mkDerivation rec {
-  version = "6.1.0";
+let
+  version = "6.1.1-SNAPSHOT";
   pname = "schemaspy";
 
-  src = fetchurl {
-    url = "https://github.com/schemaspy/schemaspy/releases/download/v${version}/${pname}-${version}.jar";
-    sha256 = "0lgz6b17hx9857fb2l03ggz8y3n8a37vrcsylif0gmkwj1v4qgl7";
+  src = fetchFromGitHub {
+    owner = "schemaspy";
+    repo = "schemaspy";
+    rev = "110b1614f9ae4aec0e4dc4e8f0e7c647274d3af6";
+    sha256 = "sha256-X5B34zGhD/NxcK8TQvwdk1NljGJ1HwfBp47ocbE4HiU=";
   };
 
-  dontUnpack = true;
+  deps = stdenv.mkDerivation {
+    name = "${pname}-${version}-deps";
+    inherit src;
+
+    nativeBuildInputs = [ jdk maven git ];
+    buildInputs = [ jre ];
+
+    buildPhase = ''
+      mvn package -Dmaven.test.skip=true -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000
+    '';
+
+    # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
+    installPhase = ''
+      find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete
+      find $out/.m2 -type f -iname '*.pom' -exec sed -i -e 's/\r\+$//' {} \;
+    '';
+
+    outputHashAlgo = "sha256";
+    outputHashMode = "recursive";
+    outputHash = "sha256-CUFA9L6qqjo3Jp5Yy1yCqbS9QAEb9PElys4ArPa9VhA=";
+
+    doCheck = false;
+  };
+in
+stdenv.mkDerivation rec {
+  inherit version pname src;
 
   buildInputs = [
-    jre
+    maven
   ];
 
   nativeBuildInputs = [
     makeWrapper
+    # the build system gets angry if it doesn't see git (even though it's not
+    # actually in a git repository)
+    git
+
+    # springframework boot gets angry about 1970 sources
+    # fix from https://github.com/nix-community/mavenix/issues/25
+    (ensureNewerSourcesHook { year = "1980"; })
   ];
 
   wrappedPath = lib.makeBinPath [
     graphviz
   ];
 
+  buildPhase = ''
+    VERSION=${version}
+    SEMVER_STR=${version}
+
+    mvn package --offline -Dmaven.test.skip=true -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
+  '';
+
   installPhase = ''
-    install -D ${src} "$out/share/java/${pname}-${version}.jar"
+    install -D target/${pname}-${version}.jar $out/share/java/${pname}-${version}.jar
 
     makeWrapper ${jre}/bin/java $out/bin/schemaspy \
       --add-flags "-jar $out/share/java/${pname}-${version}.jar" \
@@ -34,8 +87,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://schemaspy.org";
     description = "Document your database simply and easily";
-    sourceProvenance = with sourceTypes; [ binaryBytecode ];
-    license = licenses.mit;
+    license = licenses.lgpl3Plus;
     maintainers = with maintainers; [ jraygauthier ];
   };
 }