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

Fix the Makefile for test and fix targets. #6913

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

mtalexan
Copy link
Contributor

The bin/composer dependency was missing from half the targets that needed it.
The vendor/bin/* targets are all created by a single call to composer, but were all duplicating the composer call.
The php* tools defined a vendor/bin/php* target, but then proceeded to create the bin/php* target instead by symlinking from an incorrect path. php* tools were referenced as vendor/bin/php* even though they were symlinked to bin/php*.

Closes #6912

Changes proposed in this pull request:

  • Fixed the very broken Makefile fix* and test* targets
    • Dependencies were pretty messed up for the vendor/bin/php*. Commands and were symlinking a non-existent ../vendor/bin/php* to bin/php* as part of a vendor/bin/php* target (!?)
    • The "vendor/bin/php*" targets were all separately calling the bin/composer install ... even though a single call generated them all.
    • vendor/bin/php* commands were being used instead of the bin/php* that were symlinked.
    • The bin/composer dependency was missing from some targets

How to test the feature manually:

  1. Open a vscode devcontainer
  2. run the Makefile test and fix targets
  3. Confirm they work

Pull request checklist:

  • clear commit messages
  • code manually tested
  • (N/A) unit tests written (optional if too hard)
  • (N/A) documentation updated

Additional information can be found in the documentation.

The bin/composer dependency was missing from half the targets that
needed it.
The vendor/bin/* targets are all created by a single call to composer,
but were all duplicating the composer call.
The php* tools defined a vendor/bin/php* target, but then proceeded to
create the bin/php* target instead by symlinking from an incorrect path.
php* tools were referenced as vendor/bin/php* even though they were
symlinked to bin/php*.
@Alkarex Alkarex added this to the 1.25.0 milestone Oct 17, 2024
@Alkarex
Copy link
Member

Alkarex commented Oct 17, 2024

Just to understand the original issue better: did you hit anything that was not working?

I have just tried again from a clean Dev Container (e.g. on GitHub codespaces, but same effect locally), and I could execute make test-all without any problem

image

@Alkarex
Copy link
Member

Alkarex commented Oct 17, 2024

Ah sorry, you tried test and fix as opposed to the test-all and fix-all.

test and fix are older, with some legacy scenarios, and should indeed be cleaned. They need to be able to run locally with no PHP installed and by relying on a Docker image, so that should be tested with this PR.

@Alkarex Alkarex added the System care Everything related to the system care label Oct 17, 2024
@mtalexan
Copy link
Contributor Author

mtalexan commented Oct 17, 2024

I opened the DevContainer completely fresh and ran make fix-all and it failed for me.

The first error was that there was no bin/composer when calling bin/composer run-script fix. That was a pretty clear the composer-fix target was being called, and is quite obviously missing a dependency on the bin/composer target.
I went thru all the places bin/composer was being called and made sure they had a dependency listed for it.

After the make fix-all was working, I ran the make test-all. It errored out trying create a symlink from ../vendor/bin/phpcbf to bin/ right after it had successfully run thru a composer install (based on the output it was printing). Sure enough, it's running from the root of the repo clone, so .. is a directory outside the repo and doesn't have anything of the sort. I assumed since the bin/composer install had just been called on the prior line of the makefile, it probably wanted vendor/bin/phpcbf that had just been installed, not something else, so I fixed the reference.
Assuming it might be a repeated problem, I looked to see if ../vendor was used anywhere else, and found that all the PHP tools were doing it the same way and fixed them all. Since they were all also basically identical targets except for what was being linked, I corrected how the bin/composer install was called so it wasn't re-called for every tool (the first call creates all of them, that's just how it works), and combined the targets in the Makefile so it's easy to add new ones.

@mtalexan
Copy link
Contributor Author

I could keep going on this a bit if necessary. It looks like there's still one target in the file that refers to something in .. (so it won't exist), and a bunch of the target's should really be marked .PHONY since they are a command to run and don't have a an actual file with the given name.

@Alkarex
Copy link
Member

Alkarex commented Oct 17, 2024

I opened the DevContainer completely fresh and ran make fix-all and it failed for me.

Ah indeed, error if starting with make fix-all without doing a make test-all first.

I could keep going on this a bit if necessary.

Yes, that would be most welcome.

@Alkarex
Copy link
Member

Alkarex commented Oct 17, 2024

Let's merge this PR, which is already an improvement

@Alkarex Alkarex merged commit b184dc2 into FreshRSS:edge Oct 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
System care Everything related to the system care
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] make fix-all and make test-all are broken
2 participants