[go-rpm-macros] Issue #3: %goprep should apply patches automatically
by Nicolas Mailhot
nim reported a new issue against the project: `go-rpm-macros` that you are following:
``
`%goprep` should apply patches automatically, so there is no convenience gap with `%autosetup`.
This is generic work that should be done *redhat-rpm-config* side in forge macros and then reused in`%goprep`. Basically:
1. define a `patch_flags<suffix>` rpm variable holding the parameters that should be passed to `%patch<suffix>`
2. define a `default_flags<suffix>` fallback
3. define a `source_patches<suffix>` holding an ordered space separated list of patch suffixes associated with a particular forge/go source.
And then write the usual lua loops to apply it all at the right moment in the spec.
``
To reply, visit the link below or just reply to this email
https://pagure.io/go-rpm-macros/issue/3
4 weeks, 1 day
Alternative method to disable failing tests
by Robert-André Mauchin
Hi,
To my knowledge, in the future Go modules macros (which will hopefully
be available at some point in the future), we won't be able to pass -d
or -t to %gocheck to disable some test directory. In order to tackle the
problem of failing tests, I devised an alternative method to disable
failing tests with awk:
for test in "TestRestart" \
"TestStop" \
"TestActive" \
; do
awk -i inplace '/^func.*'"$test"'/ { print; print "\treturn"; next}1'
$(grep -rl $test)
done
You can see that it adds a return directly after the test function
definition to bypass the test. Instead of return, we could also use:
t.Skip("disabled failing test")
for test in "TestRestart" \
"TestStop" \
"TestActive" \
; do
awk -i inplace '/^func.*'"$test"'/ { print; print "\tt.Skip(\"disabled
failing test\")"; next}1' $(grep -rl $test)
done
Why I prefer this method:
- we don't have to manually create a patch for each test we want to
disable, so this is faster and easier.
- we don't have to port each patch if there was an update in the test
file.
- it offers more granularity compared to disabling an entire subdirectory.
Eventual problems:
- This only works if the format of the test is starting with ^func.*
$test and use (t *testing.T) as a parameter (for the second method). I
haven't tested this on a sufficient number of package to determine if
this is always the case.
- It needs awk in the buildroot, it is available by default but let's
hope it is not removed in the future.
Let me know what you think,
Best regards,
Robert-André
2 years, 8 months