some fixes

This commit is contained in:
Martchus 2016-03-09 15:56:06 +01:00
parent 415e25ed61
commit 74ca6aea8e
7 changed files with 96 additions and 72 deletions

View File

@ -57,6 +57,7 @@ private:
DatabaseError AlpmDatabase::loadDescriptions(QList<QPair<QString, QList<QByteArray> > > &descriptions, ChronoUtilities::DateTime *lastModified)
{
if(!databasePath().isEmpty()) {
QFileInfo pathInfo(databasePath());
if(pathInfo.isDir()) {
if(lastModified) {
@ -130,6 +131,9 @@ DatabaseError AlpmDatabase::loadDescriptions(QList<QPair<QString, QList<QByteArr
return DatabaseError::NotFound;
}
return DatabaseError::NoError;
} else {
return DatabaseError::NotFound;
}
}
AlpmPackageLoader::AlpmPackageLoader(AlpmDatabase *repository, PackageOrigin origin) :

View File

@ -355,10 +355,10 @@ void RepoEntry::load(const QJsonValue &jsonValue)
m_dataBaseFile = obj.value(QStringLiteral("dataBaseFile")).toString(m_dataBaseFile);
m_sourceDir = obj.value(QStringLiteral("sourcesDir")).toString(m_sourceDir);
m_packageDir = obj.value(QStringLiteral("packagesDir")).toString(m_packageDir);
for(const auto &server : obj.value(QStringLiteral("servers")).toArray()) {
for(const auto &server : obj.value(QStringLiteral("server")).toArray()) {
auto str = server.toString();
if(!str.isEmpty()) {
m_servers << str;
m_server << str;
}
}
for(const auto &upgradeSources : obj.value(QStringLiteral("upgradeSources")).toArray()) {

View File

@ -65,7 +65,7 @@ public:
const QString &databasePath() const;
const QString &sourceDir() const;
const QString &packageDir() const;
const QStringList &servers() const;
const QStringList &server() const;
const QStringList &upgradeSources() const;
SignatureLevel sigLevel() const;
ChronoUtilities::TimeSpan maxDatabaseAge() const;
@ -77,7 +77,7 @@ private:
QString m_dataBaseFile;
QString m_sourceDir;
QString m_packageDir;
QStringList m_servers;
QStringList m_server;
QStringList m_upgradeSources;
SignatureLevel m_sigLevel;
ChronoUtilities::TimeSpan m_maxDatabaseAge;
@ -104,9 +104,9 @@ inline const QString &RepoEntry::packageDir() const
return m_packageDir;
}
inline const QStringList &RepoEntry::servers() const
inline const QStringList &RepoEntry::server() const
{
return m_servers;
return m_server;
}
inline const QStringList &RepoEntry::upgradeSources() const

View File

@ -414,6 +414,9 @@ void Manager::addDatabasesFromRepoIndexConfig()
syncDb->setMaxPackageAge(repoEntry.maxDatabaseAge());
}
} else {
if(repoEntry.isIgnored()) {
continue;
}
if(repoEntry.name().compare(QLatin1String("local"), Qt::CaseInsensitive) == 0) {
cerr << shchar << "Error: Unable to add database from repo index config: The database name mustn't be \"local\" because this name is reserved for the local database." << endl;
} else if(repoEntry.name().startsWith(QLatin1String("aur"), Qt::CaseInsensitive)) {
@ -451,7 +454,7 @@ void Manager::addDatabasesFromRepoIndexConfig()
}
}
if(syncDb) {
syncDb->serverUrls() << repoEntry.servers();
syncDb->serverUrls() << repoEntry.server();
}
}
@ -1032,6 +1035,7 @@ QString Manager::findDatabasePath(const QString &name, bool updatesRequired, boo
if(printError) {
cerr << shchar << "Error: Unable to locate database file for [" << name.toLocal8Bit().data() << "]" << endl;
}
return QString();
}
/*!

View File

@ -26,7 +26,7 @@
"//add": [
{"name": "examplerepo",
"maxAge": 3600
"maxAge": 3600,
"dataBaseFile": "path/to/database/file",
"sourcesDir": "path/to/local/source/dir",
"packagesDir": "path/to/local/pkg/dir",

View File

@ -29,7 +29,7 @@
"packagesDir": "/run/media/devel/repo/arch/ownstuff/os/x86_64",
"upgradeSources": ["aur"],
"server": [
"https://localhost/repo/arch/$repo/os/$arch"
"https://localhost/repo/arch/ownstuff/os/x86_64"
],
"maxAge": 3600
},
@ -40,14 +40,28 @@
{"name": "community", "maxAge": 28800},
{"name": "multilib", "maxAge": 28800},
{"name": "kde-unstable",
"server": [
"https://ftp.fau.de/archlinux/kde-unstable/os/x86_64"
],
"maxAge": 28800
},
{"name": "gnome-unstable",
"ignored": true,
"server": [
"https://ftp.fau.de/archlinux/gnome-unstable/os/x86_64"
],
"maxAge": 28800
},
{"name": "ownstuff-testing",
"ignore": true,
"ignored": true,
"sourcesDir": "path/to/local/source/dir",
"packagesDir": "/run/media/devel/repo/arch/ownstuff-testing/os/x86_64",
"upgradeSources": ["aur"],
"server": [
"https://localhost/repo/arch/$repo/os/$arch"
"https://localhost/repo/arch/ownstuff-testing/os/x86_64"
]
}
]

View File

@ -19,6 +19,8 @@
this.rowElement.onmousedown = function(e) {
if(!repoindex.isFirefox) {
repoindex.pageManager.packageManager.showPackageInfoForIndex(this.entry.index, typeof e === "object" && (e.button === 1 || e.button === 2));
} else if(e.button === 0) {
repoindex.pageManager.packageManager.showPackageInfoForIndex(this.entry.index, false);
}
};
this.rowElement.oncontextmenu = function(e) {