Allow README.md being present anywhere
The one in root takes precedence, but opam-installer doesn't really want to install things into %{prefix}%.
This commit is contained in:
parent
009fa49e9e
commit
1e3fcf984f
2 changed files with 19 additions and 6 deletions
|
@ -71,9 +71,16 @@ let migrate datadir (module Db : Caqti_blocking.CONNECTION) =
|
|||
Ok ((fpath, data) :: acc))
|
||||
(Ok [])
|
||||
artifacts >>= fun files ->
|
||||
(match List.find_opt (fun (p, _) -> Fpath.(equal (v "README.md") p)) files with
|
||||
| None -> Ok ()
|
||||
| Some (_, data) -> Db.exec insert_job_tag (readme_id, data, job)))
|
||||
let readme =
|
||||
List.find_opt (fun (p, _) -> Fpath.(equal (v "README.md") p)) files
|
||||
in
|
||||
let readme_anywhere =
|
||||
List.find_opt (fun (p, _) -> String.equal "README.md" (Fpath.basename p)) files
|
||||
in
|
||||
(match readme, readme_anywhere with
|
||||
| None, None -> Ok ()
|
||||
| Some (_, data), _ | None, Some (_, data) ->
|
||||
Db.exec insert_job_tag (readme_id, data, job)))
|
||||
jobs >>= fun () ->
|
||||
Db.exec (Grej.set_version new_version) ()
|
||||
|
||||
|
|
12
lib/model.ml
12
lib/model.ml
|
@ -294,9 +294,15 @@ let add_build
|
|||
(match snd sec_syn with
|
||||
| _, None -> Lwt_result.return ()
|
||||
| _, Some descr_v -> add_or_update descr_id descr_v) >>= fun () ->
|
||||
(match List.find_opt (fun (p, _) -> Fpath.(equal (v "README.md") p)) raw_artifacts with
|
||||
| None -> Lwt_result.return ()
|
||||
| Some (_, data) -> add_or_update readme_id data) >>= fun () ->
|
||||
(let readme =
|
||||
List.find_opt (fun (p, _) -> Fpath.(equal (v "README.md") p)) raw_artifacts
|
||||
in
|
||||
let readme_anywhere =
|
||||
List.find_opt (fun (p, _) -> String.equal "README.md" (Fpath.basename p)) raw_artifacts
|
||||
in
|
||||
match readme, readme_anywhere with
|
||||
| None, None -> Lwt_result.return ()
|
||||
| Some (_, data), _ | None, Some (_, data) -> add_or_update readme_id data) >>= fun () ->
|
||||
List.fold_left
|
||||
(fun r file ->
|
||||
r >>= fun () ->
|
||||
|
|
Loading…
Reference in a new issue