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

Fully replace libc6-compat and musl-utils #179

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
pkgname="glibc"
pkgver="2.35"
_pkgrel="0"
pkgrel="0"
pkgrel="1"
pkgdesc="GNU C Library compatibility layer"
options="lib64"
arch="x86_64"
url="https://github.com/sgerrand/alpine-pkg-glibc"
license="LGPL"
source="https://github.com/sgerrand/docker-glibc-builder/releases/download/$pkgver-$_pkgrel/glibc-bin-$pkgver-$_pkgrel-x86_64.tar.gz
nsswitch.conf
ld.so.conf"
subpackages="$pkgname-bin $pkgname-dev $pkgname-i18n"
subpackages="$pkgname-bin $pkgname-utils $pkgname-dev $pkgname-i18n"
triggers="$pkgname-bin.trigger=/lib:/usr/lib:/usr/glibc-compat/lib"

package() {
mkdir -p "$pkgdir/lib" "$pkgdir/usr/glibc-compat/lib/locale" "$pkgdir"/usr/glibc-compat/lib64 "$pkgdir"/etc
provides="libc6-compat"
Copy link
Owner

Choose a reason for hiding this comment

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

This declaration isn't accurate but the line below it is.

Suggested change
provides="libc6-compat"

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure I understand why you think this is incorrect.

In the PR description I wrote:

the intent of libc6-compat can be written as "I'd like to be able to run binaries that are linked against glibc", so also say provides="libc6-compat".

Or, put another way: What could be more libc6-compatible than actually installing libc6?

Copy link

Choose a reason for hiding this comment

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

What could be more libc6-compatible than actually installing libc6?

provides is not meant to declare a capability, but should refer to packages provided, see also https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#provides. Further one could argue, the packages from this repository do not provide compatibility, they do provide glibc.

libc6-compat is a package, https://pkgs.alpinelinux.org/packages?name=libc6-compat&branch=v3.16&repo=&arch=&maintainer=.

Copy link

Choose a reason for hiding this comment

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

@jalberti I think I see why setting provide=libc6-compat is not what we would want; after the suggested reading by @sgerrand :

provides

List of package names (and optionally version info) this package provides.
If package with a version is provided (provides='foo=1.2') apk will consider it as an alternate name and it will automatically consider the package for installation by the alternate name, and conflict with other packages having the same name, or provides.

If version is not provided (provides='foo'), apk will consider it as virtual package name. Several package with same non-versioned provides can be installed simultaneously. However, none of them will be installed by default when requested by the virtual name - instead, error message is given and user is asked to choose which package providing the virtual name should be installed.

This definition shows that provides it meant as an alternate name for installation. Since this is glibc and not just a compatibility, it would make more since to set provide='glibc=2.35'

I'm not familiar with ABUILD, but there must be another way to show conflict between libc6-compat and other packages.

Copy link

Choose a reason for hiding this comment

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

@jalberti My this would work!?

depends="$pkgname bash !libc6-compat libgcc"

Notice the "!" added before libc6-compat. This makes the most since, and explains why that is in the depends list in the first place.

Excerpt from https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#depends

depends

Run-time dependency package(s) that are not shared-object dependencies. Shared objects dependencies are auto-
detected and should not be specified here. To specify a conflicting package, add the package name prefixed with a '!'.

conflicts="libc6-compat"
mkdir -p "$pkgdir/lib" "$pkgdir/lib64" "$pkgdir/usr/glibc-compat/lib/locale" "$pkgdir"/usr/glibc-compat/lib64 "$pkgdir"/etc
cp -a "$srcdir"/usr "$pkgdir"
cp "$srcdir"/ld.so.conf "$pkgdir"/usr/glibc-compat/etc/ld.so.conf
cp "$srcdir"/nsswitch.conf "$pkgdir"/etc/nsswitch.conf
Expand All @@ -28,17 +31,34 @@ package() {
rm -rf "$pkgdir"/usr/glibc-compat/share
rm -rf "$pkgdir"/usr/glibc-compat/var
ln -s /usr/glibc-compat/lib/ld-linux-x86-64.so.2 ${pkgdir}/lib/ld-linux-x86-64.so.2
ln -s /usr/glibc-compat/lib/ld-linux-x86-64.so.2 ${pkgdir}/lib64/ld-linux-x86-64.so.2
ln -s /usr/glibc-compat/lib/ld-linux-x86-64.so.2 ${pkgdir}/usr/glibc-compat/lib64/ld-linux-x86-64.so.2
ln -s /usr/glibc-compat/etc/ld.so.cache ${pkgdir}/etc/ld.so.cache
}

bin() {
depends="$pkgname bash libc6-compat libgcc"
pkgdesc="executable programs that come with glibc, installed to /usr/glibc-compat/"
depends="$pkgname libgcc"
depends="$depends bash" # shebang for ldd, sotrus, tzselect, xtrace
depends="$depends perl" # shebang for mtrace
mkdir -p "$subpkgdir"/usr/glibc-compat
Copy link

@b01 b01 Mar 28, 2024

Choose a reason for hiding this comment

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

so then add
depends="$depends !libc6-compat" # conflicts with this package

cp -a "$srcdir"/usr/glibc-compat/bin "$subpkgdir"/usr/glibc-compat
cp -a "$srcdir"/usr/glibc-compat/sbin "$subpkgdir"/usr/glibc-compat
}

utils() {
pkgdesc="a replacement for musl-utils that uses the glibc versions of those utilities"
depends="$pkgname-bin"
provides="musl-utils"
conflicts="musl-utils"
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/sbin
ln -s /usr/glibc-compat/bin/getconf "$subpkgdir"/usr/bin
ln -s /usr/glibc-compat/bin/getent "$subpkgdir"/usr/bin
ln -s /usr/glibc-compat/bin/iconv "$subpkgdir"/usr/bin
ln -s /usr/glibc-compat/bin/ldd "$subpkgdir"/usr/bin
ln -s /usr/glibc-compat/sbin/ldconfig "$subpkgdir"/usr/sbin
}

i18n() {
depends="$pkgname-bin"
arch="noarch"
Expand Down