some fixes
This commit is contained in:
parent
415e25ed61
commit
74ca6aea8e
|
@ -57,79 +57,83 @@ private:
|
|||
|
||||
DatabaseError AlpmDatabase::loadDescriptions(QList<QPair<QString, QList<QByteArray> > > &descriptions, ChronoUtilities::DateTime *lastModified)
|
||||
{
|
||||
QFileInfo pathInfo(databasePath());
|
||||
if(pathInfo.isDir()) {
|
||||
if(lastModified) {
|
||||
// just use current date here since this is usually the local db
|
||||
*lastModified = DateTime::gmtNow();
|
||||
}
|
||||
static const QStringList relevantFiles = QStringList() << QStringLiteral("desc") << QStringLiteral("files");
|
||||
QDir dbDir(databasePath());
|
||||
QStringList pkgDirNames = dbDir.entryList(QDir::Dirs | QDir::Readable | QDir::Executable | QDir::NoDotAndDotDot);
|
||||
descriptions.reserve(pkgDirNames.size());
|
||||
for(QString &pkgDirName : pkgDirNames) {
|
||||
if(dbDir.cd(pkgDirName)) {
|
||||
Utilities::stripVersion(pkgDirName);
|
||||
const QStringList descFileNames = dbDir.entryList(relevantFiles, QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
|
||||
QList<QByteArray> descData;
|
||||
descData.reserve(descFileNames.size());
|
||||
for(const QString &descFileName : descFileNames) {
|
||||
QFile descFile(dbDir.absoluteFilePath(descFileName));
|
||||
if(descFile.open(QFile::ReadOnly)) {
|
||||
descData << descFile.readAll();
|
||||
} else {
|
||||
return DatabaseError::UnableToOpenDescFile;
|
||||
}
|
||||
}
|
||||
if(!descData.isEmpty()) {
|
||||
descriptions << qMakePair(pkgDirName, descData);
|
||||
}
|
||||
dbDir.cdUp();
|
||||
} else {
|
||||
return DatabaseError::UnableToEnterDirectory;
|
||||
if(!databasePath().isEmpty()) {
|
||||
QFileInfo pathInfo(databasePath());
|
||||
if(pathInfo.isDir()) {
|
||||
if(lastModified) {
|
||||
// just use current date here since this is usually the local db
|
||||
*lastModified = DateTime::gmtNow();
|
||||
}
|
||||
}
|
||||
} else if(pathInfo.isFile()) {
|
||||
if(lastModified) {
|
||||
*lastModified = DateTime::fromTimeStampGmt(pathInfo.lastModified().toUTC().toTime_t());
|
||||
}
|
||||
KTar tar(databasePath());
|
||||
const KArchiveDirectory *dbDir;
|
||||
if(tar.open(QIODevice::ReadOnly) && (dbDir = tar.directory())) {
|
||||
QStringList pkgDirNames = dbDir->entries();
|
||||
static const QStringList relevantFiles = QStringList() << QStringLiteral("desc") << QStringLiteral("files");
|
||||
QDir dbDir(databasePath());
|
||||
QStringList pkgDirNames = dbDir.entryList(QDir::Dirs | QDir::Readable | QDir::Executable | QDir::NoDotAndDotDot);
|
||||
descriptions.reserve(pkgDirNames.size());
|
||||
for(QString &pkgDirName : pkgDirNames) {
|
||||
if(const auto *pkgEntry = dbDir->entry(pkgDirName)) {
|
||||
if(pkgEntry->isDirectory()) {
|
||||
Utilities::stripVersion(pkgDirName);
|
||||
const auto *pkgDir = static_cast<const KArchiveDirectory *>(pkgEntry);
|
||||
const QStringList descFileNames = pkgDir->entries();
|
||||
QList<QByteArray> descData;
|
||||
descData.reserve(descFileNames.size());
|
||||
for(const QString &descFileName : descFileNames) {
|
||||
if(const auto *descEntry = pkgDir->entry(descFileName)) {
|
||||
if(descEntry->isFile()) {
|
||||
descData << static_cast<const KArchiveFile *>(descEntry)->data();
|
||||
} else {
|
||||
// there shouldn't be any subdirs anyways
|
||||
}
|
||||
}
|
||||
if(dbDir.cd(pkgDirName)) {
|
||||
Utilities::stripVersion(pkgDirName);
|
||||
const QStringList descFileNames = dbDir.entryList(relevantFiles, QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
|
||||
QList<QByteArray> descData;
|
||||
descData.reserve(descFileNames.size());
|
||||
for(const QString &descFileName : descFileNames) {
|
||||
QFile descFile(dbDir.absoluteFilePath(descFileName));
|
||||
if(descFile.open(QFile::ReadOnly)) {
|
||||
descData << descFile.readAll();
|
||||
} else {
|
||||
return DatabaseError::UnableToOpenDescFile;
|
||||
}
|
||||
if(!descData.isEmpty()) {
|
||||
descriptions << qMakePair(pkgDirName, descData);
|
||||
}
|
||||
} else {
|
||||
// there shouldn't be any files anyways
|
||||
}
|
||||
if(!descData.isEmpty()) {
|
||||
descriptions << qMakePair(pkgDirName, descData);
|
||||
}
|
||||
dbDir.cdUp();
|
||||
} else {
|
||||
return DatabaseError::UnableToEnterDirectory;
|
||||
}
|
||||
}
|
||||
} else if(pathInfo.isFile()) {
|
||||
if(lastModified) {
|
||||
*lastModified = DateTime::fromTimeStampGmt(pathInfo.lastModified().toUTC().toTime_t());
|
||||
}
|
||||
KTar tar(databasePath());
|
||||
const KArchiveDirectory *dbDir;
|
||||
if(tar.open(QIODevice::ReadOnly) && (dbDir = tar.directory())) {
|
||||
QStringList pkgDirNames = dbDir->entries();
|
||||
descriptions.reserve(pkgDirNames.size());
|
||||
for(QString &pkgDirName : pkgDirNames) {
|
||||
if(const auto *pkgEntry = dbDir->entry(pkgDirName)) {
|
||||
if(pkgEntry->isDirectory()) {
|
||||
Utilities::stripVersion(pkgDirName);
|
||||
const auto *pkgDir = static_cast<const KArchiveDirectory *>(pkgEntry);
|
||||
const QStringList descFileNames = pkgDir->entries();
|
||||
QList<QByteArray> descData;
|
||||
descData.reserve(descFileNames.size());
|
||||
for(const QString &descFileName : descFileNames) {
|
||||
if(const auto *descEntry = pkgDir->entry(descFileName)) {
|
||||
if(descEntry->isFile()) {
|
||||
descData << static_cast<const KArchiveFile *>(descEntry)->data();
|
||||
} else {
|
||||
// there shouldn't be any subdirs anyways
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!descData.isEmpty()) {
|
||||
descriptions << qMakePair(pkgDirName, descData);
|
||||
}
|
||||
} else {
|
||||
// there shouldn't be any files anyways
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return DatabaseError::UnableToOpenArchive;
|
||||
}
|
||||
} else {
|
||||
return DatabaseError::UnableToOpenArchive;
|
||||
return DatabaseError::NotFound;
|
||||
}
|
||||
return DatabaseError::NoError;
|
||||
} else {
|
||||
return DatabaseError::NotFound;
|
||||
}
|
||||
return DatabaseError::NoError;
|
||||
}
|
||||
|
||||
AlpmPackageLoader::AlpmPackageLoader(AlpmDatabase *repository, PackageOrigin origin) :
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue