-
Notifications
You must be signed in to change notification settings - Fork 2
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
change hash algorithm computation method #3
base: master
Are you sure you want to change the base?
Conversation
@@ -1,3 +1,5 @@ | |||
module git.helsinki.tools/helsinki-systems/wp4nix | |||
|
|||
go 1.16 | |||
|
|||
require github.com/nix-community/go-nix v0.0.0-20231219074122-93cb24a86856 // indirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be an indirect
dependency. Can you please run go get -u ; go mod tidy
and push the changes? 😊
func svnPrefetch(repo *Repository, path string, rev string, rawName string) (string, error) { | ||
h := sha256.New() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this down to after line 93 (inside the if err == nil
.
// people push some weird shit | ||
reg, _ := regexp.Compile("[^a-zA-Z0-9+\\-._?=]+") | ||
fixedName := reg.ReplaceAllString(rawName, "") | ||
dir, _ := ioutil.TempDir("", "wp4nix-prefetch-") | ||
defer os.RemoveAll(dir) | ||
var err error | ||
var resp string | ||
var hashString string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this
nar.DumpPath(h, filepath.Join(dir, fixedName)) | ||
hashString = nixbase32.EncodeToString(h.Sum(nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nar.DumpPath(h, filepath.Join(dir, fixedName)) | |
hashString = nixbase32.EncodeToString(h.Sum(nil)) | |
if err := nar.DumpPath(h, filepath.Join(dir, fixedName)); err != nil { | |
return "", fmt.Errorf("failed to dump path: %w", err) | |
} | |
return nixbase32.EncodeToString(h.Sum(nil)), nil |
} | ||
return resp, err | ||
return hashString, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return hashString, err | |
return "", err |
instead of using os.exec to execute nix-hash, this method uses a native go module for hash computation