vn971 / rua

Build tool for Arch Linux providing control, review and jailed build options
GNU General Public License v3.0
425 stars 41 forks source link

Patching PKGBUILD/.SRCINFO should immediately impact the dependency tree #209

Open jookuuj opened 1 year ago

jookuuj commented 1 year ago

Hi! First of all, thanks for making rua! It's very useful tool. There is one feature that I would like to have and that's allowing patching PKGBUILD files. I'm using rua 0.19.7 from AUR.

Steps to reproduce:

  1. download and build rua from AUR
  2. run "rua install fvwm"
  3. diff and merge the PKBGUILD in rua
  4. drop into a shell in rua (press t)
  5. nano PKGBUILD
  6. remove the libstroke form .SRCINFO and PKGBUILD (from both depends= array and autoconfig's ./configure line).
  7. save and quit nano. Exit the spawned shell with "exit".
  8. rua still requires the libstroke depecency (as if the PKGBUILD wasn't edited at all)

Expected behavior: rua wouldn't pull in libstroke and that it would respect the local edits that I made in the PKGBUILD file. Quitting and restarting rua install doesn't fix the issue.

vn971 commented 1 year ago

Hi @jookuuj, thank you! This flow should actually work :thinking: I'm using this feature myself occasionally.

Could you please paste the logs of the build? I'll take a look. If you do, please include the commands ls -aFl, cat .SRCINFO and cat PKGBUILD while inspecting and editing in the shell. (Or bat --paging=never .SRCINFO even better if you have bat)

You can also verify if these changes persist and are visible if you look in ~/.config/rua/pkg by the way

jookuuj commented 1 year ago

I have attached the PKGBUILD, .SRCINFO file and the output of ls -aFl:

But I'm not sure where the build logs are. Do you mean the .BUILDINFO file that's in ~/.cache/rua/build/fvwm/pkg/fvwm/ directory? Sorry, I have never looked up any makepkg logs. I tried googling but I didn't find a solution.

I also checked and the changes are indeed there in ~/.config/rua/pkg/fvwm/ directory.

vn971 commented 1 year ago

where the build logs are

I mean, can you run your command in the terminal and copy-paste the output? rua install fvwm

I want to see if the error comes from makepkg/rua/pacman themselves, or if libstroke is just an inherent dependency that fails the build after we start building fvwm. (I suspect the latter, but I'd want to confirm.)

jookuuj commented 1 year ago

Here is what rua outputs when I run "rua install fvwm":

$ rua install fvwm
Package fvwm depends on libstroke. Resolving...

In order to install all targets, the following pacman packages will need to be installed:
  python-xdg

And the following AUR packages will need to be built and installed:
  libstroke
  fvwm

Proceed? [O]=ok, Ctrl-C=abort. o
WARNING: your AUR repo is up-to-date.
If you continue, the build directory will be removed and the build will be re-run.
If you don't want that, consider resolving the situation manually,
for example:    rua builddir '/home/hackerman/.cache/rua/build/libstroke'

Reviewing "/home/hackerman/.config/rua/pkg/libstroke".
[S]=run shellcheck on PKGBUILD, [D]=(identical to upstream, empty diff), [T]=run shell to edit/inspect, [O]=ok, use package. o
WARNING: your AUR repo is up-to-date.
If you continue, the build directory will be removed and the build will be re-run.
If you don't want that, consider resolving the situation manually,
for example:    rua builddir '/home/hackerman/.cache/rua/build/fvwm'

Reviewing "/home/hackerman/.config/rua/pkg/fvwm".
[S]=run shellcheck on PKGBUILD, [D]=view your changes, [T]=run shell to edit/inspect, [O]=ok, use package. o
Packages need to be installed:

    pacman -S --asdeps --needed -- 'python-xdg'

Enter S to `sudo` install it, or install manually and press M when done.

After I hit S to install python-xdg and let Pacman install it, rua starts building libstroke from AUR, even though the PKGBUILD has been edited to remove it from dependencies of FVWM. I also tested building FVWM using plain old makepkg (with same edits to PKGBUILD and .SRCINFO) and it worked.

vn971 commented 1 year ago

Thanks for the report and the details! I see the logic now. rua tries first to analyze the dependency chain, and then later to build it. Editing .SRCINFO doesn't have any effect then, because the "packages list to install" is already defined at that moment.

I'm not 100% how to proceed here.

The alternative 3 seems the best from the UX (user experience) perspective, does it?

Any ideas are welcomed

jookuuj commented 1 year ago

I agree. The option 3 is the best in my opinion. Sadly, I don't know much coding (I'm currently learning Python), so I can't help much with this issue.

marrs commented 1 year ago

I'm having the same issue as OP with the same version of rua.

I'm trying to install antares-sql with the following command

$ rua install antares-sql
Package antares-sql depends on electron17-bin. Resolving...

And the following AUR packages will need to be built and installed:
  electron17-bin
  antares-sql

Proceed? [O]=ok, Ctrl-C=abort. ^C

I already have a newer version of Electron 17 installed with electron17, so I abort. What I want to do at this stage is be given the ability to change the deps of the BUILDPKG to refer to the preferred dependency. Ideally, I'd be able to do this just by editing the file, but if that's not an option then the ability to modify BUILDPKG from within rua would be nice, like you have when you upgrade packages.

I don't really understand the purpose of ignoring changes to the local repo for a package. Is that deliberate?

vn971 commented 1 year ago

Hi @marrs, the somewhat lenghty reply to your post is actually above.

TL&DR; it's more of a simplistic approach at the beginning of when rua was created. It has its upsides (see again above), but it's possible to do better.

If you have a PR, I'd be happy to review/merge. Otherwise I may have time for it a bit later (these weeks I'm relatively busy)

Yoplitein commented 3 weeks ago

I believe I ran into this issue trying to patch a PKGBUILD and adding a makedepends in the process, which I was surprised to find resulted in makepkg complaining about missing dependencies. Giving my +1 for this feature.