Skip to content

Commit

Permalink
all: remove all code related to legacy vulndb format
Browse files Browse the repository at this point in the history
This change removes all code related to generating and validating
vulnerability databases in the legacy format.

Fixes golang/go#65320

Change-Id: I83522efec90aa04df54976d5c29d485acd13e53c
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/558658
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
  • Loading branch information
tatianab authored and gopherbot committed Feb 21, 2024
1 parent 10c3808 commit 270b851
Show file tree
Hide file tree
Showing 45 changed files with 14 additions and 2,705 deletions.
28 changes: 3 additions & 25 deletions cmd/checkdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import (
"log"

db "golang.org/x/vulndb/internal/database"
"golang.org/x/vulndb/internal/database/legacydb"
)

var (
v1 = flag.Bool("v1", true, "if true, check with respect to v1 database schema")
legacy = flag.Bool("legacy", false, "if true, check with respect to legacy database schema")
)

func main() {
Expand All @@ -25,24 +19,8 @@ func main() {
if path == "" {
log.Fatal("path must be set\nusage: checkdb [path]")
}
if !*v1 && !*legacy {
log.Fatal("no versions set (use flags -v1 and/or -legacy)")
}
if *v1 {
if _, err := db.Load(path); err != nil {
log.Fatal(err)
}
fmt.Printf("%s contains valid v1 database\n", path)
} else {
fmt.Println("skipping v1 validity check (use flag -v1 to enable)")
}

if *legacy {
if _, err := legacydb.Load(path); err != nil {
log.Fatal(err)
}
fmt.Printf("%s contains valid legacy database\n", path)
} else {
fmt.Println("skipping legacy validity check (use flag -legacy to enable)")
if _, err := db.Load(path); err != nil {
log.Fatal(err)
}
fmt.Printf("%s contains valid v1 database\n", path)
}
18 changes: 2 additions & 16 deletions cmd/checkdeploy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ import (
"log"

db "golang.org/x/vulndb/internal/database"
"golang.org/x/vulndb/internal/database/legacydb"
)

var (
newPath = flag.String("new", "", "path to new database")
newLegacyPath = flag.String("legacy", "", "path to the new database in the legacy schema (optional)")
existingPath = flag.String("existing", "", "path to existing database")
newPath = flag.String("new", "", "path to new database")
existingPath = flag.String("existing", "", "path to existing database")
)

func main() {
Expand All @@ -34,16 +32,4 @@ func main() {
log.Fatal(err)
}
fmt.Printf("ok to deploy v1 database %s on top of %s\n", *newPath, *existingPath)

if *newLegacyPath != "" {
if err := legacydb.Validate(*newLegacyPath, *existingPath); err != nil {
log.Fatal(err)
}
if err := legacydb.Equivalent(*newPath, *newLegacyPath); err != nil {
log.Fatal(err)
}
fmt.Printf("ok to deploy legacy database %s on top of %s\n", *newLegacyPath, *existingPath)
} else {
fmt.Println("not checking legacy database deploy (use -legacy flag to set)")
}
}
25 changes: 0 additions & 25 deletions cmd/dbdiff/main.go

This file was deleted.

26 changes: 9 additions & 17 deletions cmd/gendb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"log"

db "golang.org/x/vulndb/internal/database"
"golang.org/x/vulndb/internal/database/legacydb"
"golang.org/x/vulndb/internal/gitrepo"
)

Expand All @@ -21,7 +20,6 @@ var (
jsonDir = flag.String("out", "out", "Directory to write JSON database to")
zipFile = flag.String("zip", "", "if provided, file to write zipped database to (for v1 database only)")
indent = flag.Bool("indent", false, "Indent JSON for debugging")
legacy = flag.Bool("legacy", false, "if true, generate in the legacy schema")
)

func main() {
Expand All @@ -31,22 +29,16 @@ func main() {
if err != nil {
log.Fatal(err)
}
if *legacy {
if err := legacydb.Generate(ctx, repo, *jsonDir, *indent); err != nil {
log.Fatal(err)
}
} else {
d, err := db.FromRepo(ctx, repo)
if err != nil {
log.Fatal(err)
}
if err := d.Write(*jsonDir); err != nil {
d, err := db.FromRepo(ctx, repo)
if err != nil {
log.Fatal(err)
}
if err := d.Write(*jsonDir); err != nil {
log.Fatal(err)
}
if *zipFile != "" {
if err := d.WriteZip(*zipFile); err != nil {
log.Fatal(err)
}
if *zipFile != "" {
if err := d.WriteZip(*zipFile); err != nil {
log.Fatal(err)
}
}
}
}
159 changes: 0 additions & 159 deletions internal/database/legacydb/database.go

This file was deleted.

Loading

0 comments on commit 270b851

Please sign in to comment.