@@ -30,10 +30,11 @@ import (
30
30
const availableTemplateVariables = "ProjectRoot, Constraint, Version, Revision, Latest, and PackageCount."
31
31
const availableDefaultTemplateVariables = `.Projects[]{
32
32
.ProjectRoot,.Source,.Constraint,.PackageCount,.Packages[],
33
- .Locked{.Branch,.Revision,.Version},.Latest{.Revision,.Version}
33
+ .PruneOpts,.Digest,.Locked{.Branch,.Revision,.Version},
34
+ .Latest{.Revision,.Version}
34
35
},
35
36
.Metadata{
36
- .AnalyzerName,.AnalyzerVersion,.InputsDigest ,.SolverName,
37
+ .AnalyzerName,.AnalyzerVersion,.InputImports ,.SolverName,
37
38
.SolverVersion
38
39
}`
39
40
@@ -405,6 +406,8 @@ func (out *templateOutput) DetailLine(ds *DetailStatus) error {
405
406
Constraint : ds .getConsolidatedConstraint (),
406
407
Locked : formatDetailVersion (ds .Version , ds .Revision ),
407
408
Latest : formatDetailLatestVersion (ds .Latest , ds .hasError ),
409
+ PruneOpts : ds .getPruneOpts (),
410
+ Digest : ds .Digest .String (),
408
411
PackageCount : ds .PackageCount ,
409
412
Source : ds .Source ,
410
413
Packages : ds .Packages ,
@@ -757,6 +760,8 @@ type rawDetailProject struct {
757
760
Packages []string
758
761
Locked rawDetailVersion
759
762
Latest rawDetailVersion
763
+ PruneOpts string
764
+ Digest string
760
765
Source string `json:"Source,omitempty"`
761
766
Constraint string
762
767
PackageCount int
@@ -765,7 +770,8 @@ type rawDetailProject struct {
765
770
type rawDetailMetadata struct {
766
771
AnalyzerName string
767
772
AnalyzerVersion int
768
- InputsDigest string
773
+ InputsDigest string // deprecated
774
+ InputImports []string
769
775
SolverName string
770
776
SolverVersion int
771
777
}
@@ -778,6 +784,7 @@ func newRawMetadata(metadata *dep.SolveMeta) rawDetailMetadata {
778
784
return rawDetailMetadata {
779
785
AnalyzerName : metadata .AnalyzerName ,
780
786
AnalyzerVersion : metadata .AnalyzerVersion ,
787
+ InputImports : metadata .InputImports ,
781
788
SolverName : metadata .SolverName ,
782
789
SolverVersion : metadata .SolverVersion ,
783
790
}
@@ -802,8 +809,10 @@ type BasicStatus struct {
802
809
// information included about a a project in a lock file.
803
810
type DetailStatus struct {
804
811
BasicStatus
805
- Packages []string
806
- Source string
812
+ Packages []string
813
+ Source string
814
+ PruneOpts gps.PruneOptions
815
+ Digest verify.VersionedDigest
807
816
}
808
817
809
818
func (bs * BasicStatus ) getConsolidatedConstraint () string {
@@ -849,6 +858,10 @@ func (bs *BasicStatus) getConsolidatedLatest(revSize uint8) string {
849
858
return latest
850
859
}
851
860
861
+ func (ds * DetailStatus ) getPruneOpts () string {
862
+ return (ds .PruneOpts & ^ gps .PruneNestedVendorDirs ).String ()
863
+ }
864
+
852
865
func (bs * BasicStatus ) marshalJSON () * rawStatus {
853
866
return & rawStatus {
854
867
ProjectRoot : bs .ProjectRoot ,
@@ -868,6 +881,8 @@ func (ds *DetailStatus) marshalJSON() *rawDetailProject {
868
881
Constraint : rawStatus .Constraint ,
869
882
Locked : formatDetailVersion (ds .Version , ds .Revision ),
870
883
Latest : formatDetailLatestVersion (ds .Latest , ds .hasError ),
884
+ PruneOpts : ds .getPruneOpts (),
885
+ Digest : ds .Digest .String (),
871
886
Source : ds .Source ,
872
887
Packages : ds .Packages ,
873
888
PackageCount : ds .PackageCount ,
@@ -926,9 +941,10 @@ func (cmd *statusCommand) runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Proje
926
941
927
942
lsat := verify .LockSatisfiesInputs (p .Lock , p .Manifest , params .RootPackageTree )
928
943
if lsat .Satisfied () {
929
- // If these are equal, we're guaranteed that the lock is a transitively
930
- // complete picture of all deps. That eliminates the need for at least
931
- // some checks.
944
+ // If the lock satisfies the inputs, we're guaranteed (barring manual
945
+ // meddling, about which we can do nothing) that the lock is a
946
+ // transitively complete picture of all deps. That eliminates the need
947
+ // for some checks.
932
948
933
949
logger .Println ("Checking upstream projects:" )
934
950
@@ -945,7 +961,7 @@ func (cmd *statusCommand) runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Proje
945
961
wg .Add (1 )
946
962
logger .Printf ("(%d/%d) %s\n " , i + 1 , len (slp ), proj .Ident ().ProjectRoot )
947
963
948
- go func (proj gps. LockedProject ) {
964
+ go func (proj verify. VerifiableProject ) {
949
965
bs := BasicStatus {
950
966
ProjectRoot : string (proj .Ident ().ProjectRoot ),
951
967
PackageCount : len (proj .Packages ()),
@@ -1043,12 +1059,14 @@ func (cmd *statusCommand) runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Proje
1043
1059
if cmd .detail {
1044
1060
ds .Source = proj .Ident ().Source
1045
1061
ds .Packages = proj .Packages ()
1062
+ ds .PruneOpts = proj .PruneOpts
1063
+ ds .Digest = proj .Digest
1046
1064
}
1047
1065
1048
1066
dsCh <- & ds
1049
1067
1050
1068
wg .Done ()
1051
- }(proj )
1069
+ }(proj .(verify. VerifiableProject ) )
1052
1070
}
1053
1071
1054
1072
wg .Wait ()
@@ -1118,12 +1136,6 @@ func (cmd *statusCommand) runStatusAll(ctx *dep.Ctx, out outputter, p *dep.Proje
1118
1136
return false , errCount , err
1119
1137
}
1120
1138
1121
- // Hash digest mismatch may indicate that some deps are no longer
1122
- // needed, some are missing, or that some constraints or source
1123
- // locations have changed.
1124
- //
1125
- // It's possible for digests to not match, but still have a correct
1126
- // lock.
1127
1139
rm , _ := ptree .ToReachMap (true , true , false , p .Manifest .IgnoredPackages ())
1128
1140
1129
1141
external := rm .FlattenFn (paths .IsStandardImportPath )
@@ -1406,28 +1418,75 @@ func parseStatusTemplate(format string) (*template.Template, error) {
1406
1418
"dec" : func (i int ) int {
1407
1419
return i - 1
1408
1420
},
1421
+ "tomlStrSplit" : tomlStrSplit ,
1422
+ "tomlStrSplit2" : func (strlist []string , level int ) string {
1423
+ // Hardcode to two spaces.
1424
+ inbracket , inp := strings .Repeat (" " , level ), strings .Repeat (" " , level + 1 )
1425
+ switch len (strlist ) {
1426
+ case 0 :
1427
+ return "[]"
1428
+ case 1 :
1429
+ return fmt .Sprintf ("[\" %s\" ]" , strlist [0 ])
1430
+ default :
1431
+ var buf bytes.Buffer
1432
+
1433
+ fmt .Fprintf (& buf , "[\n " )
1434
+ for _ , str := range strlist {
1435
+ fmt .Fprintf (& buf , "%s\" %s\" ,\n " , inp , str )
1436
+ }
1437
+ fmt .Fprintf (& buf , "%s]" , inbracket )
1438
+
1439
+ return buf .String ()
1440
+ }
1441
+ },
1409
1442
}).Parse (format )
1410
1443
1411
1444
return tmpl , err
1412
1445
}
1413
1446
1447
+ func tomlStrSplit (strlist []string ) string {
1448
+ switch len (strlist ) {
1449
+ case 0 :
1450
+ return "[]"
1451
+ case 1 :
1452
+ return fmt .Sprintf ("[\" %s\" ]" , strlist [0 ])
1453
+ default :
1454
+ var buf bytes.Buffer
1455
+
1456
+ // Hardcode to two spaces.
1457
+ fmt .Fprintf (& buf , "[\n " )
1458
+ for _ , str := range strlist {
1459
+ fmt .Fprintf (& buf , " \" %s\" ,\n " , str )
1460
+ }
1461
+ fmt .Fprintf (& buf , " ]" )
1462
+
1463
+ return buf .String ()
1464
+ }
1465
+ }
1466
+
1414
1467
const statusLockTemplate = `# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
1415
1468
1416
1469
1417
- {{range $p := .Projects}}[[projects]]{{if $p.Locked.Branch}}
1418
- branch = "{{$p.Locked.Branch}}"{{end}}
1470
+ {{range $p := .Projects}}[[projects]]
1471
+ {{- if $p.Locked.Branch}}
1472
+ branch = "{{$p.Locked.Branch}}"
1473
+ {{- end}}
1474
+ digest = "{{$p.Digest}}"
1419
1475
name = "{{$p.ProjectRoot}}"
1420
- packages = [{{if eq 0 (len $p.Packages)}}"."]{{else}}{{range $i, $pkg := $p.Packages}}
1421
- "{{$pkg}}"{{if lt $i (dec (len $p.Packages))}},{{end}}{{end}}
1422
- ]{{end}}
1423
- revision = "{{$p.Locked.Revision}}"{{if $p.Source}}
1424
- source = "{{$p.Source}}"{{end}}{{if $p.Locked.Version}}
1425
- version = "{{$p.Locked.Version}}"{{end}}
1476
+ packages = {{(tomlStrSplit $p.Packages)}}
1477
+ pruneopts = "{{$p.PruneOpts}}"
1478
+ revision = "{{$p.Locked.Revision}}"
1479
+ {{- if $p.Source}}
1480
+ source = "{{$p.Source}}"
1481
+ {{- end}}
1482
+ {{- if $p.Locked.Version}}
1483
+ version = "{{$p.Locked.Version}}"
1484
+ {{- end}}
1426
1485
1427
1486
{{end}}[solve-meta]
1428
1487
analyzer-name = "{{.Metadata.AnalyzerName}}"
1429
1488
analyzer-version = {{.Metadata.AnalyzerVersion}}
1430
- inputs-digest = "{{ .Metadata.InputsDigest}}"
1489
+ input-imports = {{(tomlStrSplit .Metadata.InputImports)}}
1431
1490
solver-name = "{{.Metadata.SolverName}}"
1432
1491
solver-version = {{.Metadata.SolverVersion}}
1433
1492
`
0 commit comments