Closed JimboJoe closed 6 years ago
We already have a helper to handle that https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_abort_if_up_to_date/ynh_abort_if_up_to_date_2
Is this one different ?
Yes, it's different in the fact that the upgrade script can make other upgrade actions (change the nginx or other configuration files), while not touching the upstream application itself if not needed. The mentioned script aborts the upgrade all the way.
OK But unless I missed something, the real difference is here there no exit 0. I think that it would be better to keep only one helper, and merge this one with the existing one.
Well, the two scripts don't compare the same things: this one compares the "upstream part" (before ~ynh) of the package versions, whereas the other one compares the global version (and could eventually be managed in the core).
The existing helper check the whole version number, with ~ynh, but without checking the 2 parts separately.
But, as I understand, if the whole version number don't change, we don't have to update anything. But, if one or the other part of the version number is different, then we could update a part of the app.
Then, wouldn't be interesting to update the existing helper to be more clever and be able to check the 2 parts of the version number and give an exit code (like this helper) according to what should be done? Or simply exit if there's nothing to do.
Then a principle could be:
Set a check_app_version_changed
helper that returns:
UPSTREAM
if the upstream version has changedYNH_APP
if only the YunoHost app has changedynh_die
if version unchanged.Does that sound legit?
Yes, that sounds good to me
Here is an attempt to merge the two helpers (unit-tested). What do you think?
That seems good. Maybe just change the return values, UPSTREAM_APP and YNH_APP by something clearer about the use case of each of them. Because these values are going to be used in the upgrade scripts. Maybe something like UPGRADE_APP and UPGRADE_PACKAGE.
This helper should be used to avoid an upgrade of the upstream version when it's not needed (but yet allowing to upgrade other parts of the YunoHost application (e.g. nginx conf).
Currently used in Discourse package.