Skip to content

Commit

Permalink
lint: fix W59 for local url (rsync) that are not archives
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Oct 1, 2024
1 parent 0fadc5f commit 6f6381b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ users)
## Source

## Lint
* [BUG] fix lint W59 with local urls that are not archives [#6219 @rjbou - fix #6218]

## Repository

Expand Down
12 changes: 9 additions & 3 deletions src/state/opamFileTools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,15 @@ let t_lint ?check_extra_files ?(check_upstream=false) ?(all=false) t =
| #OpamUrl.version_control -> true
| _ -> false)
in
let url_archive =
let open OpamStd.Option.Op in
t.url >>| OpamFile.URL.url >>| (fun u ->
OpamSystem.is_archive u.OpamUrl.path)
in
let is_url_archive =
not (OpamFile.OPAM.has_flag Pkgflag_Conf t) &&
url_vcs = Some false
not (OpamFile.OPAM.has_flag Pkgflag_Conf t)
&& url_vcs = Some false
&& url_archive = Some true
in
let check_upstream = check_upstream && is_url_archive in
let check_double compare to_str lst =
Expand Down Expand Up @@ -1001,7 +1007,7 @@ let t_lint ?check_extra_files ?(check_upstream=false) ?(all=false) t =
|> List.map OpamHash.to_string
|> OpamStd.Format.pretty_list)])
t.url)
(url_vcs = Some true
(url_vcs = Some true && url_archive = Some false
&& OpamStd.Option.Op.(t.url >>| fun u -> OpamFile.URL.checksum u <> [])
= Some true);
cond 68 `Warning
Expand Down

0 comments on commit 6f6381b

Please sign in to comment.