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

dt_makefile_patcher: fix dtbs with dot in filename #7194

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

amazingfate
Copy link
Contributor

Description

We do not build dtbs with dot in filename because the current re match rule will ignore them.
This fixes #7187

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

Checklist:

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions bot added size/small PR with less then 50 lines Framework Framework components labels Sep 9, 2024
Copy link
Member

@rpardini rpardini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't grok regular expressions (even the ones I wrote lol), so I asked an LLM, and it said it's fine ✅


The difference between the two regular expressions lies in how they define the part that captures the filename (before the .dtb extension) and how they handle special characters.

  1. regex_dtb = r"(.)\s(([a-zA-Z0-9-]+).dtb)(.)"
    (.*): This captures any character (except newline) zero or more times before the space.
    \s: This matches any whitespace character (space, tab, etc.).
    ([a-zA-Z0-9-
    ]+): This captures one or more occurrences of any alphanumeric character (a-z, A-Z, 0-9), hyphen (-), or underscore (_).
    .dtb: This matches the .dtb extension.
    (.*): This captures any character zero or more times after the .dtb.
    This regular expression is designed to match filenames that only contain alphanumeric characters, hyphens, and underscores before the .dtb extension.

  2. regex_dtb = r"(.)\s(([^ \f\n\r\t\v]+).dtb)(.)"
    (.): Same as before, it captures any character zero or more times before the space.
    \s: This matches any whitespace character.
    ([^ \f\n\r\t\v]+): This captures one or more characters that are not whitespace characters (spaces, form feeds, newlines, carriage returns, tabs, and vertical tabs).
    .dtb: This matches the .dtb extension.
    (.
    ): This captures any character zero or more times after the .dtb.
    This version is more flexible, as it allows for any character that is not a whitespace character before the .dtb extension, rather than restricting it to alphanumeric characters, hyphens, or underscores. It will capture filenames with special characters like @, #, $, etc., as long as they are not whitespace.

@amazingfate amazingfate merged commit 24be131 into armbian:main Sep 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Framework components size/small PR with less then 50 lines
Development

Successfully merging this pull request may close these issues.

[Bug]: dt_makefile_patcher ignores dtb filenames with periods
2 participants