-
Notifications
You must be signed in to change notification settings - Fork 34
Add a new RPM handling tool in GO #654
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Vitor Savian <[email protected]>
| expect -c ' | ||
| set timeout 60 | ||
| spawn gpg --pinentry-mode loopback --force-v3-sigs --verbose --detach-sign --armor %s | ||
| expect -re "Enter passphrase.*" | ||
| send -- "%s\r" | ||
| expect eof | ||
| lassign [wait] _ _ _ code | ||
| exit $code | ||
| ' |
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.
It feels odd to have golang running a shell that runs expect. This seems... messy. Is there a golang native way to do this?
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.
| cmd := exec.Command("rpm", "-qpi", localDest) | ||
| output, err := cmd.Output() | ||
| if err == nil { | ||
| lines := strings.Split(strings.TrimSpace(string(output)), "\n") | ||
|
|
||
| logrus.Info("=== RPM Package Info ===") | ||
| for _, line := range lines { | ||
| line = strings.TrimSpace(line) | ||
| if line != "" { | ||
| if strings.Contains(line, "Name") || | ||
| strings.Contains(line, "Version") || | ||
| strings.Contains(line, "Signature") || | ||
| strings.Contains(line, "Build Date") { | ||
| logrus.Infof(" %s", line) | ||
| } | ||
| } | ||
| } |
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.
Is there no better interface to parsing package metadata? Are we doing anything with this data or are we basically just filtering and logging the output from the rpm query?
This PR aims to refac the older rpm tool to match the pattern of the project and fix the problem that we have when we need to rerun the CI.
This new tool will have a new flag to rebuild the project if for some reason we need to rebuild the repo from the ground up.
It will delete the older repodata to clear older repodata files.
The tool will also verify if we already have a rpm with the same name, release and version and it will fail in this case