|
@@ -134,16 +134,40 @@ public class System : Object {
|
|
|
}
|
|
}
|
|
|
Log.info(@"$(missing.length) dependency ref(s) of \"$(manifest.name)\" missing");
|
|
Log.info(@"$(missing.length) dependency ref(s) of \"$(manifest.name)\" missing");
|
|
|
|
|
|
|
|
- var spm = load_system_package_manager();
|
|
|
|
|
|
|
+ // The enrolled state drives BOTH legs: the system package
|
|
|
|
|
+ // manager configuration AND the repository listings the
|
|
|
|
|
+ // resolver resolves USM packages against. A bare resolver
|
|
|
|
|
+ // sees no USM packages at all — every repository-provided ref
|
|
|
|
|
+ // would fail as "no USM package provides it" — so the
|
|
|
|
|
+ // listings and cache are loaded exactly like `usm install`
|
|
|
|
|
+ // loads them.
|
|
|
|
|
+ var paths = new Usm.Paths();
|
|
|
|
|
+ Usm.SystemState? system_state = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ system_state = new Usm.SystemState(paths);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch(Error e) {
|
|
|
|
|
+ Log.warning(@"Could not read the usm managed state, continuing without USM repositories: $(e.message)");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Usm.SystemPackageManager? active_spm = null;
|
|
Usm.SystemPackageManager? active_spm = null;
|
|
|
- if(spm != null && spm.enabled) {
|
|
|
|
|
- active_spm = spm;
|
|
|
|
|
|
|
+ if(system_state != null) {
|
|
|
|
|
+ var manager = new Usm.SystemPackageManager(((!)system_state).config);
|
|
|
|
|
+ if(manager.enabled) {
|
|
|
|
|
+ active_spm = manager;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- else {
|
|
|
|
|
|
|
+ if(active_spm == null) {
|
|
|
Log.warning("No system package manager is configured; resolving missing dependencies from USM repositories alone");
|
|
Log.warning("No system package manager is configured; resolving missing dependencies from USM repositories alone");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var resolver = new Usm.Resolver(new Usm.ResourceFinder());
|
|
var resolver = new Usm.Resolver(new Usm.ResourceFinder());
|
|
|
|
|
+ if(system_state != null) {
|
|
|
|
|
+ var loaded = resolver.load_state((!)system_state, paths, (repository_name, message) => {
|
|
|
|
|
+ Log.warning(@"Could not refresh USM repository \"$repository_name\": $message");
|
|
|
|
|
+ });
|
|
|
|
|
+ Log.info(@"Resolver catalog loaded ($loaded repository listing(s))");
|
|
|
|
|
+ }
|
|
|
Usm.ResolutionResult resolution;
|
|
Usm.ResolutionResult resolution;
|
|
|
try {
|
|
try {
|
|
|
resolution = resolver.resolve_manifest(manifest, active_spm);
|
|
resolution = resolver.resolve_manifest(manifest, active_spm);
|
|
@@ -180,7 +204,7 @@ public class System : Object {
|
|
|
Log.info(@"Installing system packages: $(string.joinv(" ", Argv.from_vector(spm_names)))");
|
|
Log.info(@"Installing system packages: $(string.joinv(" ", Argv.from_vector(spm_names)))");
|
|
|
var system_installed = false;
|
|
var system_installed = false;
|
|
|
try {
|
|
try {
|
|
|
- system_installed = yield spm.install(spm_names, event => log_install_progress(event));
|
|
|
|
|
|
|
+ system_installed = yield ((!)active_spm).install(spm_names, event => log_install_progress(event));
|
|
|
}
|
|
}
|
|
|
catch(Error e) {
|
|
catch(Error e) {
|
|
|
throw new RadError.DEPLOY(@"Could not run the system package manager install: $(e.message)");
|
|
throw new RadError.DEPLOY(@"Could not run the system package manager install: $(e.message)");
|
|
@@ -295,16 +319,6 @@ public class System : Object {
|
|
|
* the configuration cannot be read — dependency resolution then runs
|
|
* the configuration cannot be read — dependency resolution then runs
|
|
|
* against USM repositories alone.
|
|
* against USM repositories alone.
|
|
|
*/
|
|
*/
|
|
|
- private static Usm.SystemPackageManager? load_system_package_manager() {
|
|
|
|
|
- try {
|
|
|
|
|
- return new Usm.SystemPackageManager(new Usm.Configuration.from_paths(new Usm.Paths()));
|
|
|
|
|
- }
|
|
|
|
|
- catch(Error e) {
|
|
|
|
|
- Log.warning(@"Could not read the usm configuration, continuing without a system package manager: $(e.message)");
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* One line per streamed system package install event; the per-package
|
|
* One line per streamed system package install event; the per-package
|
|
|
* progress fraction events stay unlogged to keep the supervisor's
|
|
* progress fraction events stay unlogged to keep the supervisor's
|