alexheretic / aurto

Arch Linux AUR tool for managing an auto-updating local 'aurto' package repository
MIT License
138 stars 10 forks source link

Fails to build python split package #15

Closed nicoulaj closed 5 years ago

nicoulaj commented 5 years ago

The python-usbtmc package fails to build:

$ aurto add python-usbtmc                                                                      
aurto: Checking maintainer trust... ✓
aurto: Running: aur sync --no-view --no-confirm --chroot --database=aurto --makepkg-conf=/etc/aurto/makepkg-chroot.conf python-usbtmc
 ERROR: Build failed, check /var/lib/aurbuild/x86_64/nicoulaj/build 
==> Using [aurto] repository
  -> python-usbtmc: (none) -> 0.8-1
==> Retrieving package files
From https://aur.archlinux.org/python-usbtmc
 = [up to date]      master     -> origin/master
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 aurto is up to date
:: Starting full system upgrade...
 there is nothing to do
container path: /var/lib/aurbuild/x86_64
Running makechrootpkg -cu --
==> Synchronizing chroot copy [/var/lib/aurbuild/x86_64/root] -> [nicoulaj]...done
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 aurto is up to date
:: Starting full system upgrade...
 there is nothing to do
==> Making package: python-usbtmc 0.8-1 (Fri Feb  8 10:52:19 2019)
==> Retrieving sources...
  -> Found python-usbtmc-0.8.tar.gz
==> Validating source files with sha256sums...
    python-usbtmc-0.8.tar.gz ... Passed
==> Making package: python-usbtmc 0.8-1 (Fri 08 Feb 2019 10:52:20 AM CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found python-usbtmc-0.8.tar.gz
==> WARNING: Skipping all source file integrity checks.
==> Extracting sources...
  -> Extracting python-usbtmc-0.8.tar.gz with bsdtar
==> Entering fakeroot environment...
==> Starting package_python-usbtmc()...
/startdir/PKGBUILD: line 17: python: command not found
==> ERROR: A failure occurred in package_python-usbtmc().
    Aborting...
==> ERROR: Build failed, check /var/lib/aurbuild/x86_64/nicoulaj/build
`aur sync --no-view --no-confirm --chroot --database=aurto --makepkg-conf=/etc/aurto/makepkg-chroot.conf python-usbtmc` failed with exit code 255 ✗

It seems the python dependency does not get installed in the chroot:

$ ls /var/lib/aurbuild/x86_64/root/usr/bin/python                                              
ls: cannot access '/var/lib/aurbuild/x86_64/root/usr/bin/python': No such file or directory

The PKGBUILD looks correct to me though ?

My guess is that dependencies declared in package() are not installed at all, can't see any trace of python-pyusb in the chroot either:

$ ls /var/lib/aurbuild/x86_64/root/usr/lib/python3.7/site-packages/                            
libmount/  drv_libxml2.py  libxml2mod.so*  libxml2.py
alexheretic commented 5 years ago

Hey, this isn't really an aurto issue as the behaviour still happens if you manually call the aurutils command aur sync --no-view --no-confirm --chroot --database=aurto --makepkg-conf=/etc/aurto/makepkg-chroot.conf python-usbtmc

In most cases this won't be an aurutils issue either, more likely a PKGBUILD issue.

In this case the problem is building using a clean chroot, this environment does not already have python installed.

The PKGBUILD has

package_python-usbtmc() {
  depends=('python' 'python-pyusb')

  cd "$srcdir/python-usbtmc-$pkgver"
  python setup.py install --prefix=/usr --root="$pkgdir/" --optimize=1

  install -m 0644 -D usbtmc.rules $pkgdir/etc/udev/rules.d/40-usbtmc.rules
}

This is not going to work in chroot, because in the same function that it's declared that python is a dependency, python is actually executed.

nicoulaj commented 5 years ago

I don't really see why it would be different for a chroot build compared to a "classic" AUR helper, I believe it should collect dependencies from the SRCINFO, which looks correct to me ? That's what yay does.

Anyway, I agree the issue seems to be more on aurutils side, I will file an issue there.

nicoulaj commented 5 years ago

Got some explanation on IRC:

│coderobe │ nicoulaj: neither, the pkgbuild is broken                                        
│       ⤷ │ Missing python as build dep                                                     
│       ⤷ │ Depends added in package are not considered build deps                          
│       ⤷ │ That's makepkg's call to make and definitely not a bug of any wrapper           
│       ⤷ │ Helpers building this in a clean chroot without failure would be broken behavior
│       ⤷ │ makedepends should be python and python2      

Sorry for the inconvenience and thanks!