Skip to content

setup a cleaner build environment #665

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rickysarraf
Copy link

Multiple packages have run into build failures on our OBS. On closer
inspection, it was concluded to be issues with the locale settings.
These issues were never seen on the Debian buildd infrastructure because
there the locale setting LC_ALL=C.UTF-8 is in use.

This change keeps us closer to what is used in Debian buildds.

Signed-off-by: Ritesh Raj Sarraf [email protected]

@rickysarraf
Copy link
Author

@mlschroe
Copy link
Member

C.UTF-8 does not exist in older distros, so I'm not sure if it is a good idea to set it unconditionally.

@coolo
Copy link
Member

coolo commented Feb 23, 2021

https://unix.stackexchange.com/questions/597962/how-widespread-is-the-c-utf-8-locale suggests Arch Linux does not have it - so it's not about the age of the distro

@mlschroe
Copy link
Member

True, but this pull request just patches the build-recipe-dsc file...

@coolo
Copy link
Member

coolo commented Feb 23, 2021

but it's about the distribution executing it, or do I get this wrong?

@andrewshadura
Copy link

andrewshadura commented Feb 26, 2021

The change only affects DSC_BUILD_CMD which runs in a Debian (or a Debian derivative) chroot, so I think what other distributions do isn’t relevant in this case.

build-recipe-dsc Outdated
@@ -95,7 +95,7 @@ dsc_build() {
# this allows the build environment to be manipulated
# and alternate build commands can be used
DSC_BUILD_CMD="$(queryconfig --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" substitute dsc:build_cmd)"
test -z "$DSC_BUILD_CMD" && DSC_BUILD_CMD="dpkg-buildpackage -us -uc"
test -z "$DSC_BUILD_CMD" && DSC_BUILD_CMD="LC_ALL=C.UTF-8 dpkg-buildpackage -us -uc"

Choose a reason for hiding this comment

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

Is this the right place?

Shouldn't we change build-pkg-deb instead?

(but I am not sure who calls who to be honest)

Choose a reason for hiding this comment

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

Probably both need to be changed; also build-pkg-deb needs to consistently run deb_chroot.

Copy link

Choose a reason for hiding this comment

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

Think this is OK now, right ?

@andrewshadura
Copy link

Any update on this?

rickysarraf pushed a commit to rickysarraf/obs-build that referenced this pull request Feb 1, 2022
Multiple packages have run into build failures on our OBS. On closer
inspection, it was concluded to be issues with the locale settings.

These issues were never seen on the Debian buildd infrastructure because
there the locale setting LC_ALL=C.UTF-8 is in use.

This change keeps us closer to what is used in Debian buildds.

openSUSE#665

Signed-off-by: Emanuele Aina <[email protected]>
@rickysarraf rickysarraf force-pushed the obs-build-rickysarraf/master branch from 7fbc66c to a68beef Compare February 1, 2022 13:32
@rickysarraf
Copy link
Author

Also added a couple of fixes we've been carrying in our setup for a while.

@rickysarraf rickysarraf changed the title Set LC_ALL to C.UTF-8 setup a cleaner build envronment Feb 1, 2022
@rickysarraf rickysarraf changed the title setup a cleaner build envronment setup a cleaner build environment Feb 1, 2022
@obbardc
Copy link

obbardc commented Mar 18, 2025

@rickysarraf do you have any time to resolve this ? It would be nice to have this in OBS by default.

@nickbroon
Copy link
Contributor

nickbroon commented Mar 18, 2025

For additional context on Debian buildd setting LC_ALL to C.UTF-8 see: https://lists.debian.org/debian-devel/2024/06/msg00188.html

The lack of OBS also doing this also appears to be the cause of the recent breakage of installing fontconfig in OBS build environments reported here: https://lists.opensuse.org/archives/list/[email protected]/thread/C24P565DGJLSB4VDKHZVC7YK5KMQYUCP/

As such I would support the merging of this pull request.

emanueleaina and others added 4 commits March 20, 2025 13:53
Multiple packages have run into build failures on our OBS. On closer
inspection, it was concluded to be issues with the locale settings.

These issues were never seen on the Debian buildd infrastructure because
there the locale setting LC_ALL=C.UTF-8 is in use.

This change keeps us closer to what is used in Debian buildds.

openSUSE#665

Signed-off-by: Emanuele Aina <[email protected]>
To make the build environment a bit more reproducible, ensure the local
timezone is set to UTC when building packages.

Signed-off-by: Emanuele Aina <[email protected]>
…ilds

Our OBS workers run under a `screen` session, which gives them an actual
`$TERM` variable.

Some packages like `color.js` then enable colored output, which confuses
some other packages like `node-grunt-legacy-log` which use it in their
testsuite and do not expect colored output.

To avoid that, unset `TERM`.

Signed-off-by: Emanuele Aina <[email protected]>
spymemcached package is FTBFS because a test expects a reverse lookup of
127.0.0.1 to return localhost, but current /etc/hosts configuration
returns the hostname instead.

Let's move this `hostname/ip` entry to the end of /etc/hosts so the
reverse lookup of 127.0.0.1 returns localhost, which makes sense to be
the default case usually.

Signed-off-by: Ariel D'Alessandro <[email protected]>
@rickysarraf rickysarraf force-pushed the obs-build-rickysarraf/master branch from a68beef to 3a32943 Compare March 20, 2025 08:24
@rickysarraf
Copy link
Author

@rickysarraf do you have any time to resolve this ? It would be nice to have this in OBS by default.

Thanks @obbardc
This is now rebased against the current HEAD

@andrewshadura
Copy link

andrewshadura commented Mar 20, 2025

@rickysarraf, thanks! There are a few more related changes in https://gitlab.collabora.com/obs/obs-build/-/commits/collabora/main, could you please pick them up too?

@rickysarraf
Copy link
Author

@rickysarraf, thanks! There are a few more related changes in https://gitlab.collabora.com/obs/obs-build/-/commits/collabora/main, could you please pick them up too?

@andrewshadura Sure. I'm on it. Will check now and pick the ones relevant.

@obbardc
Copy link

obbardc commented Mar 20, 2025

I wonder if there is any scope to create some useful unit tests for building Debian packages (not as part of this pr of course, but if you're interested maybe we could open separate issue) ?

…ence

Signed-off-by: Andrej Shadura <[email protected]>

merge fallout

Signed-off-by: Ritesh Raj Sarraf <[email protected]>
… builds

Since "su -" cleans the environment, we need to tell it to keep
variables we want to preserve. To make this easier, create a new wrapper
su_deb_chroot that runs chroot and su and sets up the environment.

Since DEBIAN_* variables are only needed when preparing the build
chroot, don’t set them in su_deb_chroot.

Signed-off-by: Andrej Shadura <[email protected]>
Using su - will set the path to a default value, which for a normal user
doesn't include /sbin.. However some debian package do rely on sbin
being in the path it seems. So explictly set the path to match the
default set by debuild, including sbin

Signed-off-by: Sjoerd Simons <[email protected]>
@rickysarraf
Copy link
Author

@rickysarraf, thanks! There are a few more related changes in https://gitlab.collabora.com/obs/obs-build/-/commits/collabora/main, could you please pick them up too?

@andrewshadura Sure. I'm on it. Will check now and pick the ones relevant.

@andrewshadura I have now pushed all the cherry-picked commits as well. Given that this branch was rebased against upstream's master, some code had diverged and I had to resolve conflicts during the cherry-pick.

So, this PR could appreciate another round of quick review from you.

@andrewshadura
Copy link

I think it’s better to leave out 4e273c6. This was fixed in a different way upstream.

@rickysarraf rickysarraf force-pushed the obs-build-rickysarraf/master branch from 4e273c6 to 01e5688 Compare March 20, 2025 15:06
Copy link

@obbardc obbardc left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I will test this in more detail with the failing Debian packages later, to see if it fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants