Fixed issue where dependency conflicts are thrown even when --reinstall
is used
This commit is contained in:
parent
4dfcb43b20
commit
070ad4caca
3 changed files with 28 additions and 11 deletions
|
@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Bug fix where resources are not decoded correctly when installing packages [#31](https://git.n64.cc/nosial/ncc/-/issues/42)
|
- Bug fix where resources are not decoded correctly when installing packages [#31](https://git.n64.cc/nosial/ncc/-/issues/42)
|
||||||
|
- Fixed issue where dependency conflicts are thrown even when `--reinstall` is used
|
||||||
|
|
||||||
## [1.0.0] - 2022-01-29
|
## [1.0.0] - 2022-01-29
|
||||||
|
|
||||||
|
|
|
@ -428,7 +428,7 @@ namespace ncc\CLI\Management;
|
||||||
Console::out(' Trademark: ' . Console::formatColor($package->Assembly->Trademark, ConsoleColors::LightGreen));
|
Console::out(' Trademark: ' . Console::formatColor($package->Assembly->Trademark, ConsoleColors::LightGreen));
|
||||||
Console::out((string)null);
|
Console::out((string)null);
|
||||||
|
|
||||||
if(count($package->Dependencies) > 0 && !in_array(InstallPackageOptions::Reinstall, $installer_options))
|
if(count($package->Dependencies) > 0)
|
||||||
{
|
{
|
||||||
$dependencies = [];
|
$dependencies = [];
|
||||||
foreach($package->Dependencies as $dependency)
|
foreach($package->Dependencies as $dependency)
|
||||||
|
@ -497,8 +497,6 @@ namespace ncc\CLI\Management;
|
||||||
if(!$user_confirmation)
|
if(!$user_confirmation)
|
||||||
$user_confirmation = Console::getBooleanInput(sprintf('Do you want to install %s', $package->Assembly->Package));
|
$user_confirmation = Console::getBooleanInput(sprintf('Do you want to install %s', $package->Assembly->Package));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($user_confirmation)
|
if($user_confirmation)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
use ncc\Utilities\IO;
|
use ncc\Utilities\IO;
|
||||||
use ncc\Utilities\PathFinder;
|
use ncc\Utilities\PathFinder;
|
||||||
use ncc\Utilities\Resolver;
|
use ncc\Utilities\Resolver;
|
||||||
|
use ncc\Utilities\RuntimeCache;
|
||||||
use ncc\Utilities\Validate;
|
use ncc\Utilities\Validate;
|
||||||
use ncc\ZiProto\ZiProto;
|
use ncc\ZiProto\ZiProto;
|
||||||
use SplFileInfo;
|
use SplFileInfo;
|
||||||
|
@ -133,6 +134,12 @@
|
||||||
|
|
||||||
$package = Package::load($package_path);
|
$package = Package::load($package_path);
|
||||||
|
|
||||||
|
if(RuntimeCache::get(sprintf('installed.%s=%s', $package->Assembly->Package, $package->Assembly->Version)))
|
||||||
|
{
|
||||||
|
Console::outDebug(sprintf('skipping installation of %s=%s, already processed', $package->Assembly->Package, $package->Assembly->Version));
|
||||||
|
return $package->Assembly->Package;
|
||||||
|
}
|
||||||
|
|
||||||
$extension = $package->Header->CompilerExtension->Extension;
|
$extension = $package->Header->CompilerExtension->Extension;
|
||||||
$installation_paths = new InstallationPaths($this->PackagesPath . DIRECTORY_SEPARATOR . $package->Assembly->Package . '=' . $package->Assembly->Version);
|
$installation_paths = new InstallationPaths($this->PackagesPath . DIRECTORY_SEPARATOR . $package->Assembly->Package . '=' . $package->Assembly->Version);
|
||||||
|
|
||||||
|
@ -187,7 +194,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->processDependency($dependency, $package, $package_path, $entry);
|
$this->processDependency($dependency, $package, $package_path, $entry, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,6 +413,8 @@
|
||||||
$this->getPackageLockManager()->getPackageLock()->addPackage($package, $installation_paths->getInstallationPath());
|
$this->getPackageLockManager()->getPackageLock()->addPackage($package, $installation_paths->getInstallationPath());
|
||||||
$this->getPackageLockManager()->save();
|
$this->getPackageLockManager()->save();
|
||||||
|
|
||||||
|
RuntimeCache::set(sprintf('installed.%s=%s', $package->Assembly->Package, $package->Assembly->Version), true);
|
||||||
|
|
||||||
return $package->Assembly->Package;
|
return $package->Assembly->Package;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,16 +576,17 @@
|
||||||
*
|
*
|
||||||
* @param string $source
|
* @param string $source
|
||||||
* @param Entry|null $entry
|
* @param Entry|null $entry
|
||||||
|
* @param array $options
|
||||||
* @return string
|
* @return string
|
||||||
* @throws InstallationException
|
* @throws InstallationException
|
||||||
*/
|
*/
|
||||||
public function installFromSource(string $source, ?Entry $entry): string
|
public function installFromSource(string $source, ?Entry $entry, array $options=[]): string
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console::outVerbose(sprintf('Installing package from source %s', $source));
|
Console::outVerbose(sprintf('Installing package from source %s', $source));
|
||||||
$package = $this->fetchFromSource($source, $entry);
|
$package = $this->fetchFromSource($source, $entry);
|
||||||
return $this->install($package, $entry);
|
return $this->install($package, $entry, $options);
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
@ -589,6 +599,7 @@
|
||||||
* @param Package $package
|
* @param Package $package
|
||||||
* @param string $package_path
|
* @param string $package_path
|
||||||
* @param Entry|null $entry
|
* @param Entry|null $entry
|
||||||
|
* @param array $options
|
||||||
* @return void
|
* @return void
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
* @throws FileNotFoundException
|
* @throws FileNotFoundException
|
||||||
|
@ -602,13 +613,19 @@
|
||||||
* @throws PackageLockException
|
* @throws PackageLockException
|
||||||
* @throws PackageNotFoundException
|
* @throws PackageNotFoundException
|
||||||
* @throws PackageParsingException
|
* @throws PackageParsingException
|
||||||
|
* @throws RunnerExecutionException
|
||||||
* @throws SymlinkException
|
* @throws SymlinkException
|
||||||
* @throws UnsupportedCompilerExtensionException
|
* @throws UnsupportedCompilerExtensionException
|
||||||
* @throws VersionNotFoundException
|
* @throws VersionNotFoundException
|
||||||
* @throws RunnerExecutionException
|
|
||||||
*/
|
*/
|
||||||
private function processDependency(Dependency $dependency, Package $package, string $package_path, ?Entry $entry=null): void
|
private function processDependency(Dependency $dependency, Package $package, string $package_path, ?Entry $entry=null, array $options=[]): void
|
||||||
{
|
{
|
||||||
|
if(RuntimeCache::get(sprintf('depndency_installed.%s=%s', $dependency->Name, $dependency->Version ?? 'null')))
|
||||||
|
{
|
||||||
|
Console::outDebug(sprintf('dependency %s=%s already processed, skipping', $dependency->Name, $dependency->Version ?? 'null'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Console::outVerbose('processing dependency ' . $dependency->Name . ' (' . $dependency->Version . ')');
|
Console::outVerbose('processing dependency ' . $dependency->Name . ' (' . $dependency->Version . ')');
|
||||||
$dependent_package = $this->getPackage($dependency->Name);
|
$dependent_package = $this->getPackage($dependency->Name);
|
||||||
$dependency_met = false;
|
$dependency_met = false;
|
||||||
|
@ -638,7 +655,8 @@
|
||||||
$basedir = dirname($package_path);
|
$basedir = dirname($package_path);
|
||||||
if (!file_exists($basedir . DIRECTORY_SEPARATOR . $dependency->Source))
|
if (!file_exists($basedir . DIRECTORY_SEPARATOR . $dependency->Source))
|
||||||
throw new FileNotFoundException($basedir . DIRECTORY_SEPARATOR . $dependency->Source);
|
throw new FileNotFoundException($basedir . DIRECTORY_SEPARATOR . $dependency->Source);
|
||||||
$this->install($basedir . DIRECTORY_SEPARATOR . $dependency->Source);
|
$this->install($basedir . DIRECTORY_SEPARATOR . $dependency->Source, null, $options);
|
||||||
|
RuntimeCache::set(sprintf('dependency_installed.%s=%s', $dependency->Name, $dependency->Version), true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DependencySourceType::StaticLinking:
|
case DependencySourceType::StaticLinking:
|
||||||
|
@ -646,7 +664,8 @@
|
||||||
|
|
||||||
case DependencySourceType::RemoteSource:
|
case DependencySourceType::RemoteSource:
|
||||||
Console::outDebug('installing from remote source ' . $dependency->Source);
|
Console::outDebug('installing from remote source ' . $dependency->Source);
|
||||||
$this->installFromSource($dependency->Source, $entry);
|
$this->installFromSource($dependency->Source, $entry, $options);
|
||||||
|
RuntimeCache::set(sprintf('dependency_installed.%s=%s', $dependency->Name, $dependency->Version), true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue