Revert "[cipd] Include local path in package lock key"
This reverts commit d142747aea5ae43b6fe004dfcebde3e1c6004c67.
Reason for revert: this is failing to roll into recipes (fxrev.dev/560288) so I suspect I broke something.
Original change's description:
> [cipd] Include local path in package lock key
>
> jiri should allow the same package to be included by a manifest multiple
> times at different paths. However, this was previously not always
> possible because jiri only used the name and version of each package to
> compute it unique key when checking for duplicate entries in a lockfile.
> So it was only possible to have the same package at two different paths
> as long as the two were pinned to different versions.
>
> That bug caused failures like this when a package was pinned to the same
> version at two different paths:
> https://ci.chromium.org/b/8841199368556918912
>
> By including the package's local path in the key, we'll no longer
> consider that to be a collision.
>
> Change-Id: I3dde72473f43d6dbcd5cc3565f79e98c88694b64
> Reviewed-on: https://fuchsia-review.googlesource.com/c/jiri/+/560285
> Fuchsia-Auto-Submit: Oliver Newman <olivernewman@google.com>
> Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
> Reviewed-by: Nathan Mulcahey <nmulcahey@google.com>
TBR=haowei@google.com,nmulcahey@google.com,olivernewman@google.com,auto-submit@fuchsia-infra.iam.gserviceaccount.com
Change-Id: Ia272001eff7cfc489e28da13926203702c9fd5d9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://fuchsia-review.googlesource.com/c/jiri/+/560024
Reviewed-by: Oliver Newman <olivernewman@google.com>
Commit-Queue: Oliver Newman <olivernewman@google.com>
diff --git a/project/manifest.go b/project/manifest.go
index 75b14a8..70ca0ea 100644
--- a/project/manifest.go
+++ b/project/manifest.go
@@ -24,14 +24,13 @@
"text/template"
"time"
- "golang.org/x/net/publicsuffix"
-
"go.fuchsia.dev/jiri"
"go.fuchsia.dev/jiri/cipd"
"go.fuchsia.dev/jiri/envvar"
"go.fuchsia.dev/jiri/gerrit"
"go.fuchsia.dev/jiri/gitutil"
"go.fuchsia.dev/jiri/retry"
+ "golang.org/x/net/publicsuffix"
)
// Manifest represents a setting used for updating the universe.
@@ -737,7 +736,7 @@
return err
}
for _, pkg := range pkgs {
- if pkgLock, ok := ld.PackageLocks[MakePackageLockKey(pkg, v.Version, v.Path)]; ok {
+ if pkgLock, ok := ld.PackageLocks[MakePackageLockKey(pkg, v.Version)]; ok {
if pkgLock.VersionTag != v.Version && !jirix.IgnoreLockConflicts {
// Package version conflicts detected. Treated it as an error.
s := fmt.Sprintf("package %q has conflicting version in manifest and jiri.lock: %s:%s", v.Name, v.Version, pkgLock.VersionTag)
diff --git a/project/project.go b/project/project.go
index 38adee5..4fc98de 100644
--- a/project/project.go
+++ b/project/project.go
@@ -437,18 +437,17 @@
type PackageLockKey struct {
packageName string
versionTag string
- localPath string
}
-func MakePackageLockKey(packageName, versionTag, localPath string) PackageLockKey {
- return PackageLockKey{packageName: packageName, versionTag: versionTag, localPath: localPath}
+func MakePackageLockKey(packageName string, versionTag string) PackageLockKey {
+ return PackageLockKey{packageName: packageName, versionTag: versionTag}
}
// PackageLocks type is map wrapper over PackageLock for faster look up
type PackageLocks map[PackageLockKey]PackageLock
func (p PackageLock) Key() PackageLockKey {
- return MakePackageLockKey(p.PackageName, p.VersionTag, p.LocalPath)
+ return MakePackageLockKey(p.PackageName, p.VersionTag)
}
// LockEqual determines whether current PackageLock has same version and
@@ -1352,7 +1351,7 @@
return nil, nil, err
}
for _, expandedName := range expandedNames {
- lockKey := MakePackageLockKey(expandedName, v.Version, v.Path)
+ lockKey := MakePackageLockKey(expandedName, v.Version)
lockEntry, ok := pkgLocks[lockKey]
if !ok {
jirix.Logger.Errorf("lock key not found in pkgLocks: %v, package: %+v", lockKey, v)