Thicket data repository for the EEG
1{ 2 "id": "https://anil.recoil.org/notes/grepping-every-known-ocaml-package-source", 3 "title": "Grepping the source of every OCaml package in OPAM", 4 "link": "https://anil.recoil.org/notes/grepping-every-known-ocaml-package-source", 5 "updated": "2013-04-08T00:00:00", 6 "published": "2013-04-08T00:00:00", 7 "summary": "<p>A regular question that comes up from OCaml developers is how to use\n<a href=\"http://opam.ocaml.org\">OPAM</a> as a hypothesis testing tool against the\nknown corpus of OCaml source code. In other words: can we quickly and\nsimply run <code>grep</code> over every source archive in OPAM? So that\u2019s the topic\nof today\u2019s 5 minute blog post:</p>\n<pre><code>git clone git://github.com/ocaml/opam-repository\ncd opam-repository\nopam-admin make\ncd archives\nfor i in *.tar.gz; \\\n do tar -zxOf $i | grep caml_stat_alloc_string; \\\ndone\n</code></pre>\n<p>In this particular example we\u2019re looking for instances of\n<code>caml_stat_alloc_string</code>, so just replace that with the regular\nexpression of your choice. The <code>opam-admin</code> tool repacks upstream\narchives into a straightforward tarball, so you don\u2019t need to worry\nabout all the different <a href=\"http://opam.ocaml.org/doc/Packaging.html#h1-CreatingOPAMpackages#Notes\">archival\nformats</a>\nthat OPAM supports (such as git or Darcs). It just adds an <code>archive</code>\ndirectory to a normal\n<a href=\"https://github.com/ocaml/opam-repository\">opam-repository</a> checkout, so\nyou can reuse an existing checkout if you have one already.</p>\n<pre><code>$ cd opam-repository/archives\n$ du -h\n669M .\n$ ls | wc -l\n2092\n</code></pre>", 8 "content": "<p>A regular question that comes up from OCaml developers is how to use\n<a href=\"http://opam.ocaml.org\">OPAM</a> as a hypothesis testing tool against the\nknown corpus of OCaml source code. In other words: can we quickly and\nsimply run <code>grep</code> over every source archive in OPAM? So that\u2019s the topic\nof today\u2019s 5 minute blog post:</p>\n<pre><code>git clone git://github.com/ocaml/opam-repository\ncd opam-repository\nopam-admin make\ncd archives\nfor i in *.tar.gz; \\\n do tar -zxOf $i | grep caml_stat_alloc_string; \\\ndone\n</code></pre>\n<p>In this particular example we\u2019re looking for instances of\n<code>caml_stat_alloc_string</code>, so just replace that with the regular\nexpression of your choice. The <code>opam-admin</code> tool repacks upstream\narchives into a straightforward tarball, so you don\u2019t need to worry\nabout all the different <a href=\"http://opam.ocaml.org/doc/Packaging.html#h1-CreatingOPAMpackages#Notes\">archival\nformats</a>\nthat OPAM supports (such as git or Darcs). It just adds an <code>archive</code>\ndirectory to a normal\n<a href=\"https://github.com/ocaml/opam-repository\">opam-repository</a> checkout, so\nyou can reuse an existing checkout if you have one already.</p>\n<pre><code>$ cd opam-repository/archives\n$ du -h\n669M .\n$ ls | wc -l\n2092\n</code></pre>", 9 "content_type": "html", 10 "author": { 11 "name": "Anil Madhavapeddy", 12 "email": "anil@recoil.org", 13 "uri": "https://anil.recoil.org" 14 }, 15 "categories": [], 16 "rights": "(c) 1998-2025 Anil Madhavapeddy, all rights reserved", 17 "source": "https://anil.recoil.org/news.xml" 18}