Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jookuuj opened this issue Jul 23, 2023 · 9 comments · May be fixed by #226
Open

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

jookuuj opened this issue Jul 23, 2023 · 9 comments · May be fixed by #226
Labels
feature-request New feature or request

Comments

@jookuuj
Copy link

jookuuj commented Jul 23, 2023

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
Copy link
Owner

vn971 commented Jul 24, 2023

Hi @jookuuj, thank you!
This flow should actually work 🤔 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
Copy link
Author

jookuuj commented Jul 25, 2023

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
Copy link
Owner

vn971 commented Jul 25, 2023

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
Copy link
Author

jookuuj commented Jul 25, 2023

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
Copy link
Owner

vn971 commented Jul 25, 2023

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.

  • rua could detect the change of the .SRCINFO and recommend building and installing the package manually (e.g. rua builddir ~/.cache/rua/build/PACKAGE_NAME). In this case, the dependency tree can be shown to the user right at the start (which can be very intuitive to see, and the person might even decide to install/not install the package at this point). However, in case of changed dependencies the user would be left with a lot of manual work..
  • rua could avoid showing the summary at start and work down its dependency tree incrementally. It would still be possible to review all packages in one go before full installation (build execution), but the dependency tree won't be shown before review.
  • In theory, the dependency tree could be re-calculated and updated as the user reviews the packages and alters them. Something along the lines of:
your_desired_package (*reviewed*)
├── dep1 (*currently reviewing*)
└── dep2
    └── dep3 (pacman)

this can even be shown incrementally/repeatedly while you're reviewing, to see a "pointer" of where you are in the overall process.

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

Any ideas are welcomed

@jookuuj
Copy link
Author

jookuuj commented Jul 26, 2023

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
Copy link

marrs commented Jul 30, 2023

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
Copy link
Owner

vn971 commented Jul 30, 2023

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)

@vn971 vn971 changed the title Request: Allow patching PKGBUILD files Patching PKGBUILD/.SRCINFO should immediately impact the dependency tree Jul 31, 2023
@vn971 vn971 added the feature-request New feature or request label Jul 31, 2023
@TungstnBallon TungstnBallon linked a pull request Aug 25, 2024 that will close this issue
@Yoplitein
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants