arcan1s / ahriman

ArcH linux ReposItory MANager
https://ahriman.readthedocs.io
GNU General Public License v3.0
32 stars 2 forks source link

Changing `source` variable not working #137

Open SergeantBiggs opened 4 days ago

SergeantBiggs commented 4 days ago

Describe your question below

I'm not sure if this is a "question" or a bug so I'll label it as a question first.

I'm trying to use ahriman to change the source variable of an AUR package. The reason is that the original package (unreal-engine-bin) wants the user to download the package manually and put it in the same directory. I was trying to automate this by downloading the file manually beforehand and changing the source to point to a web server I control, like so:

source=("https://example.com/path-to-file/Linux_Unreal_Engine_${pkgver}.zip" 'unreal-engine.desktop' 'unreal-engine.xml' {16,24,32,48,64,256}.png)

I've tried changing this using patch-set-add, but when I execute package-add the changes do not seem to be applied (it just tries to find the source in the same folder the PKGBUILD is instead of downloading it via HTTPS. Is there some step I'm missing? Or does patch-set-add just not work with the source variable? If I change the line using patch-add:

("https://example.com/path-to-file/Linux_Unreal_Engine_${pkgver}.zip" 'unreal-engine.desktop' 'unreal-engine.xml' {16,24,32,48,64,256}.png)

I get the following error: ERROR: Unknown download protocol: ["https Maybe I'm just misunderstanding something in these options. Very grateful for any help you could give me on this. Thanks!

arcan1s commented 1 day ago

here is a bit detailed description of the idea with some examples https://github.com/arcan1s/ahriman/issues/125#issuecomment-2102464589, the link to the docs is a little bit broken now though, the correct one should be https://ahriman.readthedocs.io/en/stable/faq/general.html#how-to-change-pkgbuilds-before-build, which also describes behavior, though with less amount of examples.

Regarding your question, I always recommend to use patch-add instead of dealing with full-scale diff, because the second one is much harder to maintain (though it might be useful sometimes).


Regarding the case you describe. There is a bug (not sure if it was introduced in https://github.com/arcan1s/ahriman/pull/126 or was it always broken because the lack of testing), which leads to incorrect reading of the value from the database (it is always read as string).

On top of that, there is another case, which causes values to be serialized (sometimes) inside quotes. Unfortunately, it this scenario (actually considering your example above) it leads to link to be serialized as 'https://example.com/path-to-file/Linux_Unreal_Engine_${pkgver}.zip', because the application relies on the builtin shlex library which uses single quotes (') on top level

Let me check both issues and I'll decide later will it be hotfix or the next planned release