From 2e26ea3354f139a3de82c795c886ee48485b2533 Mon Sep 17 00:00:00 2001 From: Egor Pugin Date: Wed, 20 Dec 2023 18:36:03 +0300 Subject: [PATCH] [service] Update. --- src/sw/client/common/cl.yml | 8 ++++++++ src/sw/client/common/command/service.cpp | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/sw/client/common/cl.yml b/src/sw/client/common/cl.yml index d95e6e5a..8f19c29c 100644 --- a/src/sw/client/common/cl.yml +++ b/src/sw/client/common/cl.yml @@ -964,3 +964,11 @@ command_line: type: String positional: true desc: service subcommand + run: + type: bool + desc: run upgrade commands immediately + args: + list: true + type: String + positional: true + desc: sw service arguments diff --git a/src/sw/client/common/command/service.cpp b/src/sw/client/common/command/service.cpp index 1e2c56d7..8fc8e840 100644 --- a/src/sw/client/common/command/service.cpp +++ b/src/sw/client/common/command/service.cpp @@ -30,7 +30,11 @@ void update_packages(SwClientContext &swctx) { auto &s = *swctx.getContext().getRemoteStorages().at(0); auto &rs = dynamic_cast(s); auto &pdb = rs.getPackagesDatabase(); - auto all_pkgs = pdb.getMatchingPackages("org.sw.demo."); + String prefix = "org.sw.demo."; + if (!swctx.getOptions().options_service.args.empty()) { + prefix = swctx.getOptions().options_service.args[0]; + } + auto all_pkgs = pdb.getMatchingPackages(prefix); for (int pkgid = 0; auto &&ppath : all_pkgs) { LOG_INFO(logger, "[" << ++pkgid << "/" << all_pkgs.size() << "] " << ppath.toString()); auto versions = pdb.getVersionsForPackage(ppath); @@ -207,7 +211,7 @@ void update_packages(SwClientContext &swctx) { "org.sw.demo.kcat.tools.bsincgen-1.20.1", "org.sw.demo.malaterre.GDCM.uuid-3.0.22", "org.sw.demo.ocornut.imgui.backend.marmalade-1.85.0", - "org.sw.demo.openexr.IlmImf-2.5.8", + "org.sw.demo.openexr.IlmImf-2.5.", "org.sw.demo.qtproject.qt.base.entrypoint-6.3.0", "org.sw.demo.qtproject.qt.declarative.tools.shared-5.15.0.1", "org.sw.demo.qtproject.qt.labs.vstools.natvis-3.0.1", @@ -226,6 +230,16 @@ void update_packages(SwClientContext &swctx) { auto &&v = vp.first; auto &&prefix = vp.second; LOG_INFO(logger, "sw uri --silent sw:upload " << pkg << " " << v.toString() << " " << prefix); + + if (swctx.getOptions().options_service.run) { + primitives::Command c; + c.arguments = {"sw", "uri", "--silent", "sw:upload", pkg, v.toString(), std::to_string(prefix)}; + c.out.inherit = true; + c.err.inherit = true; + std::error_code ec; + c.execute(ec); + LOG_INFO(logger, ""); + } } }