dejan2609 commented on PR #23424:
URL: https://github.com/apache/kafka/pull/23424#issuecomment-7014786856

   @mimaison Thank you for testing this PR !
   
   Rat 0.17 changed the XML report but `.github/scripts/rat.py` was not updated 
accordingly.
   
   I debugged it (in a session with Claude) and added two commits:
   
   - **first commit fixes the license check:** the script finds the file with 
the unapproved license again and exits with 1, but the GitHub annotation (the 
"Unapproved License" notice in the workflow summary) still has a wrong path, 
starting with `../` (for example `../../../clients/src/main/java/RatProbe.java` 
on my machine; the number of `../` depends on the `GITHUB_WORKSPACE` path).
   - **second commit fixes that path,** so the annotation points to 
`clients/src/main/java/RatProbe.java` again.
   
   The test now gives the same result as on trunk. 
   Testing procedure:
   ```
   printf 'public class RatProbe {}\n' > clients/src/main/java/RatProbe.java
   git add clients/src/main/java/RatProbe.java
   ./gradlew rat -q
   GITHUB_WORKSPACE=$PWD python3 .github/scripts/rat.py; echo "script exit: $?"
   ```
   
   <details>
   <summary>Test outputs (first commit only vs. both commits)</summary>
   
   First commit only:
   ```
   $ GITHUB_WORKSPACE=$PWD python3 .github/scripts/rat.py; echo "script exit: 
$?"
   Found 1 Rat reports
   Read env GITHUB_WORKSPACE: /home/dejan/kafka
   Parsing Rat report file: build/rat/rat-report.xml
   7589 approved licenses
   1 unapproved licenses
   Files with unapproved licenses:
   ::notice file=../../../clients/src/main/java/RatProbe.java,title=Unapproved 
License::File with unapproved license: 
../../../clients/src/main/java/RatProbe.java
   script exit: 1
   ```
   
   Both commits:
   ```
   $ GITHUB_WORKSPACE=$PWD python3 .github/scripts/rat.py; echo "script exit: 
$?"
   Found 1 Rat reports
   Parsing Rat report file: build/rat/rat-report.xml
   7589 approved licenses
   1 unapproved licenses
   Files with unapproved licenses:
   ::notice file=clients/src/main/java/RatProbe.java,title=Unapproved 
License::File with unapproved license: clients/src/main/java/RatProbe.java
   script exit: 1
   ```
   </details>
   
   ___
   
   **Details about related Apache RAT changes:** 
   - **License check:** since Rat 0.17 
([RAT-366](https://issues.apache.org/jira/browse/RAT-366)), the report has a 
`<license approval="false" .../>` element for each detected license, instead of 
`<license-approval name="false"/>` (commit 
apache/creadur-rat@f4cf89eff34210c9687117b2dc561046cfd437ab):
     - before: [`LICENSE_APPROVAL_PREDICATE = 
"license-approval"`](https://github.com/apache/creadur-rat/blob/78d9c6dc6772579f3cb00ed8f50fbc461e65ae2d/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java#L34)
     - after: [`LICENSE = "license"`, `APPROVAL = 
"approval"`](https://github.com/apache/creadur-rat/blob/f4cf89eff34210c9687117b2dc561046cfd437ab/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java#L39-L40)
   - **File paths:** since Rat 0.17 
([RAT-390](https://issues.apache.org/jira/browse/RAT-390)), the report has 
paths relative to the repository root, with a leading `/`, instead of absolute 
paths (commit apache/creadur-rat@d38618399c7bffe41fc463c0045f4c626204df6a):
     - before: [`attribute(NAME, 
subject.getName())`](https://github.com/apache/creadur-rat/blob/e9b0192098bd1791f60b5c7a5d098a12ad7425f6/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java#L70)
     - after: [`attribute(NAME, 
subject.localizedName())`](https://github.com/apache/creadur-rat/blob/d38618399c7bffe41fc463c0045f4c626204df6a/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java#L87),
 using 
[`localizedName()`](https://github.com/apache/creadur-rat/blob/d38618399c7bffe41fc463c0045f4c626204df6a/apache-rat-core/src/main/java/org/apache/rat/api/Document.java#L89-L101)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to