Merge pull request 'In Opamdiff.compare, do not figure out unchanged packages.' (#134) from opamdiff-not-same into main

Reviewed-on: https://git.robur.io/robur/builder-web/pulls/134
This commit is contained in:
Reynir Björnsson 2022-08-22 14:32:21 +00:00
commit 45f9a5a396
2 changed files with 5 additions and 12 deletions

View file

@ -848,7 +848,7 @@ let compare_builds
~(build_right : Builder_db.Build.t) ~(build_right : Builder_db.Build.t)
~env_diff:(added_env, removed_env, changed_env) ~env_diff:(added_env, removed_env, changed_env)
~pkg_diff:(added_pkgs, removed_pkgs, changed_pkgs) ~pkg_diff:(added_pkgs, removed_pkgs, changed_pkgs)
~opam_diff:(same, opam_diff, version_diff, left, right) ~opam_diff:(opam_diff, version_diff, left, right)
= =
layout layout
~nav:(`Comparison ((job_left, build_left), (job_right, build_right))) ~nav:(`Comparison ((job_left, build_left), (job_right, build_right)))
@ -902,10 +902,6 @@ let compare_builds
[txtf "%d opam packages with changes in their opam file" [txtf "%d opam packages with changes in their opam file"
(List.length opam_diff)] (List.length opam_diff)]
]; ];
H.li [
H.a ~a:H.[a_href "#opam-packages-unchanged"]
[txtf "%d opam packages unchanged" (OpamPackage.Set.cardinal same)]
];
H.li [ H.li [
H.a ~a:H.[a_href "#env-added"] H.a ~a:H.[a_href "#env-added"]
[ txtf "%d environment variables added" (List.length added_env)] [ txtf "%d environment variables added" (List.length added_env)]
@ -943,9 +939,6 @@ let compare_builds
H.h3 ~a:H.[a_id "opam-packages-opam-diff"] H.h3 ~a:H.[a_id "opam-packages-opam-diff"]
[H.txt "Opam packages with changes in their opam file"]] @ [H.txt "Opam packages with changes in their opam file"]] @
opam_diffs opam_diff @ [ opam_diffs opam_diff @ [
H.h3 ~a:H.[a_id "opam-packages-unchanged"]
[H.txt "Unchanged opam packages"];
H.code (packages same);
H.h3 ~a:H.[a_id "env-added"] [H.txt "Environment variables added"]; H.h3 ~a:H.[a_id "env-added"] [H.txt "Environment variables added"];
H.code (key_values added_env); H.code (key_values added_env);
H.h3 ~a:H.[a_id "env-removed"] [H.txt "Environment variables removed"]; H.h3 ~a:H.[a_id "env-removed"] [H.txt "Environment variables removed"];

View file

@ -102,12 +102,12 @@ let compare left right =
l l
in in
let same_version = Set.inter packages_left packages_right in let same_version = Set.inter packages_left packages_right in
let (same, opam_diff) = let opam_diff =
Set.partition Set.filter
(fun p -> (fun p ->
let find = OpamPackage.Name.Map.find p.name in let find = OpamPackage.Name.Map.find p.name in
let opam_left = find left.overlays and opam_right = find right.overlays in let opam_left = find left.overlays and opam_right = find right.overlays in
OpamFile.OPAM.effectively_equal opam_left opam_right) not (OpamFile.OPAM.effectively_equal opam_left opam_right))
same_version same_version
and version_diff = and version_diff =
List.filter_map (fun p1 -> List.filter_map (fun p1 ->
@ -126,4 +126,4 @@ let compare left right =
and right_pkgs = diff packages_right packages_left and right_pkgs = diff packages_right packages_left
in in
let opam_diff = detailed_opam_diffs left right opam_diff in let opam_diff = detailed_opam_diffs left right opam_diff in
(same, opam_diff, version_diff, left_pkgs, right_pkgs) (opam_diff, version_diff, left_pkgs, right_pkgs)