arch4edu / aur-auto-update

Automatically update PKGBUILDs on AUR
26 stars 9 forks source link

[Question] custom upgrade script #48

Closed alllexx88 closed 6 months ago

alllexx88 commented 6 months ago

Hi,

README.md says

  • (Optional) Write the corresponding update/${pkgbase}.sh for your package if necessary.
    • The default script update/default.sh will automatically strip the leading non-version characters, and is suitable for versions like 1.0.0, v1.0.0, version-1.0.0.

However, there's no update/default.sh in the current version, so I don't understand how to create custom upgrade scripts, and where to put them.

I was thinking how to configure the auto update bot for an AUR package like telegram-desktop-dev-bin. We can get the latest release (including pre-releases) with a regex:

nvchecker:
  source: regex
  url: https://api.github.com/repos/telegramdesktop/tdesktop/releases
  regex: https://github\.com/telegramdesktop/tdesktop/releases/download/v([0-9\.]+)/tsetup\.[0-9\.]+(?:\.beta)?\.tar\.xz

This is better than using a github source like this:

nvchecker:
  github: telegramdesktop/tdesktop
  source: github
  use_latest_release: true
  prefix: v
  include_prereleases: true

(since potentially a release could not have a linux binary, like when 4.14.15 has only a linux binary)

However, getting the latest version is not enough, since source url is different for beta releases:

https://github.com/telegramdesktop/tdesktop/releases/download/v${pkgver}/tsetup.${pkgver}.beta.tar.xz vs https://github.com/telegramdesktop/tdesktop/releases/download/v${pkgver}/tsetup.${pkgver}.tar.xz

and we also need to set _dev=1 in the PKGBUILD for a beta realease, and to something else, like _dev=0, for stable releases: PKGBUILD.

I think this can easily be tested with a grep over https://api.github.com/repos/telegramdesktop/tdesktop/releases content, but the bot would require a custom upgrade script to set the variable accordingly.

I'm not the maintainer of this package, but I'm curious if it's doable, and how?

Thanks :smiley:

petronny commented 6 months ago

However, there's no update/default.sh in the current version, so I don't understand how to create custom upgrade scripts, and where to put them.

The readme is out-of-date but I still don't have time to update it now. Sorry.

We still have this mechanism to override the upgrade script. As shown in https://github.com/arch4edu/aur-auto-update/blob/main/.github/workflows/build.yml#L102, if there is a file named pkgbase.override, then it will be used to replace bin/update-pkgver.

This mechanism is some sort of unsafe. Please only use it when it's truely necessary.

alllexx88 commented 6 months ago

Thank you for your reply @petronny , I appreciate it!