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

logic to determine from-pr fails when .diff files includes extra 'from-pr' #536

Open
trz42 opened this issue Apr 6, 2024 · 0 comments
Open
Labels
2023.06-software.eessi.io 2023.06 version of software.eessi.io bug Something isn't working

Comments

@trz42
Copy link
Collaborator

trz42 commented Apr 6, 2024

Ran into the issue in NorESSI#301 which tests the changes implemented in #494 Particularly, the NorESSI#301 includes several comments which contain the string from-pr in addition to the option from-pr in an easystack file. A simple fix seems to be to slightly modify the search pattern to from-pr: in the second grep. See example runs below.

The original search pattern from-pr in the second grep returns the following:

[nessibot@login1 ~]$ grep ^+ /project/def-nessi/SHARED/jobs/2024.04/pr_301/9129/301.diff | grep from-pr
+    # Find lines that are added and use from-pr, make them unique, grab the
+    pr_exceptions=$(grep ^+ $2 | grep from-pr | uniq | awk '{print $3}' | xargs -i echo " || /'{}'/")
+    # We might have failed due to unmerged PRs. Try to make exceptions for --from-pr added in this PR
+    # Note that if no --from-pr's were used in this PR, $pr_exceptions will be empty and we might as
+    awk_command="awk '\!/'from-pr'/ EXCEPTIONS' $easystack"
+    msg="${msg} allowing for --from-pr's that were added in this PR..."
+    # If now we succeeded, the reason must be that we originally stripped the --from-pr's
+        from-pr: 20308

With this the full command to determine the pr_exceptions (in check_missing_installations.sh) returns:

[nessibot@login1 ~]$ grep ^+ /project/def-nessi/SHARED/jobs/2024.04/pr_301/9129/301.diff | grep from-pr  | uniq | awk '{print $3}' | xargs -i echo " || /'{}'/"
 || /'Find'/
 || /'^+'/
 || /'We'/
 || /'Note'/
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option

After modifying the search pattern to from-pr: in the second grep, we get the following

[nessibot@login1 ~]$ grep ^+ /project/def-nessi/SHARED/jobs/2024.04/pr_301/9129/301.diff | grep from-pr:
+        from-pr: 20308

and the full command returns

[nessibot@login1 ~]$ grep ^+ /project/def-nessi/SHARED/jobs/2024.04/pr_301/9129/301.diff | grep from-pr: |uniq | awk '{print $3}' | xargs -i echo " || /'{}'/"
 || /'20308'/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2023.06-software.eessi.io 2023.06 version of software.eessi.io bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant