package obuilder

  1. Overview
  2. Docs

Source file Static_files.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(* Generated by: ocaml-crunch
   Creation date: Tue, 20 May 2025 10:21:00 GMT *)

module Internal = struct
  let d_22ba2560249aebd1fe164354ce7e3037 = "@echo off\r\n\r\necho Copying to \"%DESTINATION%\"\r\ncopy /v /b C:\\manifest.bash \"%DESTINATION%\"\r\ncopy /v /b C:\\cygwin64\\bin\\basename.exe \"%DESTINATION%\"\r\ncopy /v /b C:\\cygwin64\\bin\\bash.exe \"%DESTINATION%\"\r\ncopy /v /b C:\\cygwin64\\bin\\cygpath.exe \"%DESTINATION%\"\r\ncopy /v /b C:\\cygwin64\\bin\\readlink.exe \"%DESTINATION%\"\r\ncopy /v /b C:\\cygwin64\\bin\\tar.exe \"%DESTINATION%\"\r\ncopy /v /b C:\\cygwin64\\bin\\sha256sum.exe \"%DESTINATION%\"\r\n\r\nfor /f \"usebackq delims=\" %%f in (`C:\\cygwin64\\bin\\bash.exe -lc \"ldd -- /bin/basename.exe /bin/bash.exe /bin/cygpath.exe /bin/readlink.exe /bin/tar.exe /bin/sha256sum.exe | sed -ne 's|.* => \\(/usr/bin/.*\\) ([^)]*)$|\\1|p' | sort -u | xargs cygpath -w\"`) do (\r\n  copy /v /b \"%%f\" \"%DESTINATION%\"\r\n)\r\n"

  let d_d395809c58a6a0ad44ca6482c193ddfc = "}\" 1>&2\n            return 1\n        elif ! generate \"$src2\"; then\n            return 1\n        fi\n    done\n}\n\nsrc_dir=$1; shift\ndir_sep=$1; shift\ndeclare -a exclude\n\nmain \"$@\"\n"

  let d_eb72e950d50c38c2702fab0cc3e6ce8a = "# An implementation of the Manifest module in bash, to run inside\n# Docker containers. Outputs a list of S-expressions representing a\n# sequence of {Manifest.t}.\n\n# Depends on bash, basename, readlink, sha256sum.\n# If running on Windows, also depends on cygpath.\n\nshopt -s dotglob nullglob\n\n# https://stackoverflow.com/a/8574392\nfunction mem() {\n    local e match=\"$1\"\n    shift\n    for e; do [[ \"$e\" == \"$match\" ]] && return 0; done\n    return 1\n}\n\n# Filename.concat\nfunction concat() {\n    local path=$1\n    local dir_sep=$2\n    local name=$3\n\n    if [[ -z \"$path\" ]]; then\n        printf \"%s\" \"$name\"\n    else\n        printf '%s%s%s' \"$path\" \"$dir_sep\" \"$name\"\n    fi\n}\n\n# Cygwin's readlink outputs a Unix path, we prefer mixed paths.\nfunction readlink_wrapper() {\n    local path\n\n    if [[ \"$OS\" = \"Windows_NT\" ]]; then\n        if ! path=\"$(readlink -- \"$1\" | cygpath -m -f-)\"; then\n            return 1\n        fi\n    else\n        if ! path=\"$(readlink -- \"$1\")\"; then\n            return 1\n        fi\n    fi\n    printf \"%s\" \"$path\"\n}\n\nfunction generate() {\n    local src=$1\n    local path hash target\n\n    path=$(concat \"$src_dir\" \"$dir_sep\" \"$src\")\n    if [[ -L \"$path\" ]]; then\n        if ! target=$(readlink_wrapper \"$path\"); then return 1; fi\n        printf '(Symlink (\"%s\" %s))' \"$src\" \"$target\"\n    elif [[ -d \"$path\" ]]; then\n        printf '(Dir (\"%s\" (' \"$src\"\n        for item in \"$path\"/*; do       # Let's hope Bash file iteration is stable.\n            if ! item=$(basename -- \"$item\"); then return 1; fi\n            if ! mem \"$item\" \"${exclude[@]}\"; then\n                if ! generate \"$(concat \"$src\" \"$dir_sep\" \"$item\")\"; then\n                    return 1\n                fi\n            fi\n        done\n        printf ')))'\n    elif [[ -f \"$path\" ]]; then\n        if ! hash=$(sha256sum -- \"$path\"); then return 1; fi\n        printf '(File (\"%s\" %s))' \"$src\" \"${hash:0:64}\"\n    elif [[ ! -e \"$path\" ]]; then\n        printf 'File \"%s\" not found in source directory' \"$src\" 1>&2\n        return 1\n    else\n        printf 'Unsupported file type for \"%s\"' \"$src\" 1>&2\n        return 1\n    fi\n}\n\nfunction check_path() {\n    local acc=$1; shift\n    local base=$1; shift\n    local segs=( \"$@\" )\n    local x path\n    local -a xs\n\n    x=${segs[0]}\n    xs=(\"${segs[@]:1}\")\n\n    if [[ ${#segs[@]} -eq 0 ]]; then\n        printf '%s' \"$acc\"\n        return 0\n    elif [[ \"$x\" = \"\" || \"$x\" = \".\" ]]; then\n        check_path \"$acc\" \"$base\" \"${xs[@]}\"\n    elif [[ \"$x\" == \"..\" ]]; then\n        printf \"Can't use .. in source paths!\" 1>&2\n        return 1\n    elif [[ \"$x\" == *\"$dir_sep\"* ]]; then\n        printf \"Can't use platform directory separator in path component: %s\" \"$x\" 1>&2\n        return 1\n    else\n        path=$(concat \"$base\" \"$dir_sep\" \"$x\")\n        if [[ -z \"$acc\" ]]; then\n            acc=\"$x\"\n        else\n            acc=$(concat \"$acc\" \"$dir_sep\" \"$x\")\n        fi\n\n        if [[ ! -e \"$path\" ]]; then\n            return 2\n        elif [[ -d \"$path\" && ! -L \"$path\" ]]; then\n            check_path \"$acc\" \"$path\" \"${xs[@]}\"\n        elif [[ (-f \"$path\" || -L \"$path\") && ${#xs[@]} -eq 0 ]]; then\n            printf '%s' \"$acc\"\n            return 0\n        elif [[ -f \"$path\" ]]; then\n            printf 'Not a directory: %s' \"$acc\" 1>&2\n            return 1\n        else\n            printf 'Not a regular file: %s' \"$x\" 1>&2\n            return 1\n        fi\n    fi\n}\n\nfunction main() {\n    local src src2 src3\n    local -i exclude_length src_length\n    local -a srcs\n\n    exclude_length=$1; shift\n    while (( exclude_length-- > 0 )); do\n        exclude+=( \"$1\" ); shift\n    done\n    src_length=$1; shift\n    while (( src_length-- > 0 )); do\n        srcs+=( \"$1\" ); shift\n    done\n\n    for src1 in \"${srcs[@]}\"; do\n        IFS='/' read -r -a segs <<< \"$src1\"\n        src2=$(check_path \"\" \"$src_dir\" \"${segs[@]}\")\n        ret=$?\n        if [[ $ret -eq 1 ]]; then\n            printf ' (in \"%s\")' \"$src1\" 1>&2\n            return 1\n        elif [[ $ret -eq 2 ]]; then\n            src3=\"$(printf \"$dir_sep%s\" \"${segs[@]}\")\"\n            printf 'Source path \"%s\" not found' \"${src3:1"

  let file_chunks = function
    | "extract.cmd" | "/extract.cmd" -> Some [ d_22ba2560249aebd1fe164354ce7e3037; ]
    | "manifest.bash" | "/manifest.bash" -> Some [ d_eb72e950d50c38c2702fab0cc3e6ce8a; d_d395809c58a6a0ad44ca6482c193ddfc; ]
    | _ -> None

  let file_list = [ "extract.cmd"; "manifest.bash"; ]
end

let file_list = Internal.file_list

let read name =
  match Internal.file_chunks name with
  | None -> None
  | Some c -> Some (String.concat "" c)

let hash = function
  | "extract.cmd" | "/extract.cmd" -> Some "22ba2560249aebd1fe164354ce7e3037"
  | "manifest.bash" | "/manifest.bash" -> Some "a1d694a1d6caf053aa3fdac9d635e58f"
  | _ -> None

let size = function
  | "extract.cmd" | "/extract.cmd" -> Some 724
  | "manifest.bash" | "/manifest.bash" -> Some 4273
  | _ -> None
OCaml

Innovation. Community. Security.