Git Product home page Git Product logo

opam-bundle's Introduction

opam-bundle(1)                Opam-bundle Manual                opam-bundle(1)

NAME
       opam-bundle - Creates standalone source bundle from opam packages

SYNOPSIS
       opam-bundle [OPTION]... PACKAGE...

DESCRIPTION
       This utility can extract a set of packages from opam repositories, and
       bundle them together in a comprehensive source archive, with the
       scripts needed to bootstrap OCaml, opam, and install the packages on a
       fresh, network-less system.

       The opam-depext plugin is included to try and get the required system
       dependencies on the target system (which might, in this case, require
       network, depending on the system configuration).

       The generated bundle includes three scripts, each one calling the
       previous ones if necessary:

       bootstrap.sh
           Compiles OCaml and opam and gets them ready in a local prefix

       configure.sh
           Initialises an opam root within the bundle directory, and gets the
           required system depdendencies

       compile.sh
           Compiles the required packages using the bootstrapped opam. If a
           prefix was specified, and for packages listed on the command-line
           of opam-bundle, wrappers are installed to the prefix for installed
           binaries. These execute the programs within the in-bundle opam
           root, with the proper opam environment.

       For example, assuming foo is a package that installs a bar binary, from
       a bundle generated using opam-bundle foo, a user on a fresh system
       could run tar xzf foo-bundle.tar.gz && ./foo-bundle/compile.sh ~/local
       to get a usable bar binary within ~/local/bin (if the user does not
       have write permission to the given prefix, the script will use sudo).

       Note that the extracted bundle itself should not be moved for the
       wrappers to keep working. Besides the wrappers, nothing is written
       outside of the directory where the bundle was untarred.

ARGUMENTS
       PACKAGE (required)
           List of packages to include in the bundle. Their dependencies will
           be included as well, but only listed packages will have wrappers
           installed. Packages can be specified as NAME[CONSTRAINT][@URL],
           where CONSTRAINT is an optional version constraint starting with
           one of . or =, !=, >, >=, < or <=, and @URL can be specified to use
           the package source from the given URL (in which case, the
           constraint, if any, must be . or =).

OPTIONS
       -d, --with-doc
           Include the packages' doc-only dependencies in the bundle, and make
           the bundle generate their documentation.

       --debug
           Display debug information about what's going on.

       --environment[=VAL] (default=)
           Use the given opam environment, in the form of a list of
           comma-separated 'var=value' bindings, when resolving variables.
           This is used when computing the set of available packages, where
           opam uses variables arch, os, os-distribution, os-version and
           os-family: if undefined, the variables are inferred from the
           current system. If set without argument, an empty environment is
           used: this can be used to ensure the generated bundle won't have
           arch or OS constraints.

       --help[=FMT] (default=auto)
           Show this help in format FMT. The value FMT must be one of `auto',
           `pager', `groff' or `plain'. With `auto', the format is `pager` or
           `plain' whenever the TERM env var is `dumb' or undefined.

       -o VAL, --output=VAL
           Output the bundle to the given file.

       --ocaml=VAL
           Select a version of OCaml to include. It will be used for
           bootstrapping, and must be able to compile opam.

       --opam=VAL
           Select a version of opam to include. That version must be released
           with an upstream "full-archive" available online, and be at least
           2.0.0~rc2, to support all the required features.

       --repository=URL
           URLs of the repositories to use (highest priority first). Note that
           it is required that the OCaml package at the selected version is
           included (see --ocaml), with the hierarchy and alternatives as on
           the default repository ('ocaml-base-compiler', 'ocaml-system' and
           'ocaml-config' packages, with the 'ocaml' wrapper virtual package).
           This makes it possible to bootstrap opam and compile the requested
           packages with a single compilation of OCaml.

       --self
           Generate a self-extracting script besides the .tar.gz bundle

       -t, --with-test
           Include the packages' test-only dependencies in the bundle, and
           make the bundle run the tests on installation.

       -y, --yes
           Confirm all prompts without asking.

Opam-bundle                                                     opam-bundle(1)

opam-bundle's People

Contributors

altgr avatar hernoufm avatar rjbou avatar unixjunkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

opam-bundle's Issues

Redistributing bundles

Hi,
thanks for sharing opam-bundle, it is very helpful!
I have a stupid question: suppose I have opam-bundled my software, and all the dependencies come from the default opam repository. Am I always allowed to re-distribute the bundles? Or should I inspect the licenses of all the dependencies to figure this out?

heavy tests

for example, by trying to bundle all packages available in opam.
This can be done by a script.

Failure in boostrap with 4.07.1

I'm trying to use opam-bundle to create an Opam based on OCaml 4.07.1. However, the bootstrapping phase is failing. Indeed, Extlib 1.7.4 is being pulled as a bootstrap dependency, and this version is incompatible with OCaml 4.07.1: Extlib 1.7.5 is required instead. I have not been able to understand where this (bootstrap) dependency is selected, so any help would be appreciated.

'opam-bundle pkg1 pkg2' installed only exe from pkg2

Hello,

I wanted to create a bundle that installs pkg2's executable plus all executables from pkg1
but that installed only the exe for pkg2.
I can do separate bundles, but I thought from the manpage that opam-bundle could
handle that case if I list packages explicitely on the command line.

Am I doing something wrong?

Thanks,
F.

cmdliner >= 1.0.0 should be required

I just tried to run "opam install opam-bundle" and got a compilation error that I tracked to the fact that for some reason opam chose to install cmdliner 0.9.8 while opam-bundle requires at least 1.0,0. (Not sure why 0.9.8 was picked and not something newer - this is a fresh opam install).

What is the ocaml version supported by opam-bundle 0.4 ?

Hello,

Which opam and ocaml version is supposed to work seamlessly with the released version
of opam-bundle (0.4 in opam-repository)?

I would like to create a self-installer for some released software using opam-bundle...

Thanks,
F.

ocaml-base-compiler = 4.06.1 is in conflict with ocaml-bootstrap

Hello,

I am very interested in opam-bundle, to ship software to non ocaml users.
I tried to bundle a very simple software of mine: get_line, available in opam.

Is there a specific version of the OCaml compiler I should be using?

Here is how my trial went:

# opam switch
#  switch  compiler                    description
→  4.06.1  ocaml-base-compiler.4.06.1  4.06.1
# opam --version
2.0.0
# opam info opam-bundle

<><> opam-bundle: information on all versions <><><><><><><><><><><><><><><><><>
name                   opam-bundle
all-installed-versions 0.3 [4.06.1]
[...]
# opam-bundle get_line
No OCaml version selected, will use 4.06.1.
No environment specified, will use the following for package resolution (based
on the host system):
  - arch = "x86_64"
  - os = "linux"
  - os-distribution = "ubuntu"
  - os-version = "18.04"
  - os-family = "debian"

<><> Initialising repositories ><><><><><><><><><><><><><><><><><><><><><><><><>
[opam.ocaml.org] Initialised

<><> Resolving package set ><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] No solution for get_line & ocaml-bootstrap.4.06.1: The following
        dependencies couldn't be met:
          - ocaml-bootstrap → ocaml → ocaml-config → ocaml-base-compiler →
        ocaml !=
            4.06.1
              no matching version
        Your request can't be satisfied:
          - ocaml-base-compiler = 4.06.1 is in conflict with ocaml-bootstrap

opam 2.0.0~beta4 / glpk dependency ?

The project has been ported to the newer opam 2.0.0~beta4 libraries; however, we still use beta3 within the bundle by default.

beta4 is much more reliable with its built-in solver, but comes with more dependencies, namely, the glpk libraries (libglpk-dev on Debian). At the moment you can generate the bundle with --opam=2.0.0~beta4, but that will induce an unchecked requirement on glpk on the target system.

We could at least add a check, or may try and include glpk within the bundle.

Using system OCaml

I'd like to use opam-bundle to distribute some command line tools to non OCaml users. It works quite well for that purpose, but I consider it wasteful to bundle and compile the OCaml compiler. Could an option be added to assume the target system has a working and compatible OCaml version installed? I think this is reasonable to expect from users, since OCaml can be installed from the package manager on most distributions.

By the way, very nice piece of software. I tested it on gdbprofiler and it immediately worked out of the box. This will be super-useful to distribute OCaml programs to non OCaml users.

--deps-only

I'd like to bundle all of the dependencies of my local opam file, without actually including that package, to generate a bundle that can be cached by CI and used to test the local package.

so, something like opam-bundle --deps-only foo@file:///.../foo.opam bar@file:///.../bar.opam

the --deps-only name parallels the opam install --deps-only flag.

Bundle doesn't work

Hi,
I ran the following commands:

opam switch create 4.11.1
opam bundle ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving getopt

It produced a tar.gz. Then, I went on a fresh machine, untarred the file and ran ./configure,
but it failed:

[bootstrap.log.gz](https://github.com/AltGr/opam-bundle/files/5981737/bootstrap.log.gz)
[bootstrap.log.gz](https://github.com/AltGr/opam-bundle/files/5981732/bootstrap.log.gz)
ndle/bootstrap/bin/ocamldep.opt' -modules src/usexp/usexp.ml src/usexp/parser_automaton_internal.ml src/usexp/sexp_ast.ml src/usexp/table.ml > boot-depends.txt
'/home/test/ocamlbuild-bundle/bootstrap/bin/ocamldep.opt' -modules src/xdg/xdg.ml > boot-depends.txt
'/home/test/ocamlbuild-bundle/bootstrap/bin/ocamlc.opt' -g -w -40 -o boot.exe unix.cma boot.ml
File "src/stdune/caml/result.ml", line 4, characters 7-17:
Alert deprecated: module Stdlib.Pervasives
Use Stdlib instead.

If you need to stay compatible with OCaml < 4.07, you can use the
stdlib-shims library: https://github.com/ocaml/stdlib-shims
File "src/stdune/caml/result.mli", line 6, characters 7-17:
Alert deprecated: module Stdlib.Pervasives
Use Stdlib instead.

If you need to stay compatible with OCaml < 4.07, you can use the
stdlib-shims library: https://github.com/ocaml/stdlib-shims
File "src/stdune/list.ml", line 3, characters 0-18:
Error: Multiple definition of the type name t.
       Names must be unique in a given structure or signature.
make: *** [Makefile:27: src_ext/jbuilder/_build/install/default/bin/jbuilder] Error 2

I attached the complete bootstrap.log file here:
https://gist.github.com/scemama/e57a581d04e4fb85601faba70ed3253a

Documentation?

Should there be documentation how to use this package?

'opam-bundle .' doesn't work

It would be nice if any valid opam package can be bundled.
Currently, only opam packages in the opam-repository are supported...

configure.sh fails not finding opam-depext

When trying to install a bundle, it fails with:

================ Configure: getting system dependencies        ================

You may be asked for 'sudo' access to install required system dependencies
through your package system

Fatal error: exception opam: "execvpe" failed on opam-depext: No such file or directory
Fatal error: exception opam: "execvpe" failed on opam-depext: No such file or directory

Something went wrong, see log in /tmp/ounit-bundle/configure.log

with nothing useful in the log. This is reproducible with the specific bundle; have not tried it with other bundles yet.

As far as I can tell, configure.sh script calls for "opam depext" which looks for opam-depext and fails to find it as only $DIR/bootstrap/bin was added to the path, while opam-depext is actually placed into/$DIR opam/default/bin. Not sure why opam does not know where to look.

doesn't work with an opam pinned package

I.e. a package that is not in the opam-repository.
This is annoying if people want to package some software which is not publicly available.
I think that if I am under some source tree, and there is a valid dot opam file, then I have
a valid opam package.

Checking version

It will be really great if opam-bundle would perform some checks about correctness of specified ocaml or opam version before bundle construction.

Cannot bundle anything for ocaml-4.12.0

# opam-bundle minicli
No OCaml version selected, will use 4.12.0.
No environment specified, will use the following for package resolution (based
on the host system):
  - arch = "x86_64"
  - os = "linux"
  - os-distribution = "ubuntu"
  - os-version = "20.04"
  - os-family = "debian"

<><> Initialising repositories ><><><><><><><><><><><><><><><><><><><><><><><><>
[opam.ocaml.org] Initialised

<><> Resolving package set ><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] No solution for minicli & ocaml-bootstrap.4.12.0: The following
        dependencies couldn't be met:
          - ocaml-bootstrap -> ocaml -> ocaml-config >= 2 ->
        ocaml-base-compiler >=
            4.12.0~ -> ocaml-beta
              unmet availability conditions: enable-ocaml-beta-repository
          - ocaml-bootstrap -> ocaml -> ocaml-config >= 2 ->
        ocaml-base-compiler >=
            4.12.0~ -> ocaml >= 4.13.0
              no matching version
        Your request can't be satisfied:
          - ocaml-bootstrap is in conflict with ocaml-base-compiler

minicli is just an example (pure ocaml code, not dependencies)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.