Skip to content

[5.3] Fix build.php to create zstd packages on macOS#45535

Merged
HLeithner merged 2 commits intojoomla:5.3-devfrom
muhme:53-fix-build-php
May 29, 2025
Merged

[5.3] Fix build.php to create zstd packages on macOS#45535
HLeithner merged 2 commits intojoomla:5.3-devfrom
muhme:53-fix-build-php

Conversation

@muhme
Copy link
Contributor

@muhme muhme commented May 28, 2025

Summary of Changes

build.php does not create zstd packages on macOS with default BSD tar:

In addition, the script does not stop in any environment if an error occurs, e.g. if zstd or the zip application is missing:

Building Joomla_5.3.1-Stable-Update_Package.zip... sh: 1: zip: not found

  • Used is now separate piped tar and zstd calls, working in all environments, including macOS BSD-tar.
  • Tested with (Intel-based):
    • macOS 15.5
    • Windows 11 WSL 2 Ubuntu 22.04
  • For better readability, the shell commands are written without concatenations as one string.
  • From my point of view every system() command should be check for error status and the script fail
    if a system commands fail. I can implement this in a follow-up PR. For example currently there is an
    to-be-ignored error:
    cp: build/fido.jwt: No such file or directory
    

Testing Instructions

1. If you have a Mac test the error before:

php build/build.php --remote=5.3.1

Actual result BEFORE applying this Pull Request

Building Joomla_5.3.1-Stable-Full_Package.tar.zst... tar: Couldn't open  zstd --ultra -22: No such file or directory

Expected result AFTER applying this Pull Request

2. After applying this PR full testing (including bz2) on macOS, Windows WSL 2 or Ubuntu native, 8 respective 4 archive files are created between 150 and 350 MB:

php build/build.php --remote=5.3.1 --include-bzip2
ls -l build/tmp/packages
php build/build.php --remote=5.3.1 --include-bzip2 --debug-build
ls -l build/tmp/packages

3. You can check that the script stops with hacking an error in

3.a Change zstd with zstdXXX in line 653:

php build/build.php --remote=5.3.1

You have to get something like:

Building Joomla_5.3.1-Stable-Full_Package.tar.zst... tar: Write error
failed.
ERROR: Command failed (127): tar --create * | zstdXXX --ultra -22 -o ../packages/Joomla_5.3.1-Stable-Full_Package.tar.zst
Output:
sh: zstdXXX: command not found

3.b Set packages directory file mode 0, inserting the chmod line after line 392 mkdir packages:

system('chmod 0 packages');

You have to get something like:

Building Joomla_5.3.1-Stable-Full_Package.zip ... failed.
ERROR: Command failed (15): zip -r ../packages/Joomla_5.3.1-Stable-Full_Package.zip *
Output:
zip I/O error: Permission denied
zip error: Could not create output file (../packages/Joomla_5.3.1-Stable-Full_Package.zip)

4. Unpack one package file and compare with previous build. Same number of files? Same file permissions?

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@muhme muhme requested a review from rdeutz as a code owner May 28, 2025 08:59
@muhme muhme added the bug label May 28, 2025
@muhme
Copy link
Contributor Author

muhme commented May 28, 2025

@tecpromotion may you test with Mac?

@richard67
Copy link
Member

richard67 commented May 28, 2025

Maybe the testing instructions should be extended to test if everything works as well as before when using Linux or Windows with WSL, and by a test for some error message, e.g. when changing permissions of the "build/tmp/packages" folder just after it is created (i.e. when you see the message "Create list of changed files from git repository for version") so that there are no writing permissions, which should cause a visible error message.

@richard67
Copy link
Member

@muhme Please fix the PHPCS errors reported here: https://ci.joomla.org/joomla/joomla-cms/85015/1/7

@richard67 richard67 changed the title [53] Fix build.php to create zstd packages on macOS [5.3] Fix build.php to create zstd packages on macOS May 28, 2025
@muhme
Copy link
Contributor Author

muhme commented May 28, 2025

@richard67 Thank you for first view 👍 PHPCS is now green and test instructions are extended, do you like to test on Windows?

@richard67
Copy link
Member

@muhme I don't build on Windows because I don't use WSL. I can only test on Ubuntu.

@tecpromotion
Copy link
Contributor

tecpromotion commented May 28, 2025

I have tested this item ✅ successfully on 37327e3


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45535.

Bildschirmfoto 2025-05-28 um 18 30 04

@richard67
Copy link
Member

I have tested this item ✅ successfully on 37327e3

I've tested on Ubuntu.

Instead of using php build/build.php --remote=5.3.1 to build with the 5.3.1 tag, I've used php ./build/build.php --remote=HEAD to build with the current local branch.

For the result without this PR, that was the 5.3-dev branch, for the result with this PR I had fetched this PR into a local branch and checked out that branch.

Test results 1. and 2.: Skipped because not a Mac.

3.a and b: Success. Error message is shown, and build script stops.

4.: I've unpacked and verified ALL packages and compared with and without this PR.
The packages show only the usual differences which you also get when running 2 builds on the same branch, e.g. 5.3-dev.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45535.

@richard67
Copy link
Member

@tecpromotion I assume you have tested only with Mac, right? Or have you also tested with WSL?

@muhme I think we should get another test with WSL, then we are safe.

@tecpromotion
Copy link
Contributor

@tecpromotion I assume you have tested only with Mac, right? Or have you also tested with WSL?

@muhme I think we should get another test with WSL, then we are safe.

Yes, Mac only.

@muhme
Copy link
Contributor Author

muhme commented May 29, 2025

@tecpromotion and @richard67 Thanks for testing 👍 From my point of view two tests are enough, I have also tested on Intel Mac, Apple Silicon Mac and Windows 11 WSL 2, which in the end is also simply Ubuntu. But if someone wants to retest with Windows 11 WSL 2, welcome ...

@HLeithner HLeithner merged commit a3804dd into joomla:5.3-dev May 29, 2025
4 checks passed
@HLeithner
Copy link
Member

thanks

@tecpromotion tecpromotion added this to the Joomla! 5.3.2 milestone May 29, 2025
@muhme muhme deleted the 53-fix-build-php branch May 29, 2025 16:17
muhme added a commit to muhme/joomla-cms that referenced this pull request Jun 20, 2025
Before this commit, the zip commands displayed every added file.
Before joomla#45535, the output of the zip command with all added file names
was suppressed by redirecting stdout to /dev/null.
The same behaviour is now restored with the -q option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments