Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add --add-i386 option to RPM build script#6251

Merged
chrisd8088 merged 1 commit into
git-lfs:mainfrom
chrisd8088:add-i386-rpm-option
Apr 23, 2026
Merged

Add --add-i386 option to RPM build script#6251
chrisd8088 merged 1 commit into
git-lfs:mainfrom
chrisd8088:add-i386-rpm-option

Conversation

@chrisd8088

@chrisd8088 chrisd8088 commented Apr 23, 2026

Copy link
Copy Markdown
Member

This PR updates the rpm/build_rpms.bsh script we use to generate RPM packages for Git LFS releases so that the script will only build a 32-bit binary when the new --add-i386 option is provided.

In conjunction with the changes from PR git-lfs/build-dockers#76, this PR should ensure we only publish 64-bit RPM packages for platforms based on Red Hat Enterprise Linux (RHEL) 10.0 and the distributions we consider equivalent to it.

This PR's changes have been tested with our GitHub Actions CI and release workflows using a private repository.

Details

In commit git-lfs/build-dockers@cc16329 of PR git-lfs/build-dockers#71 we added a Dockerfile to build RPM packages of Git LFS for the Red Hat Enterprise Linux (RHEL) 10.0 and Rocky Linux 10.0 platforms. This Dockerfile originally followed the same set of steps as our Dockerfiles for the earlier RHEL/CentOS 8 and RHEL/Rocky Linux 9 platforms, and so was intended to build both 32-bit and 64-bit binaries in two separate RPM packages.

However, the RHEL 10.0 and Rocky Linux 10.0 platforms only provide support for 64-bit systems, as noted in their release announcements, which means we should only be building 64-bit RPM packages of Git LFS for them.

To help resolve this issue, in commit git-lfs/build-dockers@1caa5b3 of PR git-lfs/build-dockers#76 we updated the Dockerfiles for the RHEL/CentOS 8 and RHEL/Rocky Linux 9 platforms so they now pass an explicit --add-i386 option to the centos_script.bsh shell script in that repository. At the same time, we also revised the script so that it passes its command-line arguments through to the rpm/build_rpms.bsh script in this repository.

To fully resolve the issue, we now update the rpm/build_rpms.bsh script so that it only builds a package with a 32-bit binary if the --add-i386 option is provided.

Because our Dockerfile for the RHEL/Rocky Linux 10 platforms does not pass the --add-i386 option to the centos_script.bsh script, the rpm/build_rpms.bsh script will now build only one package for these platforms, containing a 64-bit Git LFS binary. For the earlier RHEL-based platforms, though, the rpm/build_rpms.bsh script will receive the --add-i386 option, and will build both 32-bit and 64-bit packages.

In commit git-lfs/build-dockers@cc16329
of PR git-lfs/build-dockers#71 we added a Dockerfile to build RPM
packages of Git LFS for the Red Hat Enterprise Linux (RHEL) 10.0 and
Rocky Linux 10.0 platforms.  This Dockerfile originally followed the
same set of steps as our Dockerfiles for the earlier RHEL/CentOS 8
and RHEL/Rocky Linux 9 platforms, and so was intended to build both
32-bit and 64-bit binaries in two separate RPM packages.

However, the RHEL 10.0 and Rocky Linux 10.0 platforms only provide
support for 64-bit systems, which means we should only be building
64-bit RPM packages of Git LFS for them:

  https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html-single/10.0_release_notes/index
  https://rockylinux.org/news/rocky-linux-10-0-ga-release

To help resolve this issue, in commit
git-lfs/build-dockers@1caa5b3
of PR git-lfs/build-dockers#76 we updated the Dockerfiles for the
RHEL/CentOS 8 and RHEL/Rocky Linux 9 platforms so they now pass an
explicit --add-i386 option to the "centos_script.bsh" shell script
in that repository.  At the same time, we also revised the script
so that it passes its command-line arguments through to the
"rpm/build_rpms.bsh" script in this repository.

To fully resolve the issue, we now update the "rpm/build_rpms.bsh"
script so that it only builds a package with a 32-bit binary if the
--add-i386 option is provided.

Because our Dockerfile for the RHEL/Rocky Linux 10 platforms does
not pass the --add-i386 option to the "centos_script.bsh" script, the
"rpm/build_rpms.bsh" script will now build only one package for
these platforms, containing a 64-bit Git LFS binary.  For the
earlier RHEL-based platforms, though, the "rpm/build_rpms.bsh" script
will receive the --add-i386 option, and will build both 32-bit and
64-bit packages.
@chrisd8088 chrisd8088 requested a review from a team as a code owner April 23, 2026 05:22
@chrisd8088 chrisd8088 added the distribution First-party packages and release assets label Apr 23, 2026
Comment thread rpm/build_rpms.bsh
"${RPMBUILD[@]}" --nodeps -ba "$SPEC"
"${RPMBUILD[@]}" --nodeps --target=i686 -bb "$SPEC"

if [ "$#" -eq 1 ] && [ "$1" = "--add-i386" ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: why do we do the args length check here? wouldn't the 2nd condition be sufficient if there is just one arg?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's because we run the script with the nounset shell attribute enabled.

At the top of the script, we call set -eu, and it's the -u (or nounset) attribute which will cause the script to exit if it tries to read an undefined variable.

The POSIX specification for the set shell utility describes it this way:

-u The shell shall write a message to standard error when it tries to expand a variable that is not set and immediately exit. An interactive shell shall not exit.

Here's a small example of what happens if we were to access $1 in a script that's run without any arguments:

$ cat <<'EOF' >example.sh
#!/usr/bin/env bash
set -eu
echo "$1"
EOF

$ chmod 755 example.sh

$ ./example.sh
./example.sh: line 3: $1: unbound variable

Since we won't always pass our --add-i386 argument, so long as we've got set -u in place we have to guard against reading potentially undefined variables.

Now we could drop the nounset attribute, of course, but since it's been there a long time, I figured it was easiest just to go with what was in place already.

@chrisd8088 chrisd8088 merged commit 35b72ef into git-lfs:main Apr 23, 2026
10 checks passed
@chrisd8088 chrisd8088 deleted the add-i386-rpm-option branch April 23, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distribution First-party packages and release assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants