Skip to content

Commit f1e5f26

Browse files
committed
Merge pull request #42 from djs55/cmdliner
Use cmdliner for command-line parsing and manpage generation
2 parents ed2f3e8 + 90439ea commit f1e5f26

File tree

6 files changed

+49
-7
lines changed

6 files changed

+49
-7
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
*.swp
2-
2+
setup.bin
3+
networkd/version.ml
4+
xcp-networkd
5+
xcp-networkd.1
6+
*.native
7+
setup.data
8+
setup.log
39
dist/

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
0.9.5 (27-Sep-2014):
2+
* Add man page and standard command-line options
3+
* Use libnl to read stats from interfaces
4+
* CA-137227: Checking xen-backend in link of /sys/class/net/*/device/...
5+
* Don't let naughty dhcp servers trick us into setting default routes
6+
* Don't record RRDs for the "ovs-system" interface
7+
* CA-137591: Removing all the interfaces before bringing the bridge down
8+
* CA-140402: set max-idle to 5000ms on OVS
9+
110
0.9.4 (3-Jun-2014):
211
* Use oasis for building
312
* Update to new stdext interface

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
BINDIR ?= /usr/bin
22
SBINDIR ?= /usr/sbin
33
ETCDIR ?= /etc
4+
MANDIR ?= /usr/share/man/man1
45
all: build doc
56

67
.PHONY: test install uninstall clean
@@ -15,8 +16,13 @@ setup.bin: setup.ml
1516
setup.data: setup.bin
1617
@./setup.bin -configure --enable-tests
1718

18-
build: setup.data setup.bin
19+
build: setup.data setup.bin networkd/version.ml
1920
@./setup.bin -build -j $(J)
21+
mv networkd.native xcp-networkd
22+
./xcp-networkd --help=groff > xcp-networkd.1
23+
24+
networkd/version.ml: VERSION
25+
echo "let version = \"$(shell cat VERSION)\"" > networkd/version.ml
2026

2127
doc: setup.data setup.bin
2228
@./setup.bin -doc -j $(J)
@@ -25,13 +31,20 @@ test: setup.bin build
2531
@./setup.bin -test
2632

2733
install:
28-
install -D networkd.native $(DESTDIR)$(SBINDIR)/xcp-networkd
29-
install -D networkd_db.native $(DESTDIR)$(BINDIR)/networkd_db
34+
mkdir -p $(DESTDIR)$(SBINDIR)
35+
install xcp-networkd $(DESTDIR)$(SBINDIR)/xcp-networkd
36+
mkdir -p $(DESTDIR)$(MANDIR)
37+
install xcp-networkd.1 $(DESTDIR)$(MANDIR)/xcp-networkd.1
38+
mkdir -p $(DESTDIR)$(BINDIR)
39+
install networkd_db.native $(DESTDIR)$(BINDIR)/networkd_db
3040

3141
uninstall:
3242
rm -f $(DESTDIR)$(SBINDIR)/xcp-networkd
43+
rm -f $(DESTDIR)$(MANDIR)/xcp-networkd.1
3344
rm -f $(DESTDIR)$(SBINDIR)/networkd_db
3445

3546
clean:
3647
@ocamlbuild -clean
3748
@rm -f setup.data setup.log setup.bin
49+
rm networkd/version.ml
50+
rm xcp-networkd xcp-networkd.1

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.3
1+
0.9.5

_oasis

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OASISFormat: 0.3
22
Name: xcp-networkd
3-
Version: 0.9.4
3+
Version: 0.9.5
44
Synopsis: XCP Network Daemon
55
Authors: Rob Hoes
66
License: LGPL-2.1 with OCaml linking exception

networkd/networkd.ml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,22 @@ let handle_shutdown () =
6060
Sys.set_signal Sys.sigint (Sys.Signal_handle stop);
6161
Sys.set_signal Sys.sigpipe Sys.Signal_ignore
6262

63+
let doc = String.concat "\n" [
64+
"This is the xapi toolstack network management daemon.";
65+
"";
66+
"This service looks after host network configuration, including setting up bridges and/or openvswitch instances, configuring IP addresses etc.";
67+
]
68+
6369
let _ =
64-
Xcp_service.configure ~resources ();
70+
begin match Xcp_service.configure2
71+
~name:Sys.argv.(0)
72+
~version:Version.version
73+
~doc ~resources () with
74+
| `Ok () -> ()
75+
| `Error m ->
76+
Printf.fprintf stderr "%s\n" m;
77+
exit 1
78+
end;
6579

6680
let server = Xcp_service.make
6781
~path:!Network_interface.default_path

0 commit comments

Comments
 (0)