Skip to content

Commit

Permalink
Merge pull request #19 from avsm/mirage2
Browse files Browse the repository at this point in the history
Changes for Mirage DNS support
  • Loading branch information
avsm committed Aug 28, 2014
2 parents 3c54b4f + 3fdc9f2 commit 3b66127
Show file tree
Hide file tree
Showing 38 changed files with 575 additions and 260 deletions.
17 changes: 13 additions & 4 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
OPAM_DEPENDS="lwt cstruct ipaddr re ounit cmdliner io-page sexplib"

case "$OCAML_VERSION,$OPAM_VERSION" in
3.12.1,1.0.0) ppa=avsm/ocaml312+opam10 ;;
3.12.1,1.1.0) ppa=avsm/ocaml312+opam11 ;;
Expand All @@ -15,14 +13,25 @@ sudo apt-get update -qq
sudo apt-get install -qq ocaml ocaml-native-compilers camlp4-extra opam

export OPAMYES=1
export OPAMVERBOSE=1
echo OCaml version
ocaml -version
echo OPAM versions
opam --version
opam --git-version

opam init
opam install ${OPAM_DEPENDS}
opam init git://github.com/ocaml/opam-repository >/dev/null 2>&1
opam pin dns .
opam install base64 # can remove with opam 1.2?
opam install dns

eval `opam config env`
make clean
make

opam install mirage crunch
git clone git://github.com/mirage/mirage-skeleton
cd mirage-skeleton
make dns-configure
make dns-depend
make dns-build
14 changes: 14 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
0.10.0 (2014-08-20):
* Add `Dns_resolver_mirage` module for making stub resolution requests
using the Mirage module types.
* `Dns.Resolvconf` parses `/etc/resolv.conf` entries using `Ipaddr.t`
instead of `string` values now.
* Adapt `Dns_resolver` and `Dns_resolver_unix` to use `Ipaddr.t` more.
* Improve `mldig` to use `Ipaddr` more and add more RR printing to
match the conventional `dig` tool behaviour.
* Expose `Dns.Packet.Not_implemented` exception rather than a pattern
match failure.
* Depend on external `Base64` package instead of bundling one inside
the `Dns` packed module.
* Add a local `opam` file for easier pinning.

0.9.1 (2014-07-29):
* Fix file descriptor leak in resolver (#15, #16) by expanding `commfn`
with a cleanup function.
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ PREFIX ?= /usr/local
NAME=dns

LWT ?= $(shell if ocamlfind query lwt.unix >/dev/null 2>&1; then echo --enable-lwt; fi)
MIRAGE ?= $(shell if ocamlfind query mirage-net >/dev/null 2>&1; then echo --enable-mirage; fi)
ifneq ($(MIRAGE_OS),xen)
MIRAGE ?= $(shell if ocamlfind query mirage >/dev/null 2>&1; then echo --enable-mirage; fi)
TESTS ?= --enable-tests
endif

-include Makefile.config

Expand Down
29 changes: 22 additions & 7 deletions _oasis
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OASISFormat: 0.3
OCamlVersion: >= 4.00.0
Name: dns
Version: 0.9.1
Version: 0.10.0
Authors: Anil Madhavapeddy, Tim Deegan, Richard Mortier, Haris Rotsos, David Sheets, Thomas Gazagnaire
Maintainers: Anil Madhavapeddy <[email protected]>
License: ISC
Expand All @@ -21,15 +21,19 @@ Flag nettests
Description: run the internet-using tests
Default: false

Flag mirage
Description: build the Mirage library
Default: false

Library dns
Path: lib
Findlibname: dns
Pack: true
Modules:
Base64, Hashcons, Loader, Name, Operators, Packet, Query, RR, Trie,
Hashcons, Loader, Name, Operators, Packet, Query, RR, Trie,
Zone, Zone_lexer, Zone_parser, Resolvconf, Buf, Protocol
BuildDepends: cstruct (>= 0.7.1), cstruct.syntax, re, re.str, ipaddr (>= 2.2.0), io-page
XMetaRequires: cstruct, re, re.str, ipaddr, io-page
BuildDepends: cstruct (>= 0.7.1), cstruct.syntax, re, re.str, ipaddr (>= 2.2.0), io-page, base64
XMetaRequires: cstruct, re, re.str, ipaddr, io-page, base64

Library "dns-lwt"
Path: lwt
Expand All @@ -41,13 +45,24 @@ Library "dns-lwt"
XMetaRequires: lwt.unix, cstruct.lwt, dns, dns.lwt-core, ipaddr.unix, io-page.unix
FindlibParent: dns

Library "dns-lwt-mirage"
Path: mirage
Build$: flag(mirage)
Install$: flag(mirage)
Findlibname: mirage
Modules: Dns_resolver_mirage
BuildDepends: cstruct, lwt.syntax, dns, dns.lwt-core, tcpip
XMetaRequires: cstruct, dns, dns.lwt-core, tcpip
FindlibParent: dns

Library "dns-lwt-core"
Path: lwt
Build$: flag(lwt)
Install$: flag(lwt)
Findlibname: lwt-core
Modules: Dns_server, Dns_resolver
BuildDepends: lwt, cstruct, lwt.syntax, dns
XMetaRequires: lwt, cstruct, dns
FindlibParent: dns

Document dns
Expand All @@ -68,7 +83,7 @@ Document dns_lwt
XOCamlbuildModules: Dns_resolver, Dns_server

Executable lwt_server
Path: lib_test
Path: lib_test/unix
MainIs: lwt_server.ml
Build$: flag(tests) && flag(lwt)
Custom: true
Expand All @@ -77,7 +92,7 @@ Executable lwt_server
BuildDepends: lwt, lwt.unix, re, re.str, dns, dns.lwt

Executable time_server
Path: lib_test
Path: lib_test/unix
MainIs: time_server.ml
Build$: flag(tests) && flag(lwt)
Custom: true
Expand All @@ -97,4 +112,4 @@ Executable mldig
Test lwt_server
Run$: flag(tests) && flag(lwt)
Command: $lwt_server
WorkingDirectory: lib_test
WorkingDirectory: lib_test/unix
117 changes: 68 additions & 49 deletions _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: 78990316922073e9f73a863c21eff3b9)
# DO NOT EDIT (digest: 1fef36b7982b7347691d423e55c4d237)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
Expand All @@ -15,7 +15,6 @@
"_darcs": not_hygienic
# Library dns
"lib/dns.cmxs": use_dns
"lib/base64.cmx": for-pack(Dns)
"lib/hashcons.cmx": for-pack(Dns)
"lib/loader.cmx": for-pack(Dns)
"lib/name.cmx": for-pack(Dns)
Expand All @@ -30,6 +29,7 @@
"lib/resolvconf.cmx": for-pack(Dns)
"lib/buf.cmx": for-pack(Dns)
"lib/protocol.cmx": for-pack(Dns)
<lib/*.ml{,i}>: package(base64)
<lib/*.ml{,i}>: package(cstruct)
<lib/*.ml{,i}>: package(cstruct.syntax)
<lib/*.ml{,i}>: package(io-page)
Expand All @@ -38,58 +38,76 @@
<lib/*.ml{,i}>: package(re.str)
# Library dns-lwt-core
"lwt/dns-lwt-core.cmxs": use_dns-lwt-core
# Library dns-lwt-mirage
"mirage/dns-lwt-mirage.cmxs": use_dns-lwt-mirage
<mirage/*.ml{,i}>: package(base64)
<mirage/*.ml{,i}>: package(cstruct)
<mirage/*.ml{,i}>: package(cstruct.syntax)
<mirage/*.ml{,i}>: package(io-page)
<mirage/*.ml{,i}>: package(ipaddr)
<mirage/*.ml{,i}>: package(lwt)
<mirage/*.ml{,i}>: package(lwt.syntax)
<mirage/*.ml{,i}>: package(re)
<mirage/*.ml{,i}>: package(re.str)
<mirage/*.ml{,i}>: package(tcpip)
<mirage/*.ml{,i}>: use_dns
<mirage/*.ml{,i}>: use_dns-lwt-core
# Library dns-lwt
"lwt/dns-lwt.cmxs": use_dns-lwt
# Executable lwt_server
<lib_test/lwt_server.{native,byte}>: package(cstruct)
<lib_test/lwt_server.{native,byte}>: package(cstruct.lwt)
<lib_test/lwt_server.{native,byte}>: package(cstruct.syntax)
<lib_test/lwt_server.{native,byte}>: package(io-page)
<lib_test/lwt_server.{native,byte}>: package(io-page.unix)
<lib_test/lwt_server.{native,byte}>: package(ipaddr)
<lib_test/lwt_server.{native,byte}>: package(ipaddr.unix)
<lib_test/lwt_server.{native,byte}>: package(lwt)
<lib_test/lwt_server.{native,byte}>: package(lwt.syntax)
<lib_test/lwt_server.{native,byte}>: package(lwt.unix)
<lib_test/lwt_server.{native,byte}>: package(re)
<lib_test/lwt_server.{native,byte}>: package(re.str)
<lib_test/lwt_server.{native,byte}>: use_dns
<lib_test/lwt_server.{native,byte}>: use_dns-lwt
<lib_test/lwt_server.{native,byte}>: use_dns-lwt-core
<lib_test/lwt_server.{native,byte}>: custom
<lib_test/unix/lwt_server.{native,byte}>: package(base64)
<lib_test/unix/lwt_server.{native,byte}>: package(cstruct)
<lib_test/unix/lwt_server.{native,byte}>: package(cstruct.lwt)
<lib_test/unix/lwt_server.{native,byte}>: package(cstruct.syntax)
<lib_test/unix/lwt_server.{native,byte}>: package(io-page)
<lib_test/unix/lwt_server.{native,byte}>: package(io-page.unix)
<lib_test/unix/lwt_server.{native,byte}>: package(ipaddr)
<lib_test/unix/lwt_server.{native,byte}>: package(ipaddr.unix)
<lib_test/unix/lwt_server.{native,byte}>: package(lwt)
<lib_test/unix/lwt_server.{native,byte}>: package(lwt.syntax)
<lib_test/unix/lwt_server.{native,byte}>: package(lwt.unix)
<lib_test/unix/lwt_server.{native,byte}>: package(re)
<lib_test/unix/lwt_server.{native,byte}>: package(re.str)
<lib_test/unix/lwt_server.{native,byte}>: use_dns
<lib_test/unix/lwt_server.{native,byte}>: use_dns-lwt
<lib_test/unix/lwt_server.{native,byte}>: use_dns-lwt-core
<lib_test/unix/lwt_server.{native,byte}>: custom
# Executable time_server
<lib_test/time_server.{native,byte}>: package(cstruct)
<lib_test/time_server.{native,byte}>: package(cstruct.lwt)
<lib_test/time_server.{native,byte}>: package(cstruct.syntax)
<lib_test/time_server.{native,byte}>: package(io-page)
<lib_test/time_server.{native,byte}>: package(io-page.unix)
<lib_test/time_server.{native,byte}>: package(ipaddr)
<lib_test/time_server.{native,byte}>: package(ipaddr.unix)
<lib_test/time_server.{native,byte}>: package(lwt)
<lib_test/time_server.{native,byte}>: package(lwt.syntax)
<lib_test/time_server.{native,byte}>: package(lwt.unix)
<lib_test/time_server.{native,byte}>: package(re)
<lib_test/time_server.{native,byte}>: package(re.str)
<lib_test/time_server.{native,byte}>: use_dns
<lib_test/time_server.{native,byte}>: use_dns-lwt
<lib_test/time_server.{native,byte}>: use_dns-lwt-core
<lib_test/*.ml{,i}>: package(cstruct)
<lib_test/*.ml{,i}>: package(cstruct.lwt)
<lib_test/*.ml{,i}>: package(cstruct.syntax)
<lib_test/*.ml{,i}>: package(io-page)
<lib_test/*.ml{,i}>: package(io-page.unix)
<lib_test/*.ml{,i}>: package(ipaddr)
<lib_test/*.ml{,i}>: package(ipaddr.unix)
<lib_test/*.ml{,i}>: package(lwt)
<lib_test/*.ml{,i}>: package(lwt.syntax)
<lib_test/*.ml{,i}>: package(lwt.unix)
<lib_test/*.ml{,i}>: package(re)
<lib_test/*.ml{,i}>: package(re.str)
<lib_test/*.ml{,i}>: use_dns
<lib_test/*.ml{,i}>: use_dns-lwt
<lib_test/*.ml{,i}>: use_dns-lwt-core
<lib_test/time_server.{native,byte}>: custom
<lib_test/unix/time_server.{native,byte}>: package(base64)
<lib_test/unix/time_server.{native,byte}>: package(cstruct)
<lib_test/unix/time_server.{native,byte}>: package(cstruct.lwt)
<lib_test/unix/time_server.{native,byte}>: package(cstruct.syntax)
<lib_test/unix/time_server.{native,byte}>: package(io-page)
<lib_test/unix/time_server.{native,byte}>: package(io-page.unix)
<lib_test/unix/time_server.{native,byte}>: package(ipaddr)
<lib_test/unix/time_server.{native,byte}>: package(ipaddr.unix)
<lib_test/unix/time_server.{native,byte}>: package(lwt)
<lib_test/unix/time_server.{native,byte}>: package(lwt.syntax)
<lib_test/unix/time_server.{native,byte}>: package(lwt.unix)
<lib_test/unix/time_server.{native,byte}>: package(re)
<lib_test/unix/time_server.{native,byte}>: package(re.str)
<lib_test/unix/time_server.{native,byte}>: use_dns
<lib_test/unix/time_server.{native,byte}>: use_dns-lwt
<lib_test/unix/time_server.{native,byte}>: use_dns-lwt-core
<lib_test/unix/*.ml{,i}>: package(base64)
<lib_test/unix/*.ml{,i}>: package(cstruct)
<lib_test/unix/*.ml{,i}>: package(cstruct.lwt)
<lib_test/unix/*.ml{,i}>: package(cstruct.syntax)
<lib_test/unix/*.ml{,i}>: package(io-page)
<lib_test/unix/*.ml{,i}>: package(io-page.unix)
<lib_test/unix/*.ml{,i}>: package(ipaddr)
<lib_test/unix/*.ml{,i}>: package(ipaddr.unix)
<lib_test/unix/*.ml{,i}>: package(lwt)
<lib_test/unix/*.ml{,i}>: package(lwt.syntax)
<lib_test/unix/*.ml{,i}>: package(lwt.unix)
<lib_test/unix/*.ml{,i}>: package(re)
<lib_test/unix/*.ml{,i}>: package(re.str)
<lib_test/unix/*.ml{,i}>: use_dns
<lib_test/unix/*.ml{,i}>: use_dns-lwt
<lib_test/unix/*.ml{,i}>: use_dns-lwt-core
<lib_test/unix/time_server.{native,byte}>: custom
# Executable mldig
<lwt/mldig.{native,byte}>: package(base64)
<lwt/mldig.{native,byte}>: package(cmdliner)
<lwt/mldig.{native,byte}>: package(cstruct)
<lwt/mldig.{native,byte}>: package(cstruct.lwt)
Expand All @@ -106,6 +124,7 @@
<lwt/mldig.{native,byte}>: use_dns
<lwt/mldig.{native,byte}>: use_dns-lwt
<lwt/mldig.{native,byte}>: use_dns-lwt-core
<lwt/*.ml{,i}>: package(base64)
<lwt/*.ml{,i}>: package(cmdliner)
<lwt/*.ml{,i}>: package(cstruct)
<lwt/*.ml{,i}>: package(cstruct.lwt)
Expand Down
23 changes: 17 additions & 6 deletions lib/META
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# OASIS_START
# DO NOT EDIT (digest: c262d26c5dc803b940e7a415fd29bdcd)
version = "0.9.1"
# DO NOT EDIT (digest: 08bd769e2c3d4771dc74405b93faba62)
version = "0.10.0"
description = "DNS client and server implementation"
requires = "cstruct re re.str ipaddr io-page"
requires = "cstruct re re.str ipaddr io-page base64"
archive(byte) = "dns.cma"
archive(byte, plugin) = "dns.cma"
archive(native) = "dns.cmxa"
archive(native, plugin) = "dns.cmxs"
exists_if = "dns.cma"
package "mirage" (
version = "0.10.0"
description = "DNS client and server implementation"
requires = "cstruct dns dns.lwt-core tcpip"
archive(byte) = "dns-lwt-mirage.cma"
archive(byte, plugin) = "dns-lwt-mirage.cma"
archive(native) = "dns-lwt-mirage.cmxa"
archive(native, plugin) = "dns-lwt-mirage.cmxs"
exists_if = "dns-lwt-mirage.cma"
)

package "lwt-core" (
version = "0.9.1"
version = "0.10.0"
description = "DNS client and server implementation"
requires = "lwt cstruct lwt.syntax dns"
requires = "lwt cstruct dns"
archive(byte) = "dns-lwt-core.cma"
archive(byte, plugin) = "dns-lwt-core.cma"
archive(native) = "dns-lwt-core.cmxa"
Expand All @@ -20,7 +31,7 @@ package "lwt-core" (
)

package "lwt" (
version = "0.9.1"
version = "0.10.0"
description = "DNS client and server implementation"
requires = "lwt.unix cstruct.lwt dns dns.lwt-core ipaddr.unix io-page.unix"
archive(byte) = "dns-lwt.cma"
Expand Down
Loading

0 comments on commit 3b66127

Please sign in to comment.