From 086d95926dd1d9ddc9d080107481f1ee8148c033 Mon Sep 17 00:00:00 2001 From: Frederic Branczyk Date: Thu, 2 Aug 2018 08:47:43 +0200 Subject: [PATCH] pkg: Correctly move locked dependencies --- pkg/packages.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pkg/packages.go b/pkg/packages.go index dcb248c..25e8464 100644 --- a/pkg/packages.go +++ b/pkg/packages.go @@ -59,23 +59,6 @@ func Install(ctx context.Context, isLock bool, dependencySourceIdentifier string 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) if err != nil { 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") } + 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) if err != nil { return nil, err