fixup 2021-07-07a: remove leftover orb.deb / orb.txz from build_artifacts

This commit is contained in:
Robur 2021-07-07 10:46:53 +00:00
parent 96ee7649b7
commit f66fa8bf19
2 changed files with 23 additions and 0 deletions

View file

@ -90,6 +90,11 @@ let f20210308 =
Cmdliner.Term.(const do_database_action $ const M20210308.fixup $ setup_log $ datadir), Cmdliner.Term.(const do_database_action $ const M20210308.fixup $ setup_log $ datadir),
Cmdliner.Term.info ~doc "fixup-2021-03-08" Cmdliner.Term.info ~doc "fixup-2021-03-08"
let f20210707a =
let doc = "Remove orb.deb and orb.txz that ended up in the build." in
Cmdliner.Term.(const do_database_action $ const M20210707a.fixup $ setup_log $ datadir),
Cmdliner.Term.info ~doc "fixup-2021-07-07a"
let help_cmd = let help_cmd =
let topic = let topic =
let doc = "Migration to get help on" in let doc = "Migration to get help on" in
@ -124,5 +129,6 @@ let () =
actions (module M20210630); actions (module M20210630);
actions (module M20210701); actions (module M20210701);
actions (module M20210706); actions (module M20210706);
[ f20210707a ];
]) ])
|> Cmdliner.Term.exit |> Cmdliner.Term.exit

View file

@ -0,0 +1,17 @@
let orb_left_in_builds =
Caqti_request.collect ~oneshot:true
Caqti_type.unit
(Caqti_type.tup2 (Builder_db.Rep.id `build_artifact) Builder_db.Rep.fpath)
{| SELECT id, localpath FROM build_artifact
WHERE filepath = 'orb.deb' OR filepath = 'orb.txz'
|}
let fixup datadir (module Db : Caqti_blocking.CONNECTION) =
let open Rresult.R.Infix in
Grej.check_version ~user_version:12L (module Db) >>= fun () ->
Db.rev_collect_list orb_left_in_builds () >>= fun leftover_orb ->
Grej.list_iter_result
(fun (id, path) ->
Bos.OS.File.delete (Fpath.append datadir path) >>= fun () ->
Db.exec Builder_db.Build_artifact.remove id)
leftover_orb