Skip to content

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

@trz42

Description

@trz42

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'/

Metadata

Metadata

Assignees

No one assigned

    Labels

    2023.06-software.eessi.io2023.06 version of software.eessi.iobugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions