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

Add go.mod and go.sum for upgrade #978

Merged
merged 2 commits into from Oct 26, 2021
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
5 changes: 5 additions & 0 deletions upgrade/go.mod
@@ -0,0 +1,5 @@
module github.com/mattn/go-sqlite3/upgrade

go 1.16

require github.com/PuerkitoBio/goquery v1.7.1 // indirect
12 changes: 12 additions & 0 deletions upgrade/go.sum
@@ -0,0 +1,12 @@
github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4=
github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY=
github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE=
github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
31 changes: 20 additions & 11 deletions upgrade/upgrade.go
@@ -1,5 +1,5 @@
// +build !cgo
// +build upgrade,ignore
//go:build !cgo && upgrade && ignore
// +build !cgo,upgrade,ignore

package main

Expand Down Expand Up @@ -98,16 +98,25 @@ func mergeFile(src string, dst string) error {
func main() {
fmt.Println("Go-SQLite3 Upgrade Tool")

wd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
if filepath.Base(wd) != "upgrade" {
log.Printf("Current directory is %q but should run in upgrade directory", wd)
os.Exit(1)
}

// Download Amalgamation
_, amalgamation, err := download("sqlite-amalgamation-")
if err != nil {
fmt.Println("Failed to download: sqlite-amalgamation; %s", err)
log.Fatalf("Failed to download: sqlite-amalgamation; %s", err)
}

// Download Source
_, source, err := download("sqlite-src-")
if err != nil {
fmt.Println("Failed to download: sqlite-src; %s", err)
log.Fatalf("Failed to download: sqlite-src; %s", err)
}

// Create Amalgamation Zip Reader
Expand All @@ -127,11 +136,11 @@ func main() {
var f *os.File
switch path.Base(zf.Name) {
case "sqlite3.c":
f, err = os.Create("sqlite3-binding.c")
f, err = os.Create("../sqlite3-binding.c")
case "sqlite3.h":
f, err = os.Create("sqlite3-binding.h")
f, err = os.Create("../sqlite3-binding.h")
case "sqlite3ext.h":
f, err = os.Create("sqlite3ext.h")
f, err = os.Create("../sqlite3ext.h")
default:
continue
}
Expand Down Expand Up @@ -186,9 +195,9 @@ func main() {
var f *os.File
switch path.Base(zf.Name) {
case "userauth.c":
f, err = os.Create("userauth.c")
f, err = os.Create("../userauth.c")
case "sqlite3userauth.h":
f, err = os.Create("userauth.h")
f, err = os.Create("../userauth.h")
default:
continue
}
Expand All @@ -211,10 +220,10 @@ func main() {
}

// Merge SQLite User Authentication into amalgamation
if err := mergeFile("userauth.c", "sqlite3-binding.c"); err != nil {
if err := mergeFile("../userauth.c", "../sqlite3-binding.c"); err != nil {
log.Fatal(err)
}
if err := mergeFile("userauth.h", "sqlite3-binding.h"); err != nil {
if err := mergeFile("../userauth.h", "../sqlite3-binding.h"); err != nil {
log.Fatal(err)
}

Expand Down