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

gen-manifests: create predictable version/release numbers in mockDepsolve #937

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/gen-manifests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"io"
"os"
"path/filepath"
"strconv"
"strings"

"github.com/gobwas/glob"
Expand Down Expand Up @@ -375,11 +376,15 @@ func mockDepsolve(packageSets map[string][]rpmmd.PackageSet, repos []rpmmd.RepoC
for _, pkgSet := range pkgSetChain {
for _, pkgName := range pkgSet.Include {
checksum := fmt.Sprintf("%x", sha256.Sum256([]byte(pkgName)))
// generate predictable but non-empty
// release/version numbers
ver := strconv.Itoa(int(pkgName[0]) % 9)
rel := strconv.Itoa(int(pkgName[1]) % 9)
spec := rpmmd.PackageSpec{
Name: pkgName,
Epoch: 0,
Version: "0",
Release: "0",
Version: ver,
Release: rel + ".fk1",
Arch: "noarch",
RemoteLocation: fmt.Sprintf("https://example.com/repo/packages/%s", pkgName),
Checksum: "sha256:" + checksum,
Expand Down
Loading