getsolus / solbuild

The Solus package build system
https://getsol.us
Apache License 2.0
21 stars 12 forks source link

Allow for multiple sources to have the same name - rebased #21

Closed JacekJagosz closed 2 years ago

JacekJagosz commented 2 years ago

4 Is still needed to build rocm-opencl, so I rebased that @Tzigamm 's patch, built solbuild and verified it now works.

joebonrichie commented 2 years ago

Logic is a bit borked, overrides the first source with the second source only then appends a .1 to it. Not sure how it worked previously.

JacekJagosz commented 2 years ago

There is another that needs to be fixed I already encountered with patches to ypkg. I am wondering if it is even worth it to change so much code just for this feature. I need to build 2 packages that both have 2 sources with the same name - "rocm.tar.gz". I build the first package, the sources get cached. I want to build the second one, and it fails because it already has cached sources with the correct name, but their hash is different (because they are different sources). So you will need to change caching algorithm as well, so it re-downloads a source if the hash doesn't match. So, do you think it is worth doing so many changes to solbuild? Or should we just rename sources and host it somewhere else, as it is only 4 files, and probably no other package ever will need this functionality?

JacekJagosz commented 2 years ago

And as for this patch, the code is somewhat correct but it has simply been applied in an incorrect function. Right now it is linking already downloaded sources to the chroot. But that is too late, already the first source of the same got overwritten by the second one. All the changes done in this commit can be removed and instead similar code should be put in FetchSources() instead. Then if it sees a source with the same filename it will download the new source with a different filename, so no file gets overwritten. Edit: It is even harder than I expected, you can't get access to SimpleSource as in that function you are not accessing it but the Source interface. So you would also need at least another function in that interface. Or parse that somewhere earlier in the code and detect duplicate file names. At this point I really don't think it is worth it.

JacekJagosz commented 2 years ago

As discussed on #solus-dev this approach doesn't make much sense. It will be much easier to implement renaming of a fetched file instead of supporting multiple sources with the same name.