|
|
@ -54,7 +54,6 @@ import ( |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/cespare/cp" |
|
|
|
"github.com/cespare/cp" |
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/crypto/signify" |
|
|
|
"github.com/ethereum/go-ethereum/crypto/signify" |
|
|
|
"github.com/ethereum/go-ethereum/internal/build" |
|
|
|
"github.com/ethereum/go-ethereum/internal/build" |
|
|
|
"github.com/ethereum/go-ethereum/params" |
|
|
|
"github.com/ethereum/go-ethereum/params" |
|
|
@ -144,7 +143,7 @@ func executablePath(name string) string { |
|
|
|
func main() { |
|
|
|
func main() { |
|
|
|
log.SetFlags(log.Lshortfile) |
|
|
|
log.SetFlags(log.Lshortfile) |
|
|
|
|
|
|
|
|
|
|
|
if !common.FileExist(filepath.Join("build", "ci.go")) { |
|
|
|
if !build.FileExist(filepath.Join("build", "ci.go")) { |
|
|
|
log.Fatal("this script must be run from the root of the repository") |
|
|
|
log.Fatal("this script must be run from the root of the repository") |
|
|
|
} |
|
|
|
} |
|
|
|
if len(os.Args) < 2 { |
|
|
|
if len(os.Args) < 2 { |
|
|
@ -352,8 +351,8 @@ func downloadSpecTestFixtures(csdb *build.ChecksumDB, cachedir string) string { |
|
|
|
// hashAllSourceFiles iterates all files under the top-level project directory
|
|
|
|
// hashAllSourceFiles iterates all files under the top-level project directory
|
|
|
|
// computing the hash of each file (excluding files within the tests
|
|
|
|
// computing the hash of each file (excluding files within the tests
|
|
|
|
// subrepo)
|
|
|
|
// subrepo)
|
|
|
|
func hashAllSourceFiles() (map[string]common.Hash, error) { |
|
|
|
func hashAllSourceFiles() (map[string][32]byte, error) { |
|
|
|
res := make(map[string]common.Hash) |
|
|
|
res := make(map[string][32]byte) |
|
|
|
err := filepath.WalkDir(".", func(path string, d os.DirEntry, err error) error { |
|
|
|
err := filepath.WalkDir(".", func(path string, d os.DirEntry, err error) error { |
|
|
|
if strings.HasPrefix(path, filepath.FromSlash("tests/testdata")) { |
|
|
|
if strings.HasPrefix(path, filepath.FromSlash("tests/testdata")) { |
|
|
|
return filepath.SkipDir |
|
|
|
return filepath.SkipDir |
|
|
@ -370,7 +369,7 @@ func hashAllSourceFiles() (map[string]common.Hash, error) { |
|
|
|
if _, err := io.Copy(hasher, f); err != nil { |
|
|
|
if _, err := io.Copy(hasher, f); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
res[path] = common.Hash(hasher.Sum(nil)) |
|
|
|
res[path] = [32]byte(hasher.Sum(nil)) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
}) |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -381,8 +380,8 @@ func hashAllSourceFiles() (map[string]common.Hash, error) { |
|
|
|
|
|
|
|
|
|
|
|
// hashSourceFiles iterates the provided set of filepaths (relative to the top-level geth project directory)
|
|
|
|
// hashSourceFiles iterates the provided set of filepaths (relative to the top-level geth project directory)
|
|
|
|
// computing the hash of each file.
|
|
|
|
// computing the hash of each file.
|
|
|
|
func hashSourceFiles(files []string) (map[string]common.Hash, error) { |
|
|
|
func hashSourceFiles(files []string) (map[string][32]byte, error) { |
|
|
|
res := make(map[string]common.Hash) |
|
|
|
res := make(map[string][32]byte) |
|
|
|
for _, filePath := range files { |
|
|
|
for _, filePath := range files { |
|
|
|
f, err := os.OpenFile(filePath, os.O_RDONLY, 0666) |
|
|
|
f, err := os.OpenFile(filePath, os.O_RDONLY, 0666) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -392,14 +391,14 @@ func hashSourceFiles(files []string) (map[string]common.Hash, error) { |
|
|
|
if _, err := io.Copy(hasher, f); err != nil { |
|
|
|
if _, err := io.Copy(hasher, f); err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
res[filePath] = common.Hash(hasher.Sum(nil)) |
|
|
|
res[filePath] = [32]byte(hasher.Sum(nil)) |
|
|
|
} |
|
|
|
} |
|
|
|
return res, nil |
|
|
|
return res, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// compareHashedFilesets compares two maps (key is relative file path to top-level geth directory, value is its hash)
|
|
|
|
// compareHashedFilesets compares two maps (key is relative file path to top-level geth directory, value is its hash)
|
|
|
|
// and returns the list of file paths whose hashes differed.
|
|
|
|
// and returns the list of file paths whose hashes differed.
|
|
|
|
func compareHashedFilesets(preHashes map[string]common.Hash, postHashes map[string]common.Hash) []string { |
|
|
|
func compareHashedFilesets(preHashes map[string][32]byte, postHashes map[string][32]byte) []string { |
|
|
|
updates := []string{} |
|
|
|
updates := []string{} |
|
|
|
for path, postHash := range postHashes { |
|
|
|
for path, postHash := range postHashes { |
|
|
|
preHash, ok := preHashes[path] |
|
|
|
preHash, ok := preHashes[path] |
|
|
@ -442,7 +441,7 @@ func doGenerate() { |
|
|
|
protocPath := downloadProtoc(*cachedir) |
|
|
|
protocPath := downloadProtoc(*cachedir) |
|
|
|
protocGenGoPath := downloadProtocGenGo(*cachedir) |
|
|
|
protocGenGoPath := downloadProtocGenGo(*cachedir) |
|
|
|
|
|
|
|
|
|
|
|
var preHashes map[string]common.Hash |
|
|
|
var preHashes map[string][32]byte |
|
|
|
if *verify { |
|
|
|
if *verify { |
|
|
|
var err error |
|
|
|
var err error |
|
|
|
preHashes, err = hashAllSourceFiles() |
|
|
|
preHashes, err = hashAllSourceFiles() |
|
|
@ -915,7 +914,7 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) { |
|
|
|
var idfile string |
|
|
|
var idfile string |
|
|
|
if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 { |
|
|
|
if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 { |
|
|
|
idfile = filepath.Join(workdir, "sshkey") |
|
|
|
idfile = filepath.Join(workdir, "sshkey") |
|
|
|
if !common.FileExist(idfile) { |
|
|
|
if !build.FileExist(idfile) { |
|
|
|
os.WriteFile(idfile, sshkey, 0600) |
|
|
|
os.WriteFile(idfile, sshkey, 0600) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|