Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opam lint: Fix E67, check checksum only if vcs backend #4960

Merged
merged 2 commits into from May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions master_changes.md
Expand Up @@ -100,6 +100,7 @@ users)
* E57 (capital on synopsis) not trigger W47 (empty descr) [#5070 @rjbou]
* [BUG] Fix linting packages from repository with tarred repositories, the file in temporary repository was no more avaiable when lint is done [#5068 @rjbou]
* Update repository package filename display [#5068 @rjbou]
* E67: check checksums only for vcs urls [#4960 @rjbou]

## Repository
* When several checksums are specified, instead of adding in the cache only the archive by first checksum, name by best one and link others to this archive [#4696 rjbou]
Expand Down
16 changes: 7 additions & 9 deletions src/state/opamFileTools.ml
Expand Up @@ -291,17 +291,17 @@ let t_lint ?check_extra_files ?(check_upstream=false) ?(all=false) t =
let all_expanded_strings = all_expanded_strings t in
let all_depends = all_depends t in
(* Upstream is checked only if it is an archive and non vcs backend *)
let url_is_archive =
let url_vcs =
let open OpamStd.Option.Op in
t.url >>| OpamFile.URL.url >>| (fun u ->
match u.OpamUrl.backend with
| #OpamUrl.version_control -> false
| _ -> OpamSystem.is_archive (OpamUrl.base_url u))
| #OpamUrl.version_control -> true
| _ -> false)
in
let check_upstream =
check_upstream &&
not (OpamFile.OPAM.has_flag Pkgflag_Conf t) &&
url_is_archive = Some true
url_vcs = Some false
in
let warnings = [
cond 20 `Warning
Expand Down Expand Up @@ -859,11 +859,9 @@ let t_lint ?check_extra_files ?(check_upstream=false) ?(all=false) t =
|> List.map OpamHash.to_string
|> OpamStd.Format.pretty_list)])
t.url)
(match t.url with
| None -> false
| Some urlf ->
(OpamFile.URL.checksum urlf <> [])
&& url_is_archive <> Some true);
(url_vcs = Some true
&& OpamStd.Option.Op.(t.url >>| fun u -> OpamFile.URL.checksum u <> [])
= Some true);
cond 68 `Warning
"Missing field 'license'"
(t.license = []);
Expand Down