about summary refs log tree commit diff
path: root/pkgs/by-name/uc
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2023-09-12 23:42:19 -0300
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-09-13 15:31:38 +0000
commit8485cdfad53722d0ac2c529100f85d369cd71a2d (patch)
tree13ae793bef00ac5a32c166c3337c4ca333e34634 /pkgs/by-name/uc
parent74ebb96a9df71b4ab3634cba61105f1ec372f564 (diff)
ucg: cleanup
- Use rec-less, overlay-style overridable recursive attributes (in effect since
https://github.com/NixOS/nixpkgs/pull/119942);
- Remove installCheckPhase
  - Change it to a separated derivation inside passthru.tests
- Set meta.mainProgram
Diffstat (limited to 'pkgs/by-name/uc')
-rw-r--r--pkgs/by-name/uc/ucg/package.nix54
-rw-r--r--pkgs/by-name/uc/ucg/tests/simple.nix26
2 files changed, 80 insertions, 0 deletions
diff --git a/pkgs/by-name/uc/ucg/package.nix b/pkgs/by-name/uc/ucg/package.nix
new file mode 100644
index 0000000000000..99d1b90c43dfe
--- /dev/null
+++ b/pkgs/by-name/uc/ucg/package.nix
@@ -0,0 +1,54 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, autoreconfHook
+, callPackage
+, pkg-config
+, pcre
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "ucg";
+  version = "unstable-2022-09-03";
+
+  src = fetchFromGitHub {
+    owner = "gvansickle";
+    repo = "ucg";
+    rev = "cbb185e8adad6546b7e1c5e9ca59a81f98dca49f";
+    hash = "sha256-Osdyxp8DoEjcr2wQLCPqOQ2zQf/0JWYxaDpZB02ACWo=";
+  };
+
+  outputs = [ "out" "man" ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkg-config
+  ];
+
+  buildInputs = [
+    pcre
+  ];
+
+  passthru.tests = {
+    simple = callPackage ./tests/simple.nix {
+      ucg = finalAttrs.finalPackage;
+    };
+  };
+
+  meta =  {
+    homepage = "https://gvansickle.github.io/ucg/";
+    description = "Grep-like tool for searching large bodies of source code";
+    longDescription = ''
+      UniversalCodeGrep (ucg) is an extremely fast grep-like tool specialized
+      for searching large bodies of source code. It is intended to be largely
+      command-line compatible with Ack, to some extent with ag, and where
+      appropriate with grep. Search patterns are specified as PCRE regexes.
+    '';
+    license = lib.licenses.gpl3Plus;
+    mainProgram = "ucg";
+    maintainers = with lib.maintainers; [ AndersonTorres ];
+    platforms = lib.platforms.unix;
+    broken = stdenv.isAarch64 || stdenv.isDarwin;
+  };
+})
+# TODO: report upstream
diff --git a/pkgs/by-name/uc/ucg/tests/simple.nix b/pkgs/by-name/uc/ucg/tests/simple.nix
new file mode 100644
index 0000000000000..09910d0829da0
--- /dev/null
+++ b/pkgs/by-name/uc/ucg/tests/simple.nix
@@ -0,0 +1,26 @@
+{ lib
+, stdenv
+, ucg
+}:
+
+stdenv.mkDerivation {
+  pname = "ucg-test";
+  inherit (ucg) version;
+
+  nativeBuildInputs = [ ucg ];
+
+  dontInstall = true;
+
+  buildCommand = ''
+    testFile=$(mktemp /tmp/ucg-test.XXXX)
+    echo -ne 'Lorem ipsum dolor sit amet\n2.7182818284590' > $testFile
+    ucg 'dolor' $testFile || { rm $testFile; exit -1; }
+    ucg --ignore-case 'lorem' $testFile || { rm $testFile; exit -1; }
+    ucg --word-regexp '2718' $testFile && { rm $testFile; exit -1; }
+    ucg 'pisum' $testFile && { rm $testFile; exit -1; }
+    rm $testFile
+    touch $out
+  '';
+
+  meta.timeout = 10;
+}