diff --git a/pkg/bazel/bazel.go b/pkg/bazel/bazel.go index ef522ff..64580e8 100644 --- a/pkg/bazel/bazel.go +++ b/pkg/bazel/bazel.go @@ -122,14 +122,17 @@ func AddWorkspaceRPMs(workspace *build.File, pkgs []*api.Package, arch string) e rpms[pkgName] = rule } rule.SetName(pkgName) - rule.SetSHA256(pkg.Checksum.Text) urls := rule.URLs() - if len(urls) == 0 { + // Configure/re-configure the URLs when + // 1) no URLs are set, or + // 2) the checksum changed. + if len(urls) == 0 || (rule.SHA256() != pkg.Checksum.Text) { err := rule.SetURLs(pkg.Repository.Mirrors, pkg.Location.Href) if err != nil { return err } } + rule.SetSHA256(pkg.Checksum.Text) } rules := []*RPMRule{} diff --git a/pkg/bazel/testdata/WORKSPACE b/pkg/bazel/testdata/WORKSPACE index 2418fa6..b0c99e8 100644 --- a/pkg/bazel/testdata/WORKSPACE +++ b/pkg/bazel/testdata/WORKSPACE @@ -11,3 +11,12 @@ rpm( name = "test.rpm", urls = ["http://something.rpm"], ) + +rpm( + name = "a-0__2.3.4.myarch", + sha256 = "0000", + urls = [ + "old/url/1", + "old/url/2", + ], +)