flatpak / flatpak-builder-tools

Various helper tools for flatpak-builder
194 stars 107 forks source link

[Feature Request] Add a script to bump version number in appstream data and generate sources #183

Open proletarius101 opened 3 years ago

proletarius101 commented 3 years ago

Since there's a x-checker-data block in the build metadata, I believe the flatpak devs and flathub maintainers are aware of the needs to update packages upon upstream changes.

However, for python/node apps that require generating a sources.json, the update procedure can not be automated this way, because there's no mechanism to generate the sources.json and bump the version number when the upstream code is updated.

Detecting the current version from package.json is as easy as jq -r ".version" package.json (we need also to consider the two-package.json paradigm too). Updating dependencies is also possible. Even if the auto update process can not be baked into the flathub bot, it can also be baked into some github actions

gasinvein commented 3 years ago

I don't understand why such feature should be part of the sources generator.

there's no mechanism to generate the sources.json and bump the version number when the upstream code is updated

There are plans to run flatpak-external-data-checker from a per repo action, in turn, making it safe to allow running arbitrary code from that repo. We can then add an option to run a generator after the app manifest is updated.

Even if the auto update process can not be baked into the flathub bot, it can also be baked into some github actions

Why do you need the generator to do the manifest update? If using a custom github action, you can update manifest and appdata with a custom script. Some apps already do this, although it's discouraged.

proletarius101 commented 3 years ago

I realize that the flathub-bot will update the generated-source.json https://github.com/flathub/org.standardnotes.standardnotes/commit/f9aa21b2def7475192003ead151d0d14e0aff7a5

Why do you need the generator to do the manifest update? If using a custom github action, you can update manifest and appdata with a custom script. Some apps already do this, although it's discouraged.

Thanks, that's helpful. Not sure why it's discouraged. Most of the update steps except that are already automated, which means apps except those who don't generate an appstream data can update without human interference. However, I then realize the flathub-bot can also do that: https://github.com/flathub/com.visualstudio.code.insiders/commit/04196e8b6eae8789f49e774033107c46c4a883de. So probably x-checker-data will just do all the magic, and all this FR tries to propose are actually already implemented.

gasinvein commented 3 years ago

I realize that the flathub-bot will update the generated-source.json flathub/org.standardnotes.standardnotes@f9aa21b

Actually, this looks like a bug. It shouldn't touch generated-sources, and usually it doesn't (it ignores files larger than 100Kb or so). In your case, flatpak-external-data-checker just replaced sha512 checksums with sha256 ones.

proletarius101 commented 3 years ago

Actually, this looks like a bug. It shouldn't touch generated-sources, and usually it doesn't (it ignores files larger than 100Kb or so). In your case, flatpak-external-data-checker just replaced sha512 checksums with sha256 ones.

Well, OK, so actually I still hope it will be integrated into the bot, as it's the only part we need to use a github action other than do it by the bot?

But as you said it might be rather a bot issue, not the source generator's. So I should rather open an issue somewhere else (where? I don't see a repo for the bot)

gasinvein commented 3 years ago

Yes, it would be quite useful if the flatpak-external-data-checker could run sources generators on updates. You can file a feature request there to increase its visibility. Currently it's not safe to allow this due to how scheduled tasks are organized on Flathub, but hopefully it will be possible in future.