From e1a02fdcfe0789e682c63ce055b98ee6f5961fa3 Mon Sep 17 00:00:00 2001 From: memo Date: Thu, 16 May 2024 20:27:23 +0200 Subject: [PATCH] fix persisting of variant selection if everything else is up-to-date --- CHANGELOG.md | 1 + src/main/scala/sc4pac/Sc4pac.scala | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cacf271..cd3a826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The error handling for syntactically invalid YAML files is more graceful now, as well. - The dates in the `lastModified` field are now more lenient in terms of surrounding whitespace. - an issue in which incomplete variant definitions were not detected +- a rare bug in which the variant selection was not stored if all packages were up-to-date ## [0.4.2] - 2024-04-18 diff --git a/src/main/scala/sc4pac/Sc4pac.scala b/src/main/scala/sc4pac/Sc4pac.scala index 1acdc9a..fc782cc 100644 --- a/src/main/scala/sc4pac/Sc4pac.scala +++ b/src/main/scala/sc4pac/Sc4pac.scala @@ -424,8 +424,8 @@ trait UpdateService { this: Sc4pac => plan = UpdatePlan.fromResolution(resolution, installed = pluginsLockData.dependenciesWithAssets) continue <- ZIO.serviceWithZIO[Prompter](_.confirmUpdatePlan(plan)) .filterOrFail(_ == true)(error.Sc4pacAbort()) - flagOpt <- ZIO.unless(plan.isUpToDate || !continue)(for { - _ <- ZIO.unless(globalVariant == globalVariant0)(storeGlobalVariant(globalVariant)) // only store something after confirmation + _ <- ZIO.unless(!continue || globalVariant == globalVariant0)(storeGlobalVariant(globalVariant)) // only store something after confirmation + flagOpt <- ZIO.unless(!continue || plan.isUpToDate)(for { assetsToInstall <- resolution.fetchArtifactsOf(resolution.transitiveDependencies.filter(plan.toInstall).reverse) // we start by fetching artifacts in reverse as those have fewest dependencies of their own // TODO if some artifacts fail to be fetched, fall back to installing remaining packages (maybe not(?), as this leads to missing dependencies, // but there needs to be a manual workaround in case of permanently missing artifacts)