ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.24k stars 355 forks source link

Reverse depend findlib → opam #573

Closed Chris00 closed 7 years ago

Chris00 commented 11 years ago

Is it possible to query opam to know to which [opam] package (if any) a findlib package belongs? Better still if the findlib package can come with a version boolean expression.

samoht commented 11 years ago

Unfortunately not at the moment ... I agree this could be useful though.

rdicosmo commented 11 years ago

The dose library contains the code to produce this information, which is known as "reverse dependency cone"; I am Cc:ing Pietro to see if he can propose a quick patch for adding it directly to opam.

In the meanwhile, you can always resort to using the ceve tool from the dose suite (Pietro: would you mind packaging ceve for opam? since it is part of dose, which is packaged, maybe it is a very straightforward task).

In any case, once you have ceve, you can produce a version of the opam repository in CUDF format by writing something like

opam upgrade --cudf=foo ocamlfind

and then

ceve -r "ocamlfind" -Tcudf -t cudf foo-1.cudf | grep package

will give you the 642 (transitive) reverse dependencies of ocamlfind that I am attaching here :-)

Hope this helps

Roberto

P.S.: ceve options follow

ceve --help usage: ceve [options]

options:

Ceve - integrated metadata parser and transformer

--version show program's version and exit -h, --help show this help message and exit -v, --verbose print additional information --progress print progress bars --timers print timing information --quiet do no print any messages --trim Consider only installable packages -c , --cone= dependency cone -r , --rcone= reverse dependency cone --depth=INT max depth - in conjunction with cone -G<syn|pkg|conj|strdeps|strcnf> Graph output type (with -T<dot|gml|grml>). Default syn -T<dot|gml|grml|cnf|dimacs|cudf|table> Output type format. Default cnf --request= Installation Request (can be repeated) -tSTR Set the input type format

Input Options:

-oSTR, --outfile=STR
                    Set the output file

Debian Specific Options:

--deb-native-arch=STR
                    Native architecture
--deb-host-arch=STR
                    Native/cross compile host architecture, defaults to
                    native architecture
--deb-foreign-archs= <strlst>
                    Foreign architectures in addition to native and host
                    architectures
--deb-ignore-essential
                    Ignore Essential Packages

On Wed, Apr 03, 2013 at 01:43:25PM -0700, Thomas Gazagnaire wrote:

Unfortunately not at the moment ... I agree this could be useful though.

— Reply to this email directly or view it on GitHub.*

Roberto Di Cosmo


Professeur En delegation a l'INRIA PPS E-mail: roberto@dicosmo.org Universite Paris Diderot WWW : http://www.dicosmo.org Case 7014 Tel : ++33-(0)1-57 27 92 20 5, Rue Thomas Mann
F-75205 Paris Cedex 13 Identica: http://identi.ca/rdicosmo

FRANCE. Twitter: http://twitter.com/rdicosmo

Attachments: MIME accepted, Word deprecated

http://www.gnu.org/philosophy/no-word-attachments.html

Office location:

Bureau 320 (3rd floor) Batiment Sophie Germain Avenue de France

Metro Bibliotheque Francois Mitterrand, ligne 14/RER C

GPG fingerprint 2931 20CE 3A5A 5390 98EC 8BFC FCCA C3BE 39CB 12D3 cryptokit-sha512 weberizer type%5fconv ocamldap ocamlnet litiom pa%5fmonad%5fcustom dypgen lacaml stog-writing cduce ulex ocsigenserver promela mirage shared-memory-ring bisect variantslib frama-c inspect sawja tiny%5fjson%5fconv monadlib pa%5founit chamo type%5fconv pgocaml async%5fcore samplerate extlib cohttp uunf yajl rpc ocaml-inifiles unison stog release lambda-term camlzip dyntype variantslib why3 bigbro xenstore fieldslib pipebang mlgmp pa%5founit lwt ocplib-endian sexplib cow eliom imagemagick pprint uri ocamlgsl async patdiff ocaml-mysql async stog mirage re core async%5funix ocaml%5fplugin webdav mirage-net ocamlgraph spotlib typerex ospec bolt fftw-ocaml ocp-build js%5fof%5focaml wget speex frei0r pcap portaudio shared-memory-ring react pipebang genet magic orakuda ocaml-http async%5fextra tiny%5fjson%5fconv fieldslib core msgpack dyntype utop bin%5fprot sequence jsonm opam-lib combine cstruct orm uint ocamlscript alt-ergo ocaml-mad syslog async%5fcore nlopt-ocaml patdiff ocp-indent safepass getopt ocaml-rdf plasma lwt comparelib spotlib mm alphaCaml tiny%5fjson cairo1 cohttp uri aifad github datalog flac zarith safepass tyxml ansicolor unison easy-format camlbz2 javalib tyxml sequence bjack typehashlib uri comparelib async%5funix dyntype core%5fextended ocaml-expat async cryptgps gapi-ocaml ocaml-radixtree async%5fextra cstruct csv forkwork mirage ocaml-lua macaque mirage typehashlib ocamlrss lastfm webdav patdiff pa%5founit ogg core%5fextended xmlplaylist yajl ocaml-xdg-basedir uuidm spotlib sequence planck rpc tiny%5fjson%5fconv github ocaml-sqlexpr typehashlib format lablgtk-extras ocurl weberizer crypt mascot pipebang pgocaml liquidsoap ocamlgraph type%5fconv async%5fcore core%5fextended caml2html release ssl core variantslib crunch opam-lib spotinstall gstreamer type%5fconv ocaml-glpk core%5fextended mlpost bin%5fprot async%5fextra patdiff dum fieldslib qtest variantslib hydro libsvm-ocaml xtmpl pipebang datalog github planck async%5funix cgi eliom js%5fof%5focaml core mpi faad mirage-net ocamlify type%5fconv xstrp4 core%5fextended bin%5fprot async aws sqlite3-ocaml uri cache comparelib variantslib ocaml-taglib xmlm ocaml-xml-rpc xenstore re dns js%5fof%5focaml release ocp-build sexplib yajl-extra sqlite3-ocaml sequence core%5fextended opass imagemagick json-wheel dns meta%5fconv comparelib glMLite root1d macaque fieldslib lame mirage-net async%5fcore ocurl bes github core%5fextended cil stog yojson atdgen cow parmap async%5fextra tiny%5fjson%5fconv taglib pa%5founit orm dns bitcoin menhir alberto camlzip chamo dbm core%5fextended crunch bench camlimages mirage bitcoin sqlite3-ocaml lwt sexplib ocaml-indent async%5funix core binary pa%5founit pcre-ocaml ancient xtmpl uri fieldslib weberizer core%5fextended obus github eliom uint ffmpeg cstruct dbforge pipebang async async ounit kaputt CamlGI taglib ocp-indent core ocaml-markdown bin%5fprot sequence schroedinger cow spf inotify mm async%5fextra uutf integration1d lacaml mirage-net uint cow mesh react async%5fcore bin%5fprot sexplib pa%5fdo dose orm oasis weberizer soundtouch stog typehashlib rpc comparelib baardskeerder xenstore cstruct sexplib cohttp xenbigarray camomile github async%5fextra datalog atdgen yajl-extra ocp-indent parmap cstruct dssi kaputt lzo typehashlib annexlib comparelib google-drive-ocamlfuse flow herelib quickcheck async%5funix gettext mirage-www pxp type%5fconv tryocaml xtmpl fieldslib meta%5fconv xstr typehashlib functory netamqp mirage missinglib lablgtk-extras cstruct lo weberizer pa%5founit ocamlfuse pomap sexplib eliom pa%5fdo type%5fconv cryptokit-sha512 mparser async%5fcore benchmark ocaml-expect yajl archimedes calendar github ladspa async tplib lwt cstruct yojson camlimages optimization1d pulseaudio atd variantslib ocamldiff uri mirari pipebang ocamltter cry pa%5founit google-drive-ocamlfuse dbforge type%5fconv async%5fcore dns async%5fextra ocp-indent sha bitstring config-file ocamlmod rtime herelib flow meta%5fconv passwdgen postgresql-ocaml ocaml-mysql core variantslib batteries fieldslib gtktop utop bisect ccss ocamldbi mirage-net gpr bin%5fprot imagemagick sonet ocaml-data-notation deriving-ocsigen duppy ocaml-zmq pcap sexplib variantslib duppy ocamltop-gtk cohttp pipebang async%5funix piqi cudf core cstruct dns bin%5fprot sequence comparelib aacplus json-static lwt alt-ergo google-drive-ocamlfuse fieldslib herelib weberizer dtools spotlib cryptokit async%5fcore yajl-extra uri async%5fextra mirage fileutils ocaml-text tiny%5fjson%5fconv meta%5fconv comparelib dns async dyntype benchmark cairo oasis-mirage async%5fcore estring sexplib batteries stog-rdf biniou ANSITerminal ocp-build ocplib-endian mirari opam-lib opass cow spf cstruct lwt-zmq async%5funix uucd pa%5founit liquidsoap cow gsl-ocaml melt omake-mode vorbis lacaml ocurl wdialog herelib simple%5fpam tiny%5fjson async%5funix camltemplate omake yajl ocsigenserver pa%5founit ocaml-posix-resource dose lablgtk cfg srs ocp-indent cohttp postgres async%5fextra ocamlviz typehashlib ocaml-data-notation stone spotinstall treeprint ocamlfind pipebang uri sexplib milter snappy ocaml-extunix async%5fcore mikmatch parmap ocp-indent rpc bin%5fprot alsa optcomp core stog-rdf pa%5fcomprehension sqlite3-ocaml typehashlib datalog opam-lib cmdliner tstp-proof-checker biocaml oasis-mirage typerex eliom mirage-fs async mesh res async ocamlsdl bin%5fprot opus gpr pgocaml FrontC meta%5fconv typehashlib dose orakuda lablgtk odepack zed pipebang async%5funix ao release ucorelib github ocaml-rdf type%5fconv re opam2web yajl-extra jsondiff stog-writing libvirt cstruct fieldslib gavl sexplib xmlm schoca comparelib variantslib simple%5fpam async%5fextra libsvm-ocaml oasis ocamltop-gtk spotinstall async%5funix ocamldot theora

samoht commented 11 years ago

@rdicosmo I guess the original question was: it it possible to know the name of the (ocamlfind) libraries defined in a given (OPAM) package ?

So it's more a metadata than a tool issue.

abate commented 11 years ago

so, you are basically asking to add a provide field where to list the ocamlfind libraries provided by an opam package ? I think there is a whish list about provides in the bts...

Chris00 commented 11 years ago

Yes, the list of findlib libraries installed by a package is not easily accessible — but this is what we care about in the build system (for example if you clone the repo of a project). There is indeed a "provide issue" https://github.com/OCamlPro/opam/issues/314 but it is about packages providing other packages, not the list of findlib modules.

Chris00 commented 11 years ago

I noticed that for example ocaml-arg.0.3.opam has a field libraries: ["arg"]. What does it mean?

samoht commented 11 years ago

This is because ocaml-arg have file/ocaml-arg.config which define how to use the arg library.

You can try:

$ opam install ocaml-arg
...
$ opam config includes ocaml-arg
-I /Users/tgazagna/.opam/why3/lib/ocaml-arg
$ opam config asmlink ocaml-arg
-I /Users/tgazagna/.opam/why3/lib/ocaml-arg arg.cmxa

So yes, you can use OPAM without ocamlfind and rely on this system instead. But I guess it is not what you were looking for.

Currently, if you have library which is filled, but no corresponding .config file (which is supposed to be generated by the build stage, btw), OPAM will complain.

Chris00 commented 11 years ago

Another interesting side-effect of having an explicit "findlib" field is that

$ opam search netclient
Available packages for 4.00.1:
webdav  --  Implements the client side of the WebDAV protocol (RFC 4918)

would/could also "succeed" — which means also returning ocamlnet in this case. (Granted, it is already possible right now by adding the Findlib libraries in descr or as tags but it is "cleaner".)

ygrek commented 11 years ago

Actually the majority of packages has the "ocamlfind remove" for the "remove" command so it is could be possible to hack some approximation of this mapping..

Chris00 commented 11 years ago

This is what I did after I posted this. It is working well enough but, if we can avoid approximations, better to do it.

ygrek commented 11 years ago

agreed, that would be a nice feature

avsm commented 11 years ago

I would just note that any approximations are actually a bug, since remove needs to ensure that all ocamlfind packages are removed, or risk a failure upon upgrade (which we don't fully automatically test at the moment).

-anil

On 9 Sep 2013, at 13:52, Christophe Troestler notifications@github.com wrote:

This is what I did after I posted this. It is working well enough but, if we can avoid approximations, better to do it.

— Reply to this email directly or view it on GitHub.

Chris00 commented 11 years ago

On Mon, 9 Sep 2013 06:01:29 -0700, Anil Madhavapeddy wrote:

I would just note that any approximations are actually a bug, since remove needs to ensure that all ocamlfind packages are removed, or risk a failure upon upgrade (which we don't fully automatically test at the moment).

Except that some packages do not provide META files and others do not use ocamlfind to (un)install the package.

dbuenzli commented 11 years ago

Le lundi, 9 septembre 2013 à 14:21, Christophe Troestler a écrit :

Except that some packages do not provide META files and others do not use ocamlfind to (un)install the package.

The later is the case in my new packaging scheme. Everything happens through the opam .install file (install+uninstall).

Daniel

Chris00 commented 9 years ago

At some point it was talked about a libraries field in OPAM. Now it rather seems that a findlib file will be used. Will the two coexist? May you shed some light on the roadmap for these kind of features?

dra27 commented 7 years ago

Related to #1434

AltGr commented 7 years ago

I believe you can now leverage file tracking for this:

opam list -s --owns-file $(ocamlfind query -format %m LIB)