package opam-query

  1. Overview
  2. Docs
A tool to query opam files from shell scripts

Install

Dune Dependency

Authors

Maintainers

Sources

v1.3.tar.gz
sha256=3582fdebbc65e7262a44689156672f52b9e213c1d6f26b632152f781912e5a0d
md5=3b0ce3651024dd85a21cdf281c51f5ac

Description

opam-query is a tool that allows querying the OPAM package description files from shell scripts, similar to oasis query.

Published: 23 Jun 2017

README

opam-query

opam-query is a tool that allows querying the OPAM package description files from shell scripts, similar to oasis query.

Installation

opam-query can be installed via OPAM:

$ opam install opam-query

Usage

opam-query reads the OPAM package description from the provided filename (opam from the current directory by default) and prints the requested fields, one per line.

  • --name, --version and --dev-repo print the value of the correponding field.

  • --maintainer, --author, --homepage, --bug-report and --license print the values of the correponding field, concatenated by , .

  • --tags prints the values of the tags: field, concatenated by .

  • --name-version prints the values of name: and version:, concatenated by ..

  • --archive will attempt to determine a public download URL based on the value of dev-repo: and version: fields. Currently, only GitHub is supported. --tag-format allows to customize the tag name; $(version) is replaced by the value of the verison: field.

Automating package releases

opam-query can be used together with opam-publish to automate the process of releasing OPAM packages. For example, if you have a Makefile and are using GitHub, the following snippet will require nothing more than modifying the version: field and running make release.

VERSION      := $$(opam query --version)
NAME_VERSION := $$(opam query --name-version)
ARCHIVE      := $$(opam query --archive)

release:
  git tag -a v$(VERSION) -m "Version $(VERSION)."
  git push origin v$(VERSION)
  opam publish prepare $(NAME_VERSION) $(ARCHIVE)
  opam publish submit $(NAME_VERSION)
  rm -rf $(NAME_VERSION)

.PHONY: release

License

opam-query is distributed under the terms of MIT license.

Dependencies (9)

  1. uri
  2. containers >= "1.0" & < "2.0"
  3. cmdliner
  4. opam-lib >= "1.3"
  5. cppo_ocamlbuild build
  6. cppo build
  7. ocamlfind build
  8. ocamlbuild build
  9. ocaml >= "4.01"

Dev Dependencies (1)

  1. ounit with-test

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.