-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Implement a method of retrieving the package update time #155
base: main
Are you sure you want to change the base?
Conversation
The package update time is based on the last update of the _source_ pacakge, not the binary package. To do this, I have a server application, currently hosted on piggz.co.uk:8081 which uses the OBS API to build a JSON model, relating projects, packages, repositories and binaries. To find the package mtime, you iterate the model, searching for the project, then find the repository matching the current device, then look for the package in the binaries. WHen the pacakge is found from the binary, get the mtime from the source package list. Currently I dont know how to get the repo name from SSU, therfore the arch is hardcoded as aarch64. Included some simple update to the QML to show the update time, nothing more complicated such as a section of "recently udpated apps" Server code will be posted later for comment, it could certainly be improved (currently a single large cache), and Im happy for others to take this on if the idea is sound.
I would suggest to make Next, I suggest to update the list of packages in Chum or make separate singleton for it. ChumPackagesModel is not a good choice as it is used for different package listing sorting and presentation. That's the one we will expand to make Recent list as well. Look how chumModel is created in PackagesListPage. Would be bad to update the list every time the user moves to a new page ... When moved JSON list handling to Chum, we can drop ChumPackagesModel.busy and use Chum.busy as it is done already. In terms of http://piggz.co.uk:8081/ - would be way better to load data only for active repository. Right now it is rather large download (5MB) and took 43 seconds over here. But that could be done later as well. I guess some REST API or similar is needed. Would be good to also have a timestamp file/facility showing when the latest list was generated to avoid loading it if it is not needed. ... Hmm, looking at this file - we probably can just keep mtime section in JSON. No need to have all those packages listed in
Don't follow, sorry. Note that older SFOS releases don't have aarch64 BTW, I accidently looked into https://repology.org/ . While they have Suse support (and probably via OBS), they don't list modified times in their API, unfortunately. Otherwise we could have used that for a backend... |
My thoughts:
|
I do not propose to keep the server on piggz.co.uk, that is just for WIP/demo, it would obviously be better somewhere else, and am open to ideas for this.....
There are 2 problems here, 1, OBS API requires credentials, atm, the server app is using my credentials to build the cache.
|
I think having some kind of extra service is the best way for now. It could be on @piggz domain or some cloud storage. Probably we would need some PC running check once in a while and updating that JSON. As for dependence on some person, yes, that's what comes with SFOS in general. Re general concerns, I'll reply in the other thread. |
Load the cache as the first step in refreshing the repository details and implement the mtime parameter as a property of the package like all other properties.
@rinigus Ive implemented all your comments. The cache is entirely optional, if cache loading fails, then you are in no worse off situation. I still need to implement the architecture detection to create the correct repository name for searching. Next step will be to post the server code and get comments on that. |
Server app is here Obvious improvements would be to generate separate caches for different releases, using GET params to get the required version, therefore making the download smaller, though at the moment it is nice and simple, and doesnt require many NPM modules, relying on only GET and POST |
chum-package-cache has just README, no code :) |
it does now :) |
BusyIndicator { | ||
size: BusyIndicatorSize.Large | ||
anchors.centerIn: parent | ||
running: chumModel.busy == true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed - whole BusyIndicator - as we have busy state in Chum
@@ -78,7 +85,7 @@ Page { | |||
} | |||
|
|||
onClicked: pageStack.push(Qt.resolvedUrl("../pages/PackagePage.qml"), { | |||
pkg: Chum.package(model.packageId) | |||
pkg: Chum.package(model.packageId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg: Chum.package(model.packageId), | |
pkg: Chum.package(model.packageId) |
#include <QJsonObject> | ||
#include <QJsonArray> | ||
|
||
static char* apiUrl = "http://piggz.co.uk:8081"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to add that as MACRO and set it in CMakeLists.txt
m_chumPackageCache = QJsonDocument::fromJson(reply->readAll()); | ||
qDebug() << "Received chum package cache"; | ||
} | ||
m_busy = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should stay on busy=true
as SSU gets loaded as well. As it should be called after network access manager is finished, state busy==true
is expected and we don't need to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, aren't we expected to call reply->deleteLater()
?
|
||
QDateTime Chum::findPackageMTime(const QString &rpm) const | ||
{ | ||
qDebug() << Q_FUNC_INFO << rpm << Chum::instance()->repoName() << Chum::instance()->repoVersion(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use Chum::instance if we have it in this
?
QString repoName() { return m_ssu.repoName();} | ||
QString repoVersion() { return m_manualVersion.isEmpty() ? m_ssu.deviceVersion() : m_manualVersion; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess those are not needed anymore
@@ -261,6 +264,12 @@ void ChumPackage::setPackagerLogin(const QString &login) { | |||
SET_IF_EMPTY(m_packager_login, PackagePackagerRole, login); | |||
} | |||
|
|||
void ChumPackage::setPackageMTime(const QDateTime &mtime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not called anymore
@@ -119,6 +122,7 @@ class ChumPackage : public QObject { | |||
void setForksCount(int count); | |||
void setIssuesCount(int count); | |||
void setPackagerLogin(const QString &login); | |||
void setPackageMTime(const QDateTime &mtime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
@@ -49,6 +49,7 @@ class ChumPackagesModel | |||
void filterUpdatesOnlyChanged(); | |||
void searchChanged(); | |||
void showCategoryChanged(); | |||
void busyChanged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed
@@ -25,6 +26,9 @@ Ssu::Ssu(QObject *parent) : | |||
QDBusConnection::systemBus(), | |||
parent ) | |||
{ | |||
QDBusReply<QString> version = call(QStringLiteral("release"), false); | |||
m_device_version = version; | |||
qDebug() << "Device version:" << m_device_version; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users can override repo version. We should get real URL and use that, as described above
Off topic: Honestly (and frankly, as usual), IMO fixing the bugs which severely affect basic functionality of the SailfishOS:Chum GUI app should be prioritised higher than new features, specifically technically complex ones, which hence are complicated to implement. Specifically I consider the bugs #184 and #165 / #103 as pretty bad, because both describe a specific core-function of the GUI app as fundamentally broken. Plus bug #186 appears to be a very "how hanging fruit" (should be trivial to address for someone QML savvy). Furthermore feature request #86, plus likely also #105 and #126 appear to be easy to implement for a much larger gain that displaying the correct package update time. But as usual, as we all are doing this in our spare time, for a good part it is fine to prioritise things to their fun factor; to a certain extent, because IMO developers / maintainers should (but not "must") assume a little responsibility for their software. |
Yes, spring cleaning should be done. And I agree, #184 is rather annoying one. Would prioritize that. Will try to check others as well. |
Oh, neither the DNS name nor you as a person was something I intended to address.
AFAIU this does not need to be a permanently running service: Its data gathering is rather cyclical and its output simply must be accessible by clients, i.e. downloadable via HTTPS. This would allow for using the regular access privileges at GitHub in order to avoid a "single person" single point of failure and the infrastructure is guaranteed to be kept nearly 100% available by others (i.e., GH staff). |
The package update time is based on the last update of the source pacakge, not the binary package. To do this, I have a server application, currently hosted on piggz.co.uk:8081 which uses the OBS API to build a JSON model, relating projects, packages, repositories and binaries.
To find the package mtime, you iterate the model, searching for the project, then find the repository matching the current device, then look for the package in the binaries. WHen the pacakge is found from the binary, get the mtime from the source package list.
Currently I dont know how to get the repo name from SSU, therfore the arch is hardcoded as aarch64.
Included some simple update to the QML to show the update time, nothing more complicated such as a section of "recently udpated apps"
Server code will be posted later for comment, it could certainly be improved (currently a single large cache), and Im happy for others to take this on if the idea is sound.