anup-kodlekere / gaplib

GitHub Actions on Power/Z LXD Image Build
Apache License 2.0
6 stars 14 forks source link

Failure in convert-rpm.sh on s390x instance #14

Open kiszk opened 7 months ago

kiszk commented 7 months ago

When I execute the script ./build-selfhosted.sh -b docker ubuntu to build a image, I got the following errors.

=> => # Converting dotnet-host-8.0.1-1.el9_3.s390x.rpm... Unpacking of 'dotnet-host-8.0.1-1.el9_3.s390x.rpm' failed at /usr/share/perl5/Alien/Package/Rpm.pm line 168.                                                                                                                                                                                                                           
=> => # Converting dotnet-apphost-pack-6.0-6.0.26-1.el9_3.s390x.rpm... Unpacking of 'dotnet-apphost-pack-6.0-6.0.26-1.el9_3.s390x.rpm' failed at /usr/share/perl5/Alien/Package/Rpm.pm line 168.   

How can I avoid this issue? cc @shahidhs-ibm

kiszk commented 7 months ago

Even after I added apt-get -qq -y install cpio rpm2cpio into Dockerfile.ubuntu, I got the same error.

anup-kodlekere commented 7 months ago

@nealef would you be able to look into this?

nealef commented 7 months ago

Will do. Has anything changed?

anup-kodlekere commented 7 months ago

Nothing that I'm aware of. We have a couple of PRs in queue but I just haven't had the time to test the changes E2E and merge them.

kiszk commented 6 months ago

After further investigation, I realized that --no-absolute-filenames leads to this error. This option is specified in Rpm.pm in alien command.

How can we avoid this issue?

wget https://mirror.lchs.network/pub/almalinux/9.3/AppStream/s390x/os/Packages/dotnet-hostfxr-6.0-6.0.26-1.el9_3
rpm2cpio dotnet-host-8.0.1-1.el9_3.s390x.rpm  | cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time 
cpio: ./usr/bin/dotnet: Cannot open: No such file or directory
688 blocks
wget https://mirror.lchs.network/pub/almalinux/9.3/AppStream/s390x/os/Packages/dotnet-hostfxr-6.0-6.0.26-1.el9_3
rpm2cpio dotnet-host-8.0.1-1.el9_3.s390x.rpm  | cpio --extract --make-directories  --preserve-modification-time 
688 blocks
root@apache-arrow-github-action:/tmp/dotnet# ls -al usr/bin/
total 8
drwxr-xr-x 2 root root 4096 May  4 18:12 .
drwxr-xr-x 6 root root 4096 May  4 18:12 ..
lrwxrwxrwx 1 root root   30 May  4 18:12 dotnet -> ../..//usr/lib64/dotnet/dotnet
kiszk commented 6 months ago

I also saw the same behavior for another rpm

wget https://mirror.lchs.network/pub/almalinux/9.3/AppStream/s390x/os/Packages/dotnet-apphost-pack-6.0-6.0.26-1.el9_3.s390x.rpm
rpm2cpio dotnet-apphost-pack-6.0-6.0.26-1.el9_3.s390x.rpm | cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time
cpio: ./usr/lib/.build-id/2f/ecb3486594e76a0b3787a4b60b41579081774b.1: Cannot open: No such file or directory
880 blocks
wget https://mirror.lchs.network/pub/almalinux/9.3/AppStream/s390x/os/Packages/dotnet-apphost-pack-6.0-6.0.26-1.el9_3.s390x.rpm
rpm2cpio dotnet-apphost-pack-6.0-6.0.26-1.el9_3.s390x.rpm | cpio --extract --make-directories  --preserve-modification-time
880 blocks
ls -al usr/lib/.build-id/2f/ecb3486594e76a0b3787a4b60b41579081774b.1 
lrwxrwxrwx 1 root root 118 May  5 09:05 usr/lib/.build-id/2f/ecb3486594e76a0b3787a4b60b41579081774b.1 -> ../../../../usr/lib64/dotnet/packs/Microsoft.NETCore.App.Host.rhel.9-s390x/6.0.26/runtimes/rhel.9-s390x/native/apphost
nealef commented 6 months ago

I don’t understand what has changed. I have run the build script scores of times in the past without error.

kiszk commented 6 months ago

Hmm, interesting. I think that this issue is related to handling a symbolic link.

This is my workaround.

diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu
index 343faeb..ea10a3c 100644
--- a/Dockerfile.ubuntu
+++ b/Dockerfile.ubuntu
@@ -6,10 +6,14 @@ ENV     DEBIAN_FRONTEND=noninteractive

 RUN     apt-get -qq update -y && \
         apt-get -qq -y install wget git sudo alien curl libicu70 sudo && \
+        apt-get -qq -y install cpio rpm2cpio && \
         apt autoclean

 COPY    build-files/convert-rpm.sh /tmp

+RUN     sed "s/--no-absolute-filenames//" /usr/share/perl5/Alien/Package/Rpm.pm > /tmp/Rpm.pm
+RUN     cp /tmp/Rpm.pm /usr/share/perl5/Alien/Package/Rpm.pm
+
 RUN     /tmp/convert-rpm.sh ${SDK}

 RUN     dpkg --install /tmp/*.deb && \
nealef commented 6 months ago

It must be peculiar to powerPC as I don't have this problem with alien.