Skip to content

Commit 5b866f1

Browse files
committed
More clean up
1 parent bcb3460 commit 5b866f1

2 files changed

Lines changed: 3 additions & 59 deletions

File tree

src/code/FindHelper.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,6 @@ private IEnumerable<PSResourceInfo> SearchByNames(ServerApiCall currentServer, R
831831
if (_tag.Length == 0)
832832
{
833833
responses = currentServer.FindName(pkgName, _prerelease, _type, out errRecord);
834-
_cmdletPassedIn.WriteDebug($"returned back to SearchByName() 834");
835-
836834
}
837835
else
838836
{
@@ -1068,7 +1066,6 @@ private IEnumerable<PSResourceInfo> SearchByNames(ServerApiCall currentServer, R
10681066
{
10691067
foreach (PSResourceInfo currentPkg in parentPkgs)
10701068
{
1071-
_cmdletPassedIn.WriteDebug($"Finding dependency packages (SearchByNames) for '{currentPkg.Name}'");
10721069
foreach (PSResourceInfo pkgDep in FindDependencyPackages(currentServer, currentResponseUtil, currentPkg, repository))
10731070
{
10741071
yield return pkgDep;
@@ -1447,6 +1444,6 @@ private PSResourceInfo FindDependencyWithUpperBound(Dependency dep, ServerApiCal
14471444
return depPkg;
14481445
}
14491446

1450-
#endregion
1447+
#endregion
14511448
}
14521449
}

src/code/InstallHelper.cs

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,11 @@ private List<PSResourceInfo> ProcessRepositories(
342342

343343
repositoryNamesToSearch.Add(repoName);
344344

345-
_cmdletPassedIn.WriteVerbose("InstallHelper line 345");
346345
List<PSResourceInfo> installedPkgs = InstallPackages(_pkgNamesToInstall.ToArray(), currentRepository, currentServer, currentResponseUtil, scope, skipDependencyCheck, findHelper);
347346
foreach (PSResourceInfo pkg in installedPkgs)
348347
{
349348
_pkgNamesToInstall.RemoveAll(x => x.Equals(pkg.Name, StringComparison.InvariantCultureIgnoreCase));
350349
}
351-
_cmdletPassedIn.WriteVerbose("InstallHelper line 351");
352350

353351
allPkgsInstalled.AddRange(installedPkgs);
354352
}
@@ -362,7 +360,6 @@ private List<PSResourceInfo> ProcessRepositories(
362360
ErrorCategory.InvalidData,
363361
_cmdletPassedIn));
364362
}
365-
_cmdletPassedIn.WriteVerbose("InstallHelper line 365");
366363

367364
return allPkgsInstalled;
368365
}
@@ -756,16 +753,13 @@ private ConcurrentDictionary<string, Hashtable> BeginPackageInstall(
756753
pkgVersion += $"-{pkgToInstall.Prerelease}";
757754
}
758755
}
759-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - line 748");
760756

761757
// For most repositories/providers the server will use the normalized version, which pkgVersion originally reflects
762758
// However, for container registries the version must exactly match what was in the artifact manifest and then reflected in PSResourceInfo.Version.ToString()
763759
if (currentServer.Repository.ApiVersion == PSRepositoryInfo.APIVersion.ContainerRegistry)
764760
{
765761
pkgVersion = String.IsNullOrEmpty(pkgToInstall.Prerelease) ? pkgToInstall.Version.ToString() : $"{pkgToInstall.Version.ToString()}-{pkgToInstall.Prerelease}";
766762
}
767-
768-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - line 757");
769763

770764
// Check to see if the pkg is already installed (ie the pkg is installed and the version satisfies the version range provided via param)
771765
// TODO: can use cache for this
@@ -791,47 +785,6 @@ private ConcurrentDictionary<string, Hashtable> BeginPackageInstall(
791785

792786

793787
ConcurrentDictionary<string, Hashtable> updatedPackagesHash = packagesHash;
794-
795-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - line 784");
796-
797-
if (!_savePkg)
798-
{
799-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - line 788");
800-
801-
}
802-
else
803-
{
804-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - line 793");
805-
}
806-
807-
if (pkgToInstall == null)
808-
{
809-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - packageToInstall is null 798");
810-
}
811-
else
812-
{
813-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - packageToInstall is not null 802");
814-
}
815-
816-
817-
if (string.IsNullOrEmpty(pkgToInstall.Name))
818-
{
819-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() -pkgtoinstall name is null or empty 808");
820-
}
821-
else
822-
{
823-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - pkgtoinstall is available 812 ");
824-
}
825-
826-
827-
if (string.IsNullOrEmpty(pkgVersion))
828-
{
829-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() -pkgVersion name is null or empty 818");
830-
}
831-
else
832-
{
833-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - pkgVersion is available 822 ");
834-
}
835788

836789
// -WhatIf processing.
837790
// if (_savePkg && !_cmdletPassedIn.ShouldProcess($"Package to save: '{pkgToInstall.Name}', version: '{pkgVersion}'"))
@@ -875,12 +828,10 @@ private ConcurrentDictionary<string, Hashtable> BeginPackageInstall(
875828
// }
876829
//else
877830
//{
878-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - line 821");
879-
// Concurrent updates
831+
// Concurrent updates, currently only implemented for v2 server repositories
880832
// Find all dependencies
881-
if (!skipDependencyCheck)
833+
if (!skipDependencyCheck && currentServer.Repository.ApiVersion == PSRepositoryInfo.APIVersion.V2)
882834
{
883-
_cmdletPassedIn.WriteDebug($"BeginPackageInstall() - line 826");
884835
// concurrency updates
885836
List<PSResourceInfo> parentAndDeps = _findHelper.FindDependencyPackages(currentServer, currentResponseUtil, pkgToInstall, repository).ToList();
886837
// List returned only includes dependencies, so we'll add the parent pkg to this list to pass on to installation method
@@ -895,15 +846,11 @@ private ConcurrentDictionary<string, Hashtable> BeginPackageInstall(
895846
// TODO: check this version and prerelease combo
896847
Stream responseStream = currentServer.InstallPackage(pkgToInstall.Name, pkgToInstall.Version.ToString(), true, out ErrorRecord installNameErrRecord);
897848

898-
_cmdletPassedIn.WriteDebug("In BeginInstallPackage 898");
899-
900849
if (installNameErrRecord != null)
901850
{
902-
_cmdletPassedIn.WriteDebug("In BeginInstallPackage 902");
903851
errRecord = installNameErrRecord;
904852
return packagesHash;
905853
}
906-
_cmdletPassedIn.WriteDebug("In BeginInstallPackage 905");
907854
bool installedToTempPathSuccessfully = _asNupkg ? TrySaveNupkgToTempPath(responseStream, tempInstallPath, pkgToInstall.Name, pkgToInstall.Version.ToString(), pkgToInstall, packagesHash, out updatedPackagesHash, out errRecord) :
908855
TryInstallToTempPath(responseStream, tempInstallPath, pkgToInstall.Name, pkgToInstall.Version.ToString(), pkgToInstall, packagesHash, out updatedPackagesHash, out warning, out errRecord);
909856
if (!installedToTempPathSuccessfully)

0 commit comments

Comments
 (0)