Skip to content

Commit

Permalink
Use unicode ellipsis, it's pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA committed Nov 7, 2022
1 parent fe61b76 commit 5b3c9b4
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ When performing a build, the user gives OBuilder a specification file (as descri
and a source directory, containing files which may be copied into the image using `copy`.

```sexp
((from BASE) OP...)
((from BASE) OP)
```

Example:
Expand Down Expand Up @@ -128,7 +128,7 @@ For example:
(run (shell "hello")))
```

At the moment, the `(build ...)` items must appear before the `(from ...)` line.
At the moment, the `(build )` items must appear before the `(from )` line.


### workdir
Expand All @@ -149,7 +149,7 @@ If the path given is relative, it is combined with the previous setting.
### shell

```sexp
(shell ARG...)
(shell ARG)
```

Example:
Expand All @@ -165,9 +165,9 @@ The command run will be this list of arguments followed by the single argument `

```sexp
(run
(cache CACHE...)?
(network NETWORK...)?
(secrets SECRET...)?
(cache CACHE)?
(network NETWORK)?
(secrets SECRET)?
(shell COMMAND))
```
Expand All @@ -188,7 +188,7 @@ Examples:

Runs the single argument `COMMAND` using the values in the current context (set by `workdir` and `shell`).

The `(cache CACHE...)` field can be used to mount one or more persistent caches for the command.
The `(cache CACHE)` field can be used to mount one or more persistent caches for the command.
Each `CACHE` takes the form `(NAME (target PATH))`, where `NAME` uniquely identifies the cache to use
and `PATH` is the mount point within the container.

Expand All @@ -198,14 +198,14 @@ A mutable copy of the cache is created for the command. When the command finishe
this copy becomes the new version of the cache, unless some other command updated the same cache first, in
which case this one is discarded.

The `(network NETWORK...)` field specifies which network(s) the container will be connected to.
The `(network NETWORK)` field specifies which network(s) the container will be connected to.
`(network host)` is a special value which runs the container in the host's network namespace.
Otherwise, a fresh network namespace is created for the container, with interfaces for the given
networks (if any).

Currently, no other networks can be used, so the only options are `host` or an isolated private network.

The `(secrets SECRET...)` field can be used to request values for chosen keys, mounted as read-only files in
The `(secrets SECRET)` field can be used to request values for chosen keys, mounted as read-only files in
the image. Each `SECRET` entry is under the form `(ID (target PATH))`, where `ID` selects the secret, and
`PATH` is the location of the mounted secret file within the container.
The sandbox context API contains a `secrets` parameter to provide values to the runtime.
Expand All @@ -219,10 +219,10 @@ When used with Docker, make sure to use the **buildkit** syntax, as only buildki

```sexp
(copy
(from ...)?
(src SRC...)
(from )?
(src SRC)
(dst DST)
(exclude EXCL...)?)
(exclude EXCL)?)
```

Examples:
Expand Down Expand Up @@ -257,7 +257,7 @@ Otherwise, it is the source directory provided by the user.
Notes:

- Unlike Docker's `COPY` operation, OBuilder copies the files using the current
user and group IDs, as set with `(user ...)`.
user and group IDs, as set with `(user )`.

- Both `SRC` and `DST` use `/` as the directory separator on all platforms.

Expand Down Expand Up @@ -304,12 +304,12 @@ obuilder dockerfile -f example.spec > Dockerfile

The dockerfile should work the same way as the spec file, except for these limitations:

- In `(copy (excludes ...) ...)` the excludes part is ignored.
- In `(copy (excludes …) …)` the excludes part is ignored.
You will need to ensure you have a suitable `.dockerignore` file instead.

- If you want to include caches or to use secrets, use `--buildkit` to output in the extended BuildKit syntax.

- All `(network ...)` fields are ignored, as Docker does not allow per-step control of
- All `(network )` fields are ignored, as Docker does not allow per-step control of
networking.

## Experimental macOS Support
Expand Down
4 changes: 2 additions & 2 deletions lib/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ module Make (Raw_store : S.STORE) (Sandbox : S.SANDBOX) (Fetch : S.FETCHER) = st
log `Heading (Fmt.str "(from %a)" Sexplib.Sexp.pp_hum (Atom base));
let id = Sha256.to_hex (Sha256.string base) in
Store.build t.store ~id ~log (fun ~cancelled:_ ~log tmp ->
Log.info (fun f -> f "Base image not present; importing %S..." base);
Log.info (fun f -> f "Base image not present; importing %S" base);
let rootfs = tmp / "rootfs" in
Os.sudo ["mkdir"; "-m"; "755"; "--"; rootfs] >>= fun () ->
Fetch.fetch ~log ~rootfs base >>= fun env ->
Expand All @@ -245,7 +245,7 @@ module Make (Raw_store : S.STORE) (Sandbox : S.SANDBOX) (Fetch : S.FETCHER) = st
let rec aux context = function
| [] -> Lwt_result.return context
| (name, child_spec) :: child_builds ->
context.Context.log `Heading Fmt.(str "(build %S ...)" name);
context.Context.log `Heading Fmt.(str "(build %S )" name);
build ~scope t context child_spec >>!= fun child_result ->
context.Context.log `Note Fmt.(str "--> finished %S" name);
let context = Context.with_binding name child_result context in
Expand Down
4 changes: 2 additions & 2 deletions lib/macos.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let descendants ~pid =
let+ s = pread ["sudo"; "pgrep"; "-P"; string_of_int pid ] in
let pids = Astring.String.cuts ~sep:"\n" s in
List.filter_map int_of_string_opt pids)
(* Errors if there are none, probably errors for other reasons too... *)
(* Errors if there are none, probably errors for other reasons too *)
(fun _ -> Lwt.return [])

let kill ~pid =
Expand Down Expand Up @@ -69,7 +69,7 @@ let copy_template ~base ~local =
let change_home_directory_for ~user ~home_dir =
["dscl"; "."; "-create"; "/Users/" ^ user ; "NFSHomeDirectory"; home_dir ]

(* Used by the FUSE filesystem to indicate where a users home directory should be ...*)
(* Used by the FUSE filesystem to indicate where a users home directory should be *)
let update_scoreboard ~uid ~scoreboard ~home_dir =
["ln"; "-Fhs"; home_dir; scoreboard ^ "/" ^ string_of_int uid]

Expand Down
6 changes: 3 additions & 3 deletions lib/sandbox.macos.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type t = {
uid: int;
gid: int;
(* Where zfs dynamic libraries are -- can't be in /usr/local/lib
see notes in .mli file under "Various Gotchas"... *)
see notes in .mli file under "Various Gotchas" *)
fallback_library_path : string;
(* FUSE file system mount point *)
fuse_path : string;
Expand Down Expand Up @@ -80,7 +80,7 @@ let user_name ~prefix ~uid =
let home_directory user = Filename.concat "/Users/" user

(* A build step in macos:
- Should be properly sandboxed using sandbox-exec (coming soon...)
- Should be properly sandboxed using sandbox-exec (coming soon)
- Umask g+w to work across users if restored from a snapshot
- Set the new home directory of the user to something static and copy in the environment
- Should be executed by the underlying user (t.uid) *)
Expand Down Expand Up @@ -120,7 +120,7 @@ let run ~cancelled ?stdin:stdin ~log (t : t) config result_tmp =
if Lwt.is_sleeping proc then (
match !proc_id with
| Some pid -> Macos.kill_all_descendants ~pid
| None -> Log.warn (fun f -> f "Failed to find pid..."); Lwt.return ()
| None -> Log.warn (fun f -> f "Failed to find pid"); Lwt.return ()
)
else Lwt.return_unit (* Process has already finished *)
in
Expand Down
2 changes: 1 addition & 1 deletion lib_spec/docker.mli
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ val dockerfile_of_spec : buildkit:bool -> os:[`Unix | `Windows] -> Spec.t -> str
However, note that:
- In "(copy (excludes ...) ...)" the excludes part is ignored. You will need to ensure
- In "(copy (excludes …) …)" the excludes part is ignored. You will need to ensure
you have a suitable ".dockerignore" file.
- The conversion is not robust against malicious input, as the escaping rules are unclear.
Expand Down
6 changes: 3 additions & 3 deletions lib_spec/spec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type sexp = Sexplib.Sexp.t =
| Atom of string
| List of sexp list

(* Convert fields matched by [p] from (name v1 v2 ...) to (name (v1 v2 ...)) *)
(* Convert fields matched by [p] from (name v1 v2 ) to (name (v1 v2 )) *)
let inflate_record p =
let open Sexplib.Sexp in function
| Atom _ as x -> Fmt.failwith "Invalid record field: %a" Sexplib.Sexp.pp_hum x
Expand All @@ -17,7 +17,7 @@ let inflate_record p =
in
List (List.map expand xs)

(* Convert fields matched by [p] from (name (v1 v2 ...)) to (name v1 v2 ...) *)
(* Convert fields matched by [p] from (name (v1 v2 )) to (name v1 v2 ) *)
let deflate_record p =
let open Sexplib.Sexp in function
| Atom _ as x -> Fmt.failwith "Invalid record field: %a" Sexplib.Sexp.pp_hum x
Expand Down Expand Up @@ -111,7 +111,7 @@ type op = [

(* For some ops, we remove the extra () in the sexp string format,
formatting them as if they were in-line records. e.g.
(copy ((src ...) (dst ...))) becomes (copy (src ...) (dst ...)). *)
(copy ((src ) (dst ))) becomes (copy (src ) (dst )). *)
let inline = function
| "run" | "copy" | "user" | "env" -> true
| _ -> false
Expand Down
4 changes: 2 additions & 2 deletions stress.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
set -eu
if [ "$#" -lt 1 ]; then
echo "usage: $0 STORE..."
echo "usage: $0 STORE"
echo "e.g. $0 btrfs:/btrfs/stress zfs:stress"
exit 1;
fi;
stores="$*"
echo "Remove everything that depends on busybox..."
echo "Remove everything that depends on busybox"
for store in $stores; do
echo Clean $store
dune exec -- obuilder delete 9d75f0d7c398df565d7ac04c6819b62d6d8f9560f5eb4672596ecd8f7e96ae91 --store=$store
Expand Down
2 changes: 1 addition & 1 deletion stress/stress.ml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module Test(Store : S.STORE) = struct
let log id = Logs.info (fun f -> f "Deleting %S" id) in
let end_time = Unix.(gettimeofday () +. 60.0 |> gmtime) in
let rec aux () =
Fmt.pr "Pruning...@.";
Fmt.pr "Pruning@.";
Build.prune ~log builder ~before:end_time 1000 >>= function
| 0 -> Lwt.return_unit
| _ -> aux ()
Expand Down

0 comments on commit 5b3c9b4

Please sign in to comment.