about summary refs log tree commit diff
path: root/perl/lib/Nix/Store.xs
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-11-29T13·01+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-11-29T13·01+0000
commit1749a7b0ae943f6a208ffc3fd0f6e9506872c5b6 (patch)
tree51174f8a6f4113466f09d305d42a51ada0876f44 /perl/lib/Nix/Store.xs
parentb1eb8f4249dbf666afa046c45e903566e9eb2df9 (diff)
* download-using-manifests: use the Perl bindings.
Diffstat (limited to 'perl/lib/Nix/Store.xs')
-rw-r--r--perl/lib/Nix/Store.xs11
1 files changed, 11 insertions, 0 deletions
diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs
index aac7761cbd80..5256d1372fe2 100644
--- a/perl/lib/Nix/Store.xs
+++ b/perl/lib/Nix/Store.xs
@@ -159,3 +159,14 @@ void exportPaths(int fd, int sign, ...)
         } catch (Error & e) {
             croak(e.what());
         }
+
+
+SV * hashPath(char * algo, int base32, char * path)
+    PPCODE:
+        try {
+            Hash h = hashPath(parseHashType(algo), path).first;
+            string s = base32 ? printHash32(h) : printHash(h);
+            XPUSHs(sv_2mortal(newSVpv(s.c_str(), 0)));
+        } catch (Error & e) {
+            croak(e.what());
+        }