Use new argument parser API
This commit is contained in:
parent
9bb47d37f8
commit
bb943cb21b
|
@ -8,7 +8,9 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
|||
set(META_APP_DESCRIPTION "Repository browser for Arch Linux")
|
||||
set(META_VERSION_MAJOR 0)
|
||||
set(META_VERSION_MINOR 2)
|
||||
set(META_VERSION_PATCH 2)
|
||||
set(META_VERSION_PATCH 3)
|
||||
|
||||
project(${META_PROJECT_NAME})
|
||||
|
||||
# add subdirectories
|
||||
add_subdirectory(web)
|
||||
|
|
|
@ -26,12 +26,12 @@ include(WindowsResources)
|
|||
include(AppTarget)
|
||||
|
||||
# add installs for service and config files
|
||||
install(FILES resources/systemd/${META_PROJECT_NAME}.service
|
||||
install(FILES ../resources/systemd/${META_PROJECT_NAME}.service
|
||||
DESTINATION lib/systemd/system
|
||||
COMPONENT service
|
||||
)
|
||||
|
||||
install(FILES resources/settings/${META_PROJECT_NAME}.conf.js
|
||||
install(FILES ../resources/settings/${META_PROJECT_NAME}.conf.js
|
||||
DESTINATION share/${META_PROJECT_NAME}/skel
|
||||
COMPONENT config
|
||||
)
|
||||
|
|
|
@ -70,10 +70,10 @@ int main(int argc, char *argv[])
|
|||
QObject::connect(&server, &Server::closed, &application, &QCoreApplication::quit);
|
||||
return application.exec();
|
||||
} else if(configArgs.buildOrderArg.isPresent()) {
|
||||
BuildOrderResolverCli resolver(manager, configArgs.buildOrderArg.values(), configArgs.addSourceOnlyDepsArg.isPresent(), configArgs.requireSourcesArg.isPresent());
|
||||
BuildOrderResolverCli resolver(manager, configArgs.packagesArg.values(), configArgs.addSourceOnlyDepsArg.isPresent(), configArgs.requireSourcesArg.isPresent());
|
||||
return resolver.exec();
|
||||
} else if(configArgs.mingwBundleArg.isPresent()) {
|
||||
MingwBundle bundle(manager, configArgs.mingwBundleArg.values(), configArgs.iconThemesArg.values(), configArgs.extraPackagesArg.values(), configArgs.qtPluginsArg.values());
|
||||
MingwBundle bundle(manager, configArgs.packagesArg.values(), configArgs.iconThemesArg.values(), configArgs.extraPackagesArg.values(), configArgs.qtPluginsArg.values());
|
||||
bundle.createBundle(configArgs.targetDirArg.isPresent() ? configArgs.targetDirArg.values().front() : string("."),
|
||||
configArgs.targetNameArg.values().front(),
|
||||
configArgs.targetFormatArg.isPresent() ? configArgs.targetFormatArg.values().front() : string("zip"),
|
||||
|
|
|
@ -13,7 +13,7 @@ set(WIDGETS_SRC_FILES
|
|||
)
|
||||
|
||||
set(ICON_FILES
|
||||
resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
|
||||
../resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
|
||||
)
|
||||
|
||||
# find c++utilities
|
||||
|
|
|
@ -32,12 +32,12 @@ int main(int argc, char *argv[])
|
|||
QT_CONFIG_ARGUMENTS qtConfigArgs;
|
||||
ConfigArgs configArgs(parser);
|
||||
parser.setIgnoreUnknownArguments(false);
|
||||
Argument webdirArg("web-dir", string(), "specifies the directory of the web files");
|
||||
Argument webdirArg("web-dir", '\0', "specifies the directory of the web files");
|
||||
webdirArg.setCombinable(true);
|
||||
webdirArg.setRequiredValueCount(1);
|
||||
webdirArg.setValueNames({"path"});
|
||||
for(Argument *arg : initializer_list<Argument *>{&configArgs.rootdirArg, &configArgs.dbpathArg, &configArgs.pacmanConfArg, &configArgs.reposFromPacmanConfEnabled, &configArgs.aurArg}) {
|
||||
qtConfigArgs.qtWidgetsGuiArg().addSecondaryArgument(arg);
|
||||
qtConfigArgs.qtWidgetsGuiArg().addSubArgument(arg);
|
||||
}
|
||||
parser.setMainArguments({&qtConfigArgs.qtWidgetsGuiArg(), &configArgs.repoindexConfArg, &configArgs.repoindexConfArg, &webdirArg, &configArgs.cacheDirArg, &configArgs.storageDirArg, &configArgs.helpArg});
|
||||
// parse command line arguments
|
||||
|
@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
|||
// find directory with web files
|
||||
QString webdir;
|
||||
if(webdirArg.isPresent()) {
|
||||
webdir = QString::fromLocal8Bit(webdirArg.values().front().data());
|
||||
webdir = QString::fromLocal8Bit(webdirArg.values().front());
|
||||
} else {
|
||||
webdir = QStringLiteral("/usr/share/" PROJECT_NAME "/web");
|
||||
}
|
||||
|
|
|
@ -52,6 +52,10 @@ list(APPEND ADDITIONAL_KF_MODULES Archive)
|
|||
find_package(c++utilities 3.3.0 REQUIRED)
|
||||
use_cpp_utilities()
|
||||
|
||||
# find qtutilities
|
||||
find_package(qtutilities 4.0.0 REQUIRED)
|
||||
use_qt_utilities()
|
||||
|
||||
# prefix the target to avoid conflict with cli target
|
||||
set(TARGET_PREFIX "lib")
|
||||
|
||||
|
|
|
@ -31,50 +31,53 @@ const char *shchar = "";
|
|||
*/
|
||||
ConfigArgs::ConfigArgs(ArgumentParser &parser) :
|
||||
helpArg(parser),
|
||||
buildOrderArg("build-order", "b", "calculates the build order to build the specified packages"),
|
||||
addSourceOnlyDepsArg("add-src-only-deps", "a", "adds source-only dependencies to build chain"),
|
||||
requireSourcesArg("require-sources", "q", "requires specified packages to be from a source repository"),
|
||||
serverArg("server", "s", "runs a websocket server providing the web interface with information"),
|
||||
upgradeLookupArg("upgrade-lookup", "u", "checks available upgrades for the specified repository"),
|
||||
mingwBundleArg("mingw-w64-bundle", "m", "creates an archive with the runtime-relevant files from the specified mingw-w64-packages and their dependencies"),
|
||||
repoindexConfArg("repoindex-conf", "c", "specifies the path of the repo index config file (default is /etc/repoindex.conf"),
|
||||
rootdirArg("root-dir", "r", "specifies the root directory (default is /)"),
|
||||
dbpathArg("db-path", "d", "specifies the pacman database path (default is /var/lib/pacman)"),
|
||||
pacmanConfArg("pacman-conf", "p", "specifies the path of the pacman config file (default is /etc/pacman.conf"),
|
||||
reposFromPacmanConfEnabled("repos-from-pacman-conf", string(), "enables repositories from the pacman config file"),
|
||||
websocketAddrArg("addr", string(), "specifies the listening address for the websocket server, default is 127.0.0.1"),
|
||||
websocketPortArg("port", string(), "specifies the listening port for the websocket server, default is 1234"),
|
||||
certFileArg("cert-file", string(), "specifies the SSL certificate"),
|
||||
keyFileArg("key-file", string(), "specifies the private SSL key"),
|
||||
insecureArg("insecure", string(), "forces the server to run in insecure mode"),
|
||||
aurArg("aur", string(), "enables/disables AUR queries"),
|
||||
verboseArg("verbose", "v", "be verbose"),
|
||||
outputFileArg("output-file", "f", "specifies the output file"),
|
||||
targetDirArg("target-dir", "t", "the directory to store the target archive"),
|
||||
targetNameArg("target-name", "n", "specifies the name of the target archive"),
|
||||
targetFormatArg("target-format", "e", "specifies the format of the target archive"),
|
||||
iconThemesArg("icon-packages", "i", "specifies the names of the icon packages to include"),
|
||||
defaultIconThemeArg("default-icon-theme", string(), "specifies the name of the default icon theme (should be included in --icon-packages)"),
|
||||
extraPackagesArg("extra-packages", string(), "specifies extra packages to be included"),
|
||||
qtPluginsArg("qt-plugins", string(), "specifies which Qt plugins to be included"),
|
||||
cacheDirArg("cache-dir", string(), "specifies the cache directory (default is /var/cache/repoindex)"),
|
||||
storageDirArg("storage-dir", string(), "specifies the storage directory (default is /var/lib/repoindex)"),
|
||||
shSyntaxArg("sh-syntax", string(), "prints the output using shell syntax: export REPOINDEX_RESULTS=('res1' 'res2' 'res3') or export REPOINDEX_ERROR='some error message'"),
|
||||
repoArg("repo", string(), "specifies the repository")
|
||||
packagesArg("packages", 'p', "specifies the packages"),
|
||||
buildOrderArg("build-order", 'b', "calculates the build order to build the specified packages"),
|
||||
addSourceOnlyDepsArg("add-src-only-deps", 'a', "adds source-only dependencies to build chain"),
|
||||
requireSourcesArg("require-sources", 'q', "requires specified packages to be from a source repository"),
|
||||
serverArg("server", 's', "runs a websocket server providing the web interface with information"),
|
||||
repoNameArg("repo", 'r', "specifies the repository"),
|
||||
upgradeLookupArg("upgrade-lookup", 'u', "checks available upgrades for the specified repository"),
|
||||
mingwBundleArg("mingw-w64-bundle", 'm', "creates an archive with the runtime-relevant files from the specified mingw-w64-packages and their dependencies"),
|
||||
repoindexConfArg("repoindex-conf", 'c', "specifies the path of the repo index config file (default is /etc/repoindex.conf"),
|
||||
rootdirArg("root-dir", 'r', "specifies the root directory (default is /)"),
|
||||
dbpathArg("db-path", 'd', "specifies the pacman database path (default is /var/lib/pacman)"),
|
||||
pacmanConfArg("pacman-conf", 'p', "specifies the path of the pacman config file (default is /etc/pacman.conf"),
|
||||
reposFromPacmanConfEnabled("repos-from-pacman-conf", '\0', "enables repositories from the pacman config file"),
|
||||
websocketAddrArg("addr", '\0', "specifies the listening address for the websocket server, default is 127.0.0.1"),
|
||||
websocketPortArg("port", '\0', "specifies the listening port for the websocket server, default is 1234"),
|
||||
certFileArg("cert-file", '\0', "specifies the SSL certificate"),
|
||||
keyFileArg("key-file", '\0', "specifies the private SSL key"),
|
||||
insecureArg("insecure", '\0', "forces the server to run in insecure mode"),
|
||||
aurArg("aur", '\0', "enables/disables AUR queries"),
|
||||
verboseArg("verbose", 'v', "be verbose"),
|
||||
outputFileArg("output-file", 'f', "specifies the output file"),
|
||||
targetDirArg("target-dir", 't', "the directory to store the target archive"),
|
||||
targetNameArg("target-name", 'n', "specifies the name of the target archive"),
|
||||
targetFormatArg("target-format", 'e', "specifies the format of the target archive"),
|
||||
iconThemesArg("icon-packages", 'i', "specifies the names of the icon packages to include"),
|
||||
defaultIconThemeArg("default-icon-theme", '\0', "specifies the name of the default icon theme (should be included in --icon-packages)"),
|
||||
extraPackagesArg("extra-packages", '\0', "specifies extra packages to be included"),
|
||||
qtPluginsArg("qt-plugins", '\0', "specifies which Qt plugins to be included"),
|
||||
cacheDirArg("cache-dir", '\0', "specifies the cache directory (default is /var/cache/repoindex)"),
|
||||
storageDirArg("storage-dir", '\0', "specifies the storage directory (default is /var/lib/repoindex)"),
|
||||
shSyntaxArg("sh-syntax", '\0', "prints the output using shell syntax: export REPOINDEX_RESULTS=('res1' 'res2' 'res3') or export REPOINDEX_ERROR='some error message'")
|
||||
{
|
||||
const initializer_list<string> pathValueName = {"path"};
|
||||
const initializer_list<string> pkgValueNames = {"package 1", "package 2", "package 3"};
|
||||
const initializer_list<const char *> pathValueName = {"path"};
|
||||
const initializer_list<const char *> pkgValueNames = {"package 1", "package 2", "package 3"};
|
||||
packagesArg.setRequiredValueCount(-1);
|
||||
packagesArg.setRequired(true);
|
||||
packagesArg.setImplicit(true);
|
||||
packagesArg.setValueNames(pkgValueNames);
|
||||
buildOrderArg.setDenotesOperation(true);
|
||||
buildOrderArg.setRequiredValueCount(-1);
|
||||
buildOrderArg.setValueNames(pkgValueNames);
|
||||
requireSourcesArg.setCombinable(true);
|
||||
serverArg.setDenotesOperation(true);
|
||||
repoNameArg.setRequiredValueCount(1);
|
||||
repoNameArg.setRequired(true);
|
||||
repoNameArg.setImplicit(true);
|
||||
repoNameArg.setValueNames({"repo"});
|
||||
upgradeLookupArg.setDenotesOperation(true);
|
||||
upgradeLookupArg.setRequiredValueCount(1);
|
||||
upgradeLookupArg.setValueNames({"repo"});
|
||||
mingwBundleArg.setDenotesOperation(true);
|
||||
mingwBundleArg.setRequiredValueCount(-1);
|
||||
mingwBundleArg.setValueNames(pkgValueNames);
|
||||
repoindexConfArg.setCombinable(true);
|
||||
repoindexConfArg.setValueNames(pathValueName);
|
||||
repoindexConfArg.setRequiredValueCount(1);
|
||||
|
@ -131,20 +134,19 @@ ConfigArgs::ConfigArgs(ArgumentParser &parser) :
|
|||
qtPluginsArg.setCombinable(true);
|
||||
qtPluginsArg.setRequiredValueCount(-1);
|
||||
qtPluginsArg.setValueNames({"plugin 1", "plugin 2"});
|
||||
addSourceOnlyDepsArg.setCombinable(true);
|
||||
shSyntaxArg.setCombinable(true);
|
||||
repoArg.setRequiredValueCount(1);
|
||||
repoArg.setValueNames({"repo name"});
|
||||
serverArg.setSecondaryArguments({&rootdirArg, &dbpathArg, &pacmanConfArg, &reposFromPacmanConfEnabled, &certFileArg, &keyFileArg, &websocketAddrArg, &websocketPortArg, &insecureArg, &aurArg, &shSyntaxArg});
|
||||
upgradeLookupArg.setSecondaryArguments({&shSyntaxArg});
|
||||
buildOrderArg.setSecondaryArguments({&aurArg, &addSourceOnlyDepsArg, &requireSourcesArg, &verboseArg, &shSyntaxArg});
|
||||
mingwBundleArg.setSecondaryArguments({&targetDirArg, &targetNameArg, &targetFormatArg, &iconThemesArg, &defaultIconThemeArg, &extraPackagesArg, &qtPluginsArg});
|
||||
serverArg.setSubArguments({&rootdirArg, &dbpathArg, &pacmanConfArg, &reposFromPacmanConfEnabled, &certFileArg, &keyFileArg, &websocketAddrArg, &websocketPortArg, &insecureArg, &aurArg, &shSyntaxArg});
|
||||
upgradeLookupArg.setSubArguments({&repoNameArg, &shSyntaxArg});
|
||||
buildOrderArg.setSubArguments({&packagesArg, &aurArg, &addSourceOnlyDepsArg, &requireSourcesArg, &verboseArg, &shSyntaxArg});
|
||||
mingwBundleArg.setSubArguments({&packagesArg, &targetDirArg, &targetNameArg, &targetFormatArg, &iconThemesArg, &defaultIconThemeArg, &extraPackagesArg, &qtPluginsArg});
|
||||
cacheDirArg.setCombinable(true);
|
||||
cacheDirArg.setRequiredValueCount(1);
|
||||
cacheDirArg.setValueNames(pathValueName);
|
||||
storageDirArg.setCombinable(true);
|
||||
storageDirArg.setRequiredValueCount(1);
|
||||
storageDirArg.setValueNames(pathValueName);
|
||||
parser.setMainArguments({&buildOrderArg, &upgradeLookupArg, &serverArg, &mingwBundleArg, &repoindexConfArg, &repoindexConfArg, &cacheDirArg, &storageDirArg, &helpArg});
|
||||
parser.setMainArguments({&helpArg, &buildOrderArg, &upgradeLookupArg, &serverArg, &mingwBundleArg, &repoindexConfArg, &cacheDirArg, &storageDirArg});
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -211,7 +213,7 @@ inline void assign(QHostAddress &addr, const QString &val)
|
|||
inline void assign(QString &str, const Argument &arg)
|
||||
{
|
||||
if(arg.isPresent()) {
|
||||
str = QString::fromLocal8Bit(arg.values().front().data(), arg.values().front().size());
|
||||
str = QString::fromLocal8Bit(arg.values().front());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,7 +287,7 @@ void Config::loadFromConfigFile(const QString &configFilePath)
|
|||
void Config::loadFromConfigFile(const ConfigArgs &args)
|
||||
{
|
||||
if(args.repoindexConfArg.isPresent()) {
|
||||
loadFromConfigFile(QString::fromLocal8Bit(args.repoindexConfArg.values().front().data()));
|
||||
loadFromConfigFile(QString::fromLocal8Bit(args.repoindexConfArg.values().front()));
|
||||
return;
|
||||
} else {
|
||||
for(const auto &defaultPath : {QStringLiteral("./repoindex.conf"), QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + QStringLiteral("/repoindex.conf"), QStringLiteral("/etc/repoindex.conf")}) {
|
||||
|
@ -307,9 +309,9 @@ void Config::loadFromArgs(const ConfigArgs &args)
|
|||
assign(m_pacmanConfFile, args.pacmanConfArg);
|
||||
if(args.aurArg.isPresent()) {
|
||||
auto val = args.aurArg.values().front();
|
||||
if(val == "enabled") {
|
||||
if(!strcmp(val, "enabled")) {
|
||||
m_aurEnabled = true;
|
||||
} else if(val == "disabled") {
|
||||
} else if(!strcmp(val, "disabled")) {
|
||||
m_aurEnabled = false;
|
||||
} else {
|
||||
cerr << shchar << "Warning: The specified value for the argument --aur-enabled is invalid and will be ignored." << endl;
|
||||
|
@ -320,15 +322,15 @@ void Config::loadFromArgs(const ConfigArgs &args)
|
|||
assign(m_serverKeyFile, args.keyFileArg);
|
||||
assign(m_serverInsecure, args.insecureArg);
|
||||
if(args.websocketAddrArg.isPresent()) {
|
||||
assign(m_websocketServerListeningAddr, QString::fromLocal8Bit(args.websocketAddrArg.values().front().data(), args.websocketAddrArg.values().front().size()));
|
||||
assign(m_websocketServerListeningAddr, QString::fromLocal8Bit(args.websocketAddrArg.values().front()));
|
||||
}
|
||||
m_verbose = args.verboseArg.isPresent();
|
||||
m_runServer = args.serverArg.isPresent();
|
||||
if(args.cacheDirArg.isPresent()) {
|
||||
m_cacheDir = QString::fromLocal8Bit(args.cacheDirArg.values().front().data());
|
||||
m_cacheDir = QString::fromLocal8Bit(args.cacheDirArg.values().front());
|
||||
}
|
||||
if(args.storageDirArg.isPresent()) {
|
||||
m_storageDir = QString::fromLocal8Bit(args.storageDirArg.values().front().data());
|
||||
m_storageDir = QString::fromLocal8Bit(args.storageDirArg.values().front());
|
||||
}
|
||||
if(args.reposFromPacmanConfEnabled.isPresent()) {
|
||||
m_reposFromPacmanConfEnabled = true;
|
||||
|
|
|
@ -23,10 +23,12 @@ class ConfigArgs
|
|||
public:
|
||||
ConfigArgs(ApplicationUtilities::ArgumentParser &parser);
|
||||
ApplicationUtilities::HelpArgument helpArg;
|
||||
ApplicationUtilities::Argument packagesArg;
|
||||
ApplicationUtilities::Argument buildOrderArg;
|
||||
ApplicationUtilities::Argument addSourceOnlyDepsArg;
|
||||
ApplicationUtilities::Argument requireSourcesArg;
|
||||
ApplicationUtilities::Argument serverArg;
|
||||
ApplicationUtilities::Argument repoNameArg;
|
||||
ApplicationUtilities::Argument upgradeLookupArg;
|
||||
ApplicationUtilities::Argument mingwBundleArg;
|
||||
ApplicationUtilities::Argument repoindexConfArg;
|
||||
|
@ -52,7 +54,6 @@ public:
|
|||
ApplicationUtilities::Argument cacheDirArg;
|
||||
ApplicationUtilities::Argument storageDirArg;
|
||||
ApplicationUtilities::Argument shSyntaxArg;
|
||||
ApplicationUtilities::Argument repoArg;
|
||||
};
|
||||
|
||||
class Config;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../network/userrepository.h"
|
||||
|
||||
#include <c++utilities/io/inifile.h>
|
||||
#include <c++utilities/io/catchiofailure.h>
|
||||
#include <c++utilities/conversion/stringconversion.h>
|
||||
#include <c++utilities/misc/memory.h>
|
||||
|
||||
|
@ -352,7 +353,8 @@ void Manager::addDataBasesFromPacmanConfig()
|
|||
includedFile.exceptions(ios_base::failbit | ios_base::badbit);
|
||||
includedFile.open(path, ios_base::in);
|
||||
includedIni.parse(includedFile);
|
||||
} catch (const ios_base::failure &) {
|
||||
} catch(...) {
|
||||
catchIoFailure();
|
||||
cerr << shchar << "Error: An IO exception occured when parsing the included file \"" << path << "\"." << endl;
|
||||
}
|
||||
}
|
||||
|
@ -377,8 +379,9 @@ void Manager::addDataBasesFromPacmanConfig()
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (const ios_base::failure &) {
|
||||
throw ios_base::failure("Error: An IO exception occured when parsing the config file.");
|
||||
} catch(...) {
|
||||
catchIoFailure();
|
||||
throwIoFailure("Error: An IO exception occured when parsing the config file.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@ namespace RepoIndex {
|
|||
|
||||
using namespace Utilities;
|
||||
|
||||
const string prefix("mingw-w64-");
|
||||
const char *prefix = "mingw-w64-";
|
||||
size_t prefixLen = 10;
|
||||
|
||||
IncludedPackage::IncludedPackage(const Package *package, bool dependencyOnly) :
|
||||
package(package),
|
||||
|
@ -38,7 +39,7 @@ bool IncludedPackage::operator==(const Package *package) const
|
|||
return this->package == package;
|
||||
}
|
||||
|
||||
MingwBundle::MingwBundle(Manager &manager, const ApplicationUtilities::StringVector &packages, const ApplicationUtilities::StringVector &iconPackages, const ApplicationUtilities::StringVector &extraPackages, const ApplicationUtilities::StringVector &qtPlugins) :
|
||||
MingwBundle::MingwBundle(Manager &manager, const std::vector<const char *> &packages, const std::vector<const char *> &iconPackages, const std::vector<const char *> &extraPackages, const std::vector<const char *> &qtPlugins) :
|
||||
m_manager(manager),
|
||||
m_extraPackages(extraPackages),
|
||||
m_qtPlugins(qtPlugins)
|
||||
|
@ -46,8 +47,8 @@ MingwBundle::MingwBundle(Manager &manager, const ApplicationUtilities::StringVec
|
|||
cerr << shchar << "Resolving dependencies ..." << endl;
|
||||
string missing;
|
||||
// add mingw-w64 packages
|
||||
for(const auto &pkgName : packages) {
|
||||
if(auto *pkg = manager.packageProviding(Dependency(QString::fromLocal8Bit(ConversionUtilities::startsWith(pkgName, prefix) ? pkgName.data() : (prefix + pkgName).data())))) {
|
||||
for(const char *pkgName : packages) {
|
||||
if(auto *pkg = manager.packageProviding(Dependency(QString::fromLocal8Bit(strncmp(pkgName, prefix, prefixLen) ? pkgName : (prefix + string(pkgName)).data())))) {
|
||||
if(find(m_packages.cbegin(), m_packages.cend(), pkg) == m_packages.cend()) {
|
||||
m_packages.emplace_back(pkg, false);
|
||||
addDependencies(pkg);
|
||||
|
@ -59,7 +60,7 @@ MingwBundle::MingwBundle(Manager &manager, const ApplicationUtilities::StringVec
|
|||
}
|
||||
// add additional icon packages
|
||||
for(const auto &pkgName : iconPackages) {
|
||||
if(auto *pkg = manager.packageProviding(Dependency(QString::fromLocal8Bit(pkgName.data())))) {
|
||||
if(auto *pkg = manager.packageProviding(Dependency(QString::fromLocal8Bit(pkgName)))) {
|
||||
if(find(m_packages.cbegin(), m_packages.cend(), pkg) == m_packages.cend()) {
|
||||
m_packages.emplace_back(pkg, false);
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ struct RelevantFile
|
|||
|
||||
struct PkgFileInfo
|
||||
{
|
||||
PkgFileInfo(const QString &name, const QString &path, bool dependencyOnly = false, const StringVector &qtPlugins = StringVector()) :
|
||||
PkgFileInfo(const QString &name, const QString &path, bool dependencyOnly = false, const vector<const char *> &qtPlugins = vector<const char *>()) :
|
||||
name(name),
|
||||
path(path),
|
||||
dependencyOnly(dependencyOnly),
|
||||
|
@ -162,7 +163,7 @@ struct PkgFileInfo
|
|||
unique_ptr<KTar> archive;
|
||||
list<RelevantFile> relevantFiles;
|
||||
bool dependencyOnly;
|
||||
const StringVector &qtPlugins;
|
||||
const vector<const char *> &qtPlugins;
|
||||
bool failure;
|
||||
};
|
||||
|
||||
|
@ -373,6 +374,11 @@ void getFiles(PkgFileInfo &pkgFileInfo)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if(pkgFileInfo.archive->device()) {
|
||||
cerr << shchar << "Error: Unable to open the archive " << pkgFileInfo.path.toLocal8Bit().data() << ": " << pkgFileInfo.archive->device()->errorString().toLocal8Bit().data() << endl;
|
||||
} else {
|
||||
cerr << shchar << "Error: Unable to open the archive " << pkgFileInfo.path.toLocal8Bit().data() << ": Device hasn't been created." << endl;
|
||||
}
|
||||
pkgFileInfo.failure = true;
|
||||
}
|
||||
}
|
||||
|
@ -540,13 +546,13 @@ void MingwBundle::createBundle(const string &targetDir, const string &targetName
|
|||
}
|
||||
pkgFiles.emplace_back(pkgName.toString(), pkgFile, includedPkg.dependencyOnly, m_qtPlugins);
|
||||
}
|
||||
for(const auto &pkgFileStdStr : m_extraPackages) {
|
||||
QString pkgFile = QString::fromLocal8Bit(pkgFileStdStr.data());
|
||||
for(const char *pkgFileRawStr : m_extraPackages) {
|
||||
QString pkgFile = QString::fromLocal8Bit(pkgFileRawStr);
|
||||
if(QFile::exists(pkgFile)) {
|
||||
const auto pkg = make_unique<AlpmPackage>(pkgFile); // do not catch the exception here
|
||||
pkgFiles.emplace_back(pkg->name().startsWith(QLatin1String("mingw-w64-")) ? pkg->name().mid(10) : pkg->name(), pkgFile, false, m_qtPlugins);
|
||||
} else {
|
||||
throw runtime_error("The specified extra package \"" + pkgFileStdStr + "\" can't be found.");
|
||||
throw runtime_error("The specified extra package \"" + string(pkgFileRawStr) + "\" can't be found.");
|
||||
}
|
||||
}
|
||||
// get relevant files from packages
|
||||
|
|
|
@ -22,7 +22,7 @@ struct IncludedPackage
|
|||
class MingwBundle
|
||||
{
|
||||
public:
|
||||
MingwBundle(Manager &manager, const ApplicationUtilities::StringVector &packages, const ApplicationUtilities::StringVector &iconPackages, const ApplicationUtilities::StringVector &extraPackages, const ApplicationUtilities::StringVector &qtPlugins);
|
||||
MingwBundle(Manager &manager, const std::vector<const char *> &packages, const std::vector<const char *> &iconPackages, const std::vector<const char *> &extraPackages, const std::vector<const char *> &qtPlugins);
|
||||
|
||||
void createBundle(const std::string &targetDir, const std::string &targetName, const std::string &targetFormat, const std::string &defaultIconTheme) const;
|
||||
|
||||
|
@ -31,8 +31,8 @@ private:
|
|||
|
||||
Manager &m_manager;
|
||||
std::list<IncludedPackage> m_packages;
|
||||
const ApplicationUtilities::StringVector &m_extraPackages;
|
||||
const ApplicationUtilities::StringVector &m_qtPlugins;
|
||||
const std::vector<const char *> &m_extraPackages;
|
||||
const std::vector<const char *> &m_qtPlugins;
|
||||
};
|
||||
|
||||
} // namespace PackageManagement
|
||||
|
|
|
@ -612,15 +612,15 @@ void BuildOrderResolver::requestDependenciesToBeRequested()
|
|||
/*!
|
||||
* \brief Creates a new BuildOrderResolverCli for the specified \a packages using the specified \a manager.
|
||||
*/
|
||||
BuildOrderResolverCli::BuildOrderResolverCli(Manager &manager, const StringVector &packages, bool addSourceOnlyDeps, bool requireSources) :
|
||||
BuildOrderResolverCli::BuildOrderResolverCli(Manager &manager, const std::vector<const char *> &packages, bool addSourceOnlyDeps, bool requireSources) :
|
||||
BuildOrderResolver(manager, addSourceOnlyDeps, requireSources)
|
||||
{
|
||||
cerr << shchar << "Getting package information ..." << endl;
|
||||
tasks().clear();
|
||||
tasks().reserve(packages.size() * 2);
|
||||
// add a task for each specified package
|
||||
for(const auto &pkgName : packages) {
|
||||
tasks() << new TaskInfo(QString::fromLocal8Bit(pkgName.data()));
|
||||
for(const char *pkgName : packages) {
|
||||
tasks() << new TaskInfo(QString::fromLocal8Bit(pkgName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class BuildOrderResolverCli : public BuildOrderResolver
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BuildOrderResolverCli(Manager &manager, const ApplicationUtilities::StringVector &packages, bool addSourceOnlyDeps = false, bool requireSources = true);
|
||||
BuildOrderResolverCli(Manager &manager, const std::vector<const char *> &packages, bool addSourceOnlyDeps = false, bool requireSources = true);
|
||||
int exec();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env xdg-open
|
||||
[Desktop Entry]
|
||||
Name=Repository Browser
|
||||
Comment=An Arch Linux repository browser.
|
||||
Exec=sh -c "repoindex-gui --repos-from-pacman-conf --cache-dir \\"\\$HOME/.cache/Martchus/Repository Browser\\" --storage-dir \\"\\$HOME/.config/Martchus/Repository Browser\\""
|
||||
Icon=repoindex
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Utility;
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
"add": [
|
||||
{"name": "ownstuff-testing",
|
||||
"ignored": false,
|
||||
"ignored": true,
|
||||
"sourcesDir": "path/to/local/source/dir",
|
||||
"packagesDir": "/run/media/devel/repo/arch/ownstuff-testing/os/x86_64",
|
||||
"upgradeSources": ["aur"],
|
||||
|
|
|
@ -27,6 +27,12 @@ set(WEB_FILES
|
|||
js/utils.js
|
||||
)
|
||||
|
||||
# insert meta data in index.html
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/index.html"
|
||||
"${CMAKE_BINARY_DIR}/web/index.html"
|
||||
)
|
||||
|
||||
# add install target for web files / minimizing
|
||||
# -> don't minimize debug builds
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
@ -78,7 +84,7 @@ foreach(WEB_FILE ${WEB_FILES})
|
|||
)
|
||||
install(
|
||||
FILES ${MIN_FILE}
|
||||
DESTINATION share/${META_PROJECT_NAME}/${WEB_DIR}
|
||||
DESTINATION share/${META_PROJECT_NAME}/web/${WEB_DIR}
|
||||
COMPONENT web
|
||||
)
|
||||
list(APPEND JS_MIN_FILES "${MIN_FILE}")
|
||||
|
@ -86,13 +92,13 @@ foreach(WEB_FILE ${WEB_FILES})
|
|||
# install unminimized version of web file
|
||||
install(
|
||||
FILES ${WEB_FILE}
|
||||
DESTINATION share/${META_PROJECT_NAME}/${WEB_DIR}
|
||||
DESTINATION share/${META_PROJECT_NAME}/web/${WEB_DIR}
|
||||
COMPONENT web
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
install(
|
||||
FILES resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
|
||||
FILES ../resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
|
||||
DESTINATION share/${META_PROJECT_NAME}/web/img
|
||||
COMPONENT web
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue