removed qmake project file, small adjustments
This commit is contained in:
parent
f6023d6601
commit
2dd0294bb7
|
@ -7,6 +7,7 @@ set(HEADER_FILES
|
|||
alpm/utilities.h
|
||||
network/server.h
|
||||
network/connection.h
|
||||
network/networkaccessmanager.h
|
||||
alpm/config.h
|
||||
alpm/resolvebuildorder.h
|
||||
alpm/mingwbundle.h
|
||||
|
@ -41,6 +42,7 @@ set(SRC_FILES
|
|||
network/server.cpp
|
||||
network/connection.cpp
|
||||
network/userrepository.cpp
|
||||
network/networkaccessmanager.cpp
|
||||
)
|
||||
set(WEB_FILES
|
||||
web/3rdparty/bootstrap/css/bootstrap-theme.css
|
||||
|
@ -82,7 +84,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
|||
set(META_APP_DESCRIPTION "Arch Linux repository browser")
|
||||
set(META_VERSION_MAJOR 0)
|
||||
set(META_VERSION_MINOR 1)
|
||||
set(META_VERSION_PATCH 0)
|
||||
set(META_VERSION_PATCH 1)
|
||||
|
||||
# stringification of meta data
|
||||
set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"")
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include "./upgradelookup.h"
|
||||
#include "./alpmpackage.h"
|
||||
#include "./utilities.h"
|
||||
#include "./config.h"
|
||||
|
||||
#include "../network/networkaccessmanager.h"
|
||||
|
||||
#include <c++utilities/misc/memory.h>
|
||||
|
||||
|
@ -10,7 +13,11 @@
|
|||
|
||||
#include <QList>
|
||||
#include <QJsonObject>
|
||||
#include <QStringBuilder>
|
||||
#include <QtConcurrent>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -147,6 +154,9 @@ AlpmPackageLoader *AlpmDatabase::init()
|
|||
origin = PackageOrigin::SyncDb;
|
||||
}
|
||||
|
||||
// wipe current packages
|
||||
wipePackages();
|
||||
|
||||
// initialization of packages is done concurrently via AlpmPackageLoader: ~ 4 sec
|
||||
return new AlpmPackageLoader(this, origin);
|
||||
|
||||
|
@ -177,10 +187,91 @@ PackageDetailAvailability AlpmDatabase::requestsRequired(PackageDetail packageDe
|
|||
}
|
||||
}
|
||||
|
||||
QNetworkRequest AlpmDatabase::regularDatabaseRequest()
|
||||
{
|
||||
return QNetworkRequest(QUrl(serverUrls().front() % QChar('/') % name() % QStringLiteral(".db")));
|
||||
}
|
||||
|
||||
QNetworkRequest AlpmDatabase::filesDatabaseRequest()
|
||||
{
|
||||
return QNetworkRequest(QUrl(serverUrls().front() % QChar('/') % name() % QStringLiteral(".files")));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Downloads the database from the server.
|
||||
* \param targetDir Specifies the directory to store the downloaded database file. Shall not include the filename.
|
||||
* \remarks
|
||||
* - The download is performed asynchronously - this method returns immediately.
|
||||
* - After successfull download the database path is update to the path of the new file and the
|
||||
* repository is reinitiated.
|
||||
* - Does nothing if there is not at least one server URL available.
|
||||
* - Status messages are printed via cerr.
|
||||
*/
|
||||
void AlpmDatabase::downloadDatabase(const QString &targetDir, bool filesDatabase)
|
||||
{
|
||||
if(serverUrls().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
cerr << shchar << "Downloading " << (filesDatabase ? "files" : "regular") << " database for [" << name().toLocal8Bit().data() << "] from mirror " << serverUrls().front().toLocal8Bit().data() << " ..." << endl;
|
||||
QNetworkReply *reply = networkAccessManager().get(filesDatabase ? filesDatabaseRequest() : regularDatabaseRequest());
|
||||
reply->setProperty("filesDatabase", filesDatabase);
|
||||
m_downloadTargetDir = targetDir.isEmpty() ? QString(QChar('.')) : targetDir;
|
||||
connect(reply, &QNetworkReply::finished, this, &AlpmDatabase::databaseDownloadFinished);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Refreshes the database by downloading it from the server
|
||||
* or just reinitializing it if there is not at least one server URL available.
|
||||
* \param targetDir Specifies the directory to store the downloaded database file. Shall not include the filename.
|
||||
* Ignored when downloading is not possible.
|
||||
* \remarks Effectively updates the database file of sync databases and just refreshes
|
||||
* local databases.
|
||||
*/
|
||||
void AlpmDatabase::refresh(const QString &targetDir)
|
||||
{
|
||||
if(serverUrls().isEmpty()) {
|
||||
init();
|
||||
} else {
|
||||
downloadDatabase(targetDir, true);
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Package> AlpmDatabase::emptyPackage()
|
||||
{
|
||||
return make_unique<AlpmPackage>(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Internally called to handle finishing of database download.
|
||||
* \remarks Connected in downloadDatabase().
|
||||
*/
|
||||
void AlpmDatabase::databaseDownloadFinished()
|
||||
{
|
||||
auto *reply = static_cast<QNetworkReply *>(sender());
|
||||
bool filesDatabase = reply->property("filesDatabase").toBool();
|
||||
if(reply->error() == QNetworkReply::NoError) {
|
||||
cerr << "Downloaded database file for [" << name().toLocal8Bit().data() << "] successfully." << endl;
|
||||
QString newDatabasePath = m_downloadTargetDir % QChar('/') % name() % (filesDatabase ? QStringLiteral(".files") : QStringLiteral(".db"));
|
||||
if(QFile::exists(newDatabasePath)) {
|
||||
QString backupFile(newDatabasePath + QStringLiteral(".bak"));
|
||||
QFile::remove(backupFile);
|
||||
if(!QFile::rename(newDatabasePath, backupFile)) {
|
||||
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to rename present database file." << endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
QFile outputFile(newDatabasePath);
|
||||
if(outputFile.open(QFile::WriteOnly) && outputFile.write(reply->readAll())) {
|
||||
outputFile.close();
|
||||
m_dbPath = newDatabasePath;
|
||||
init();
|
||||
} else {
|
||||
cerr << "An IO error occured when storing database file for [" << name().toLocal8Bit().data() << "]: Unable to create/write output file." << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << "An error occured when dwonloading database file for [" << name().toLocal8Bit().data() << "]: " << reply->errorString().toLocal8Bit().data() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Alpm
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QNetworkRequest)
|
||||
|
||||
namespace RepoIndex {
|
||||
|
||||
class AlpmPackage;
|
||||
|
@ -38,16 +40,26 @@ public:
|
|||
const QString &databasePath() const;
|
||||
void setDatabasePath(const QString &dbPath);
|
||||
|
||||
// updating/refreshing
|
||||
void downloadDatabase(const QString &targetDir, bool filesDatabase = true);
|
||||
void refresh(const QString &targetDir);
|
||||
|
||||
signals:
|
||||
void initiated();
|
||||
|
||||
protected:
|
||||
std::unique_ptr<Package> emptyPackage();
|
||||
|
||||
private slots:
|
||||
void databaseDownloadFinished();
|
||||
|
||||
private:
|
||||
void loadDescriptions(QList<QPair<QString, QList<QByteArray> > > &descriptions);
|
||||
QNetworkRequest regularDatabaseRequest();
|
||||
QNetworkRequest filesDatabaseRequest();
|
||||
|
||||
QString m_dbPath;
|
||||
QString m_downloadTargetDir;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -31,7 +31,8 @@ const char *shchar = "";
|
|||
ConfigArgs::ConfigArgs(ArgumentParser &parser) :
|
||||
helpArg(parser),
|
||||
buildOrderArg("build-order", "b", "calculates the build order to build the specified packages"),
|
||||
addSourceOnlyDeps("add-src-only-deps", "a", "adds source-only dependencies to build chain"),
|
||||
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"),
|
||||
|
@ -63,6 +64,7 @@ ConfigArgs::ConfigArgs(ArgumentParser &parser) :
|
|||
buildOrderArg.setDenotesOperation(true);
|
||||
buildOrderArg.setRequiredValueCount(-1);
|
||||
buildOrderArg.setValueNames(pkgValueNames);
|
||||
requireSourcesArg.setCombinable(true);
|
||||
serverArg.setDenotesOperation(true);
|
||||
upgradeLookupArg.setDenotesOperation(true);
|
||||
upgradeLookupArg.setRequiredValueCount(1);
|
||||
|
@ -127,7 +129,7 @@ ConfigArgs::ConfigArgs(ArgumentParser &parser) :
|
|||
repoArg.setValueNames({"repo name"});
|
||||
serverArg.setSecondaryArguments({&rootdirArg, &dbpathArg, &pacmanConfArg, &certFileArg, &keyFileArg, &websocketAddrArg, &websocketPortArg, &insecureArg, &aurArg, &shSyntaxArg});
|
||||
upgradeLookupArg.setSecondaryArguments({&shSyntaxArg});
|
||||
buildOrderArg.setSecondaryArguments({&aurArg, &addSourceOnlyDeps, &verboseArg, &shSyntaxArg});
|
||||
buildOrderArg.setSecondaryArguments({&aurArg, &addSourceOnlyDepsArg, &requireSourcesArg, &verboseArg, &shSyntaxArg});
|
||||
mingwBundleArg.setSecondaryArguments({&targetDirArg, &targetNameArg, &targetFormatArg, &iconThemesArg, &defaultIconThemeArg, &extraPackagesArg});
|
||||
cacheDirArg.setCombinable(true);
|
||||
cacheDirArg.setRequiredValueCount(1);
|
||||
|
|
|
@ -24,7 +24,8 @@ public:
|
|||
ConfigArgs(ApplicationUtilities::ArgumentParser &parser);
|
||||
ApplicationUtilities::HelpArgument helpArg;
|
||||
ApplicationUtilities::Argument buildOrderArg;
|
||||
ApplicationUtilities::Argument addSourceOnlyDeps;
|
||||
ApplicationUtilities::Argument addSourceOnlyDepsArg;
|
||||
ApplicationUtilities::Argument requireSourcesArg;
|
||||
ApplicationUtilities::Argument serverArg;
|
||||
ApplicationUtilities::Argument upgradeLookupArg;
|
||||
ApplicationUtilities::Argument mingwBundleArg;
|
||||
|
|
|
@ -67,7 +67,7 @@ Manager::Manager(const Config &config) :
|
|||
{
|
||||
addLocalDatabase();
|
||||
if(config.isAurEnabled()) {
|
||||
m_userRepo = make_unique<UserRepository>(m_networkAccessManager);
|
||||
m_userRepo = make_unique<UserRepository>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "./upgradelookup.h"
|
||||
#include "./alpmpackage.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QMutex>
|
||||
|
@ -63,6 +62,8 @@ public:
|
|||
void wipeCache();
|
||||
void maintainCache();
|
||||
|
||||
// refreshing
|
||||
|
||||
// package lookup
|
||||
AlpmPackage *packageFromDatabase(const QString &dbName, const QString &pkgName);
|
||||
const AlpmPackage *packageFromDatabase(const QString &dbName, const QString &pkgName) const;
|
||||
|
@ -97,7 +98,6 @@ private:
|
|||
SignatureLevel m_sigLevel;
|
||||
SignatureLevel m_localFileSigLevel;
|
||||
QString m_pacmanCacheDir;
|
||||
QNetworkAccessManager m_networkAccessManager;
|
||||
std::unique_ptr<UserRepository> m_userRepo;
|
||||
std::unique_ptr<AlpmDatabase> m_localDb;
|
||||
std::list<std::unique_ptr<AlpmDatabase> > m_syncDbs;
|
||||
|
|
|
@ -131,6 +131,9 @@ void Package::computeRequiredBy(Manager &manager)
|
|||
bool Package::matches(const QString &name, const QString &version, const Dependency &dependency)
|
||||
{
|
||||
if(name == dependency.name) {
|
||||
if(dependency.version.isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
PackageVersionComparsion cmp;
|
||||
switch(dependency.mode) {
|
||||
case DependencyMode::Any:
|
||||
|
@ -149,6 +152,7 @@ bool Package::matches(const QString &name, const QString &version, const Depende
|
|||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -910,7 +914,6 @@ QString RepoIndex::PackageVersion::toString() const
|
|||
|
||||
/*!
|
||||
* \brief Compares two version parts.
|
||||
* \returns Returns 1 if part1 is newer then part2, -1 if part2 is newer then part1 and 0 if both parts are equal.
|
||||
*/
|
||||
PackageVersionPartComparsion PackageVersion::compareParts(const QString &part1, const QString &part2)
|
||||
{
|
||||
|
@ -972,6 +975,7 @@ PackageVersionPartComparsion PackageVersion::compareParts(const QString &part1,
|
|||
*/
|
||||
PackageVersionComparsion PackageVersion::compare(const PackageVersion &other) const
|
||||
{
|
||||
// check whether epoch differs
|
||||
if(!epoch.isEmpty() || !other.epoch.isEmpty()) {
|
||||
switch(compareParts(other.epoch, epoch)) {
|
||||
case PackageVersionPartComparsion::Newer: return PackageVersionComparsion::SoftwareUpgrade;
|
||||
|
@ -979,16 +983,22 @@ PackageVersionComparsion PackageVersion::compare(const PackageVersion &other) co
|
|||
case PackageVersionPartComparsion::Equal: ;
|
||||
}
|
||||
}
|
||||
// check whether upstream version differs
|
||||
switch(compareParts(other.version, version)) {
|
||||
case PackageVersionPartComparsion::Newer: return PackageVersionComparsion::SoftwareUpgrade;
|
||||
case PackageVersionPartComparsion::Older: return PackageVersionComparsion::NewerThenSyncVersion;
|
||||
case PackageVersionPartComparsion::Equal: ;
|
||||
}
|
||||
// check whether package version differs
|
||||
if(release.isEmpty() && !other.release.isEmpty()) {
|
||||
// only consider package release if both versions specify it (otherwise consider packages equal)
|
||||
switch(compareParts(other.release, release)) {
|
||||
case PackageVersionPartComparsion::Newer: return PackageVersionComparsion::PackageUpgradeOnly;
|
||||
case PackageVersionPartComparsion::Older: return PackageVersionComparsion::NewerThenSyncVersion;
|
||||
case PackageVersionPartComparsion::Equal: ;
|
||||
}
|
||||
}
|
||||
// no difference -> equal
|
||||
return PackageVersionComparsion::Equal;
|
||||
}
|
||||
|
||||
|
|
|
@ -231,11 +231,7 @@ inline void TaskInfo::addRequiredFor(const Dependency &dependency)
|
|||
void TaskInfo::add(QList<TaskInfo *> &results)
|
||||
{
|
||||
if(!isDone()) {
|
||||
if(name() == "mingw-w64-harfbuzz") {
|
||||
cout << "harfbuzz" << endl;
|
||||
}
|
||||
if(isVisited()) {
|
||||
cout << "cyclic dependency: " << name().toStdString() << endl;
|
||||
// cyclic dependency
|
||||
if(isOnlyDependency() || isBinaryAvailable()) {
|
||||
// if this is only a dependency (which we don't want to build) don't care about it
|
||||
|
@ -344,10 +340,11 @@ TaskInfo *TaskInfo::find(const QList<TaskInfo *> &tasks, const QString &name)
|
|||
/*!
|
||||
* \brief Creates a new BuildOrderResolver using the specified \a manager.
|
||||
*/
|
||||
BuildOrderResolver::BuildOrderResolver(Manager &manager, bool addSourceOnlyDeps) :
|
||||
BuildOrderResolver::BuildOrderResolver(Manager &manager, bool addSourceOnlyDeps, bool requireSources) :
|
||||
m_manager(manager),
|
||||
m_finder(nullptr),
|
||||
m_addSourceOnlyDeps(addSourceOnlyDeps),
|
||||
m_requireSources(requireSources),
|
||||
m_hasFinished(false)
|
||||
{}
|
||||
|
||||
|
@ -474,7 +471,7 @@ bool BuildOrderResolver::addDependenciesToTask(TaskInfo *task)
|
|||
return true;
|
||||
}
|
||||
Dependency dep(task->name(), QString());
|
||||
if(const auto pkg = findPackageForDependency(dep, !task->isOnlyDependency())) {
|
||||
if(const auto pkg = findPackageForDependency(dep, m_requireSources && !task->isOnlyDependency())) {
|
||||
task->addRequiredFor(dep);
|
||||
if(task->associatePackage(pkg)) {
|
||||
if(pkg->repository()->isSourceOnly()) {
|
||||
|
@ -519,10 +516,7 @@ bool BuildOrderResolver::addDependenciesToTask(TaskInfo *task, const QList<const
|
|||
for(auto *deps : dependencies) {
|
||||
for(auto &dep : *deps) {
|
||||
auto *depTask = TaskInfo::find(m_tasks, dep.name);
|
||||
auto *depPkg = findPackageForDependency(dep, depTask && !depTask->isOnlyDependency());
|
||||
if(depPkg && dep.name == "mingw-w64-harfbuzz") {
|
||||
cout << "processing harfbuzz" << endl;
|
||||
}
|
||||
auto *depPkg = findPackageForDependency(dep, m_requireSources && depTask && !depTask->isOnlyDependency());
|
||||
const QString taskName = depPkg ? depPkg->name() : dep.name;
|
||||
bool newTask;
|
||||
if(depTask) {
|
||||
|
@ -618,8 +612,8 @@ 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) :
|
||||
BuildOrderResolver(manager, addSourceOnlyDeps)
|
||||
BuildOrderResolverCli::BuildOrderResolverCli(Manager &manager, const StringVector &packages, bool addSourceOnlyDeps, bool requireSources) :
|
||||
BuildOrderResolver(manager, addSourceOnlyDeps, requireSources)
|
||||
{
|
||||
cerr << shchar << "Getting package information ..." << endl;
|
||||
tasks().clear();
|
||||
|
|
|
@ -39,7 +39,7 @@ signals:
|
|||
void resolvingFailed(const QString &message);
|
||||
|
||||
protected:
|
||||
BuildOrderResolver(Manager &manager, bool addSourceOnlyDeps = false);
|
||||
BuildOrderResolver(Manager &manager, bool addSourceOnlyDeps = false, bool requireSources = true);
|
||||
Manager &manager();
|
||||
QList<TaskInfo *> &tasks();
|
||||
|
||||
|
@ -56,6 +56,7 @@ private:
|
|||
std::unique_ptr<PackageFinder> m_finder;
|
||||
QList<TaskInfo *> m_results;
|
||||
bool m_addSourceOnlyDeps;
|
||||
bool m_requireSources;
|
||||
bool m_hasFinished;
|
||||
QString m_errorMessage;
|
||||
};
|
||||
|
@ -97,7 +98,7 @@ class BuildOrderResolverCli : public BuildOrderResolver
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BuildOrderResolverCli(Manager &manager, const ApplicationUtilities::StringVector &packages, bool addSourceOnlyDeps = false);
|
||||
BuildOrderResolverCli(Manager &manager, const ApplicationUtilities::StringVector &packages, bool addSourceOnlyDeps = false, bool requireSources = true);
|
||||
int exec();
|
||||
};
|
||||
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -67,7 +67,7 @@ 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.addSourceOnlyDeps.isPresent());
|
||||
BuildOrderResolverCli resolver(manager, configArgs.buildOrderArg.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());
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#include "./networkaccessmanager.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
namespace RepoIndex {
|
||||
|
||||
QNetworkAccessManager &networkAccessManager()
|
||||
{
|
||||
static QNetworkAccessManager networkAccessManager;
|
||||
return networkAccessManager;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef NETWORKACCESSMANAGER_H
|
||||
#define NETWORKACCESSMANAGER_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QNetworkAccessManager)
|
||||
|
||||
namespace RepoIndex {
|
||||
|
||||
QNetworkAccessManager &networkAccessManager();
|
||||
|
||||
}
|
||||
|
||||
#endif // NETWORKACCESSMANAGER_H
|
|
@ -1,4 +1,5 @@
|
|||
#include "userrepository.h"
|
||||
#include "./userrepository.h"
|
||||
#include "./networkaccessmanager.h"
|
||||
|
||||
#include "../alpm/aurpackage.h"
|
||||
#include "../alpm/config.h"
|
||||
|
@ -137,7 +138,7 @@ void AurFullPackageReply::processData(QNetworkReply *reply)
|
|||
m_error = QStringLiteral("Unable to request tarball from AUR: ") + reply->errorString();
|
||||
}
|
||||
if(!m_error.isEmpty()) {
|
||||
cerr << shchar << m_error.toLocal8Bit().data();
|
||||
cerr << shchar << m_error.toLocal8Bit().data() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,9 +189,8 @@ void AurSuggestionsReply::processData(QNetworkReply *reply)
|
|||
}
|
||||
}
|
||||
|
||||
UserRepository::UserRepository(QNetworkAccessManager &networkAccessManager, QObject *parent) :
|
||||
Repository(QStringLiteral("AUR"), invalidIndex, parent),
|
||||
m_networkAccessManager(networkAccessManager)
|
||||
UserRepository::UserRepository(QObject *parent) :
|
||||
Repository(QStringLiteral("AUR"), invalidIndex, parent)
|
||||
{
|
||||
m_description = QStringLiteral("Arch User Repository");
|
||||
m_maxPackageAge = TimeSpan::fromDays(1.0);
|
||||
|
@ -233,7 +233,7 @@ AurSuggestionsReply *UserRepository::requestSuggestions(const QString &term)
|
|||
query.addQueryItem(rpcRequestTypeKey, term.size() < 3 ? rpcRequestTypeSuggest : rpcRequestTypeSearch);
|
||||
query.addQueryItem(rpcArgKey, term);
|
||||
url.setQuery(query);
|
||||
return new AurSuggestionsReply(m_networkAccessManager.get(QNetworkRequest(url)), term, this);
|
||||
return new AurSuggestionsReply(networkAccessManager().get(QNetworkRequest(url)), term, this);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ AurPackageReply *UserRepository::requestPackageInfo(const QStringList &packageNa
|
|||
auto url = m_aurRpcUrl;
|
||||
query.addQueryItem(rpcRequestTypeKey, rpcRequestTypeMultiInfo);
|
||||
url.setQuery(query);
|
||||
return new AurPackageReply(m_networkAccessManager.get(QNetworkRequest(url)), packageNames, this);
|
||||
return new AurPackageReply(networkAccessManager().get(QNetworkRequest(url)), packageNames, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,13 +270,13 @@ AurFullPackageReply *UserRepository::requestFullPackageInfo(const QStringList &p
|
|||
const auto &pkg = m_packages.at(packageName);
|
||||
if(!pkg->hasAllGeneralInfo() || !pkg->hasSourceRelatedMetaData() || forceUpdate) {
|
||||
if(pkg->tarUrl().isEmpty()) {
|
||||
replies << m_networkAccessManager.get(QNetworkRequest(m_aurSnapshotPath.arg(pkg->name())));
|
||||
replies << networkAccessManager().get(QNetworkRequest(m_aurSnapshotPath.arg(pkg->name())));
|
||||
} else {
|
||||
replies << m_networkAccessManager.get(QNetworkRequest(m_aurBaseUrl + pkg->tarUrl()));
|
||||
replies << networkAccessManager().get(QNetworkRequest(m_aurBaseUrl + pkg->tarUrl()));
|
||||
}
|
||||
}
|
||||
} catch(const out_of_range &) {
|
||||
replies << m_networkAccessManager.get(QNetworkRequest(m_aurSnapshotPath.arg(packageName)));
|
||||
replies << networkAccessManager().get(QNetworkRequest(m_aurSnapshotPath.arg(packageName)));
|
||||
}
|
||||
}
|
||||
if(replies.isEmpty()) {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QNetworkAccessManager)
|
||||
QT_FORWARD_DECLARE_CLASS(QNetworkReply)
|
||||
|
||||
namespace RepoIndex {
|
||||
|
@ -57,7 +56,7 @@ class UserRepository : public Repository
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UserRepository(QNetworkAccessManager &networkAccessManager, QObject *parent = nullptr);
|
||||
UserRepository(QObject *parent = nullptr);
|
||||
|
||||
RepositoryType type() const;
|
||||
|
||||
|
@ -73,7 +72,6 @@ protected:
|
|||
std::unique_ptr<Package> emptyPackage();
|
||||
|
||||
private:
|
||||
QNetworkAccessManager &m_networkAccessManager;
|
||||
QSet<QString> m_requestedSuggestions;
|
||||
static QString m_aurBaseUrl;
|
||||
static QUrl m_aurRpcUrl;
|
||||
|
|
105
repoindex.pro
105
repoindex.pro
|
@ -1,105 +0,0 @@
|
|||
# meta data
|
||||
projectname = repoindex
|
||||
appname = "Repository Index"
|
||||
appauthor = Martchus
|
||||
appurl = "https://github.com/$${appauthor}/$${projectname}"
|
||||
QMAKE_TARGET_DESCRIPTION = "Provides a web interface to browse Arch Linux package repositories."
|
||||
VERSION = 0.0.2
|
||||
|
||||
# include ../../common.pri when building as part of a subdirs project; otherwise include general.pri
|
||||
!include(../../common.pri) {
|
||||
!include(./general.pri) {
|
||||
error("Couldn't find the common.pri or the general.pri file!")
|
||||
}
|
||||
}
|
||||
|
||||
# basic configuration: console application
|
||||
TEMPLATE = app
|
||||
CONFIG += console # enables qDebug()
|
||||
QT += core network websockets concurrent KArchive
|
||||
|
||||
# add defines for configuration
|
||||
CONFIG(release, debug|release) {
|
||||
DEFINES += NDEBUG
|
||||
}
|
||||
|
||||
# add project files
|
||||
HEADERS += \
|
||||
alpm/manager.h \
|
||||
alpm/package.h \
|
||||
alpm/utilities.h \
|
||||
network/server.h \
|
||||
network/connection.h \
|
||||
alpm/config.h \
|
||||
alpm/resolvebuildorder.h \
|
||||
alpm/mingwbundle.h \
|
||||
network/userrepository.h \
|
||||
alpm/alpmpackage.h \
|
||||
alpm/aurpackage.h \
|
||||
alpm/alpmdatabase.h \
|
||||
alpm/repository.h \
|
||||
alpm/upgradelookup.h \
|
||||
alpm/suggestionslookup.h \
|
||||
alpm/packageinfolookup.h \
|
||||
alpm/packagelookup.h \
|
||||
alpm/packagefinder.h
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
alpm/manager.cpp \
|
||||
alpm/package.cpp \
|
||||
alpm/utilities.cpp \
|
||||
network/server.cpp \
|
||||
network/connection.cpp \
|
||||
alpm/config.cpp \
|
||||
alpm/resolvebuildorder.cpp \
|
||||
alpm/mingwbundle.cpp \
|
||||
network/userrepository.cpp \
|
||||
alpm/alpmpackage.cpp \
|
||||
alpm/aurpackage.cpp \
|
||||
alpm/alpmdatabase.cpp \
|
||||
alpm/repository.cpp \
|
||||
alpm/upgradelookup.cpp \
|
||||
alpm/suggestionslookup.cpp \
|
||||
alpm/packageinfolookup.cpp \
|
||||
alpm/packagelookup.cpp \
|
||||
alpm/packagefinder.cpp
|
||||
|
||||
OTHER_FILES += \
|
||||
README.md \
|
||||
LICENSE \
|
||||
CMakeLists.txt \
|
||||
resources/config.h.in \
|
||||
resources/windows.rc.in \
|
||||
resources/systemd/repoindex.service \
|
||||
resources/settings/repoindex.conf.js
|
||||
|
||||
DISTFILES += \
|
||||
web/index.html \
|
||||
web/js/pagination.js \
|
||||
web/js/entrymanagement.js \
|
||||
web/js/packagemanagement.js \
|
||||
web/js/groupmanagement.js \
|
||||
web/js/pagemanagement.js \
|
||||
web/js/repomanagement.js \
|
||||
web/js/proto.js \
|
||||
web/js/utils.js \
|
||||
web/css/core.css \
|
||||
web/css/dashboard.css \
|
||||
web/js/client.js \
|
||||
web/3rdparty/bootstrap/css/bootstrap.min.css \
|
||||
web/3rdparty/bootstrap_dropdowns_enhancement/css/dropdowns-enhancement.min.css \
|
||||
web/3rdparty/bootstrap/js/bootstrap.min.js \
|
||||
web/3rdparty/bootstrap_dropdowns_enhancement/js/dropdowns-enhancement.js
|
||||
|
||||
|
||||
# libs and includepath
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -lc++utilitiesd
|
||||
} else {
|
||||
LIBS += -lc++utilities
|
||||
}
|
||||
|
||||
# installs
|
||||
target.path = $$(INSTALL_ROOT)/bin
|
||||
INSTALLS += target
|
Loading…
Reference in New Issue