Merge pull request #14 from brancz/fix-moving-locked-deps

pkg: Correctly move locked dependencies
This commit is contained in:
Frederic Branczyk 2018-08-02 09:59:27 +02:00 committed by GitHub
commit e581455455
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,23 +59,6 @@ func Install(ctx context.Context, isLock bool, dependencySourceIdentifier string
return nil, errors.Wrap(err, "failed to install package") return nil, errors.Wrap(err, "failed to install package")
} }
// If dependencies are being installed from a lock file, the transitive
// dependencies are not questioned, but the locked dependencies are
// just installed.
if isLock {
continue
}
lock.Dependencies, err = insertDependency(lock.Dependencies, spec.Dependency{
Name: dep.Name,
Source: dep.Source,
Version: lockVersion,
DepSource: dependencySourceIdentifier,
})
if err != nil {
return nil, errors.Wrap(err, "failed to insert dependency to lock dependencies")
}
destPath := path.Join(dir, dep.Name) destPath := path.Join(dir, dep.Name)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "failed to find destination path for package") return nil, errors.Wrap(err, "failed to find destination path for package")
@ -95,6 +78,23 @@ func Install(ctx context.Context, isLock bool, dependencySourceIdentifier string
return nil, errors.Wrap(err, "failed to move package") return nil, errors.Wrap(err, "failed to move package")
} }
lock.Dependencies, err = insertDependency(lock.Dependencies, spec.Dependency{
Name: dep.Name,
Source: dep.Source,
Version: lockVersion,
DepSource: dependencySourceIdentifier,
})
if err != nil {
return nil, errors.Wrap(err, "failed to insert dependency to lock dependencies")
}
// If dependencies are being installed from a lock file, the transitive
// dependencies are not questioned, the locked dependencies are just
// installed.
if isLock {
continue
}
filepath, isLock, err := ChooseJsonnetFile(destPath) filepath, isLock, err := ChooseJsonnetFile(destPath)
if err != nil { if err != nil {
return nil, err return nil, err