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

wpcomsh: Fix generate POT scanned file paths #38153

Merged
merged 5 commits into from
Jul 7, 2024
Merged

Conversation

yuliyan
Copy link
Member

@yuliyan yuliyan commented Jul 2, 2024

Fixes p1719903725313999-slack-C02AED43D

Proposed changes:

  • Update the find command in generate-pot.sh to follow symlinks so that it scans the files in vendor/ that are symlinked to the packages in the monorepo.
  • Set sudirectory max depth to 10 and ignore nested vendor and wordpress directories to prevent unwanted files from scanning.
  • Update language files.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Code review projects/plugins/wpcomsh/bin/i18n/generate-pot.sh.
  • Inspect projects/plugins/wpcomsh/languages/wpcomsh.pot and confirm the newly added strings are all expected to be there.
  • Run make i18n in projects/plugins/wpcomsh to confirm it runs as expected.
@yuliyan yuliyan added [Type] Bug When a feature is broken and / or not performing as intended [Focus] i18n Internationalization / i18n, adaptation to different languages [Plugin] Wpcomsh labels Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Wpcomsh plugin:

  • Next scheduled release: August 6, 2024.
  • Scheduled code freeze: July 29, 2024.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jul 2, 2024
@yuliyan yuliyan added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jul 2, 2024
Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

One suggestion inline to improve the find command. Otherwise this seems to make sense.

Too bad we can't have this work more like wporg plugins though, where GlotPress does the extracting and the language files are downloaded by WordPress separately instead of having to be committed inside the monorepo.

@@ -14,6 +14,8 @@ find . -name '*.php' -and ! -path './build/*' -and ! -path './custom-colors/*' \
-or -path './vendor/automattic/jetpack-config/*' \
-or -path './vendor/automattic/jetpack-post-list/*' \
\) \
-and ! -path './vendor/*/vendor/*' \
-and ! -path './vendor/*/wordpress/*' \
Copy link
Contributor

Choose a reason for hiding this comment

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

While all this seems to work, it spits out a bunch of warnings when I try it:

find: warning: you have specified the global option -maxdepth after the argument -name, but global options are not positional, i.e., -maxdepth affects tests specified before it as well as those specified after it.  Please specify global options before other arguments.
find: File system loop detected; ‘./vendor/automattic/jetpack-status/vendor/automattic/jetpack-plans/vendor/automattic/jetpack-status’ is part of the same file system loop as ‘./vendor/automattic/jetpack-status’.
find: File system loop detected; ‘./vendor/automattic/jetpack-status/vendor/automattic/jetpack-redirect/vendor/automattic/jetpack-status’ is part of the same file system loop as ‘./vendor/automattic/jetpack-status’.
find: File system loop detected; ‘./vendor/automattic/jetpack-status/vendor/automattic/jetpack-connection/vendor/automattic/jetpack-status’ is part of the same file system loop as ‘./vendor/automattic/jetpack-status’.
find: File system loop detected; ‘./vendor/automattic/jetpack-config/vendor/automattic/jetpack-search/vendor/automattic/jetpack-config’ is part of the same file system loop as ‘./vendor/automattic/jetpack-config’.
find: File system loop detected; ‘./vendor/automattic/jetpack-config/vendor/automattic/jetpack-sync/vendor/automattic/jetpack-config’ is part of the same file system loop as ‘./vendor/automattic/jetpack-config’.
find: File system loop detected; ‘./vendor/automattic/jetpack-config/vendor/automattic/jetpack-my-jetpack/vendor/automattic/jetpack-config’ is part of the same file system loop as ‘./vendor/automattic/jetpack-config’.
find: File system loop detected; ‘./vendor/automattic/jetpack-config/vendor/automattic/jetpack-wordads/vendor/automattic/jetpack-config’ is part of the same file system loop as ‘./vendor/automattic/jetpack-config’.
find: File system loop detected; ‘./vendor/automattic/jetpack-config/vendor/automattic/jetpack-publicize/vendor/automattic/jetpack-config’ is part of the same file system loop as ‘./vendor/automattic/jetpack-config’.
find: File system loop detected; ‘./vendor/automattic/jetpack-sync/vendor/automattic/jetpack-config/vendor/automattic/jetpack-sync’ is part of the same file system loop as ‘./vendor/automattic/jetpack-sync’.
find: File system loop detected; ‘./vendor/automattic/jetpack-sync/vendor/automattic/jetpack-search/vendor/automattic/jetpack-sync’ is part of the same file system loop as ‘./vendor/automattic/jetpack-sync’.
find: File system loop detected; ‘./vendor/automattic/jetpack-sync/vendor/automattic/jetpack-my-jetpack/vendor/automattic/jetpack-sync’ is part of the same file system loop as ‘./vendor/automattic/jetpack-sync’.
find: File system loop detected; ‘./vendor/automattic/jetpack-sync/vendor/automattic/jetpack-connection/vendor/automattic/jetpack-sync’ is part of the same file system loop as ‘./vendor/automattic/jetpack-sync’.
find: File system loop detected; ‘./vendor/automattic/jetpack-plans/vendor/automattic/jetpack-status/vendor/automattic/jetpack-plans’ is part of the same file system loop as ‘./vendor/automattic/jetpack-plans’.
find: File system loop detected; ‘./vendor/automattic/jetpack-redirect/vendor/automattic/jetpack-status/vendor/automattic/jetpack-redirect’ is part of the same file system loop as ‘./vendor/automattic/jetpack-redirect’.
find: File system loop detected; ‘./vendor/automattic/jetpack-connection/vendor/automattic/jetpack-status/vendor/automattic/jetpack-connection’ is part of the same file system loop as ‘./vendor/automattic/jetpack-connection’.
find: File system loop detected; ‘./vendor/automattic/jetpack-connection/vendor/automattic/jetpack-sync/vendor/automattic/jetpack-connection’ is part of the same file system loop as ‘./vendor/automattic/jetpack-connection’.
find: File system loop detected; ‘./vendor/automattic/jetpack-connection/vendor/automattic/jetpack-licensing/vendor/automattic/jetpack-connection’ is part of the same file system loop as ‘./vendor/automattic/jetpack-connection’.

I'd recommend using -prune to skip processing of the nested vendor and wordpress (and also node_modules and jetpack_vendor), perhaps something like this

find -L . \
  \( \
    -path './vendor/*/vendor' \
    -or -path './vendor/*/wordpress' \
    -or -path './vendor/*/node_modules' \
    -or -path './vendor/*/jetpack_vendor' \
  \) \
  -prune \
  -or \
  -name '*.php' -and ! -path './build/*' -and ! -path './custom-colors/*' \
  -and \( \
    ! -path './vendor/*' \
    -or -path './vendor/automattic/jetpack-mu-wpcom/*' \
    -or -path './vendor/automattic/at-pressable-podcasting/*' \
    -or -path './vendor/automattic/custom-fonts-typekit/*' \
    -or -path './vendor/automattic/custom-fonts/*' \
    -or -path './vendor/automattic/jetpack-assets/*' \
    -or -path './vendor/automattic/jetpack-config/*' \
    -or -path './vendor/automattic/jetpack-post-list/*' \
 \) \
 -print
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I've updated the PR.

Although I wasn't seeing the warnings locally, prior to adding -maxdepth in my approach, the find command was taking long time to execute, which I assume was indeed a file system loop.

Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me.

@yuliyan yuliyan merged commit 41dfa3c into trunk Jul 7, 2024
53 checks passed
@yuliyan yuliyan deleted the fix/wpcomsh-generate-pot branch July 7, 2024 08:07
@github-actions github-actions bot added this to the wpcomsh/3.22.6 milestone Jul 7, 2024
@github-actions github-actions bot removed the [Status] Needs Review To request a review from Crew. Label will be renamed soon. label Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] i18n Internationalization / i18n, adaptation to different languages [Plugin] Wpcomsh [Type] Bug When a feature is broken and / or not performing as intended
2 participants