You are not logged in.

#1 2018-08-10 13:06:58

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 79

[solved] Building packages from git may include deleted files

Today I discovered a strange problem.
I was building a package from  this PKGBUILD:

# Maintainer: Richard Neumann aka rne. <r dot neumann at homeinfo fullstop de>

pkgname='backlight'
pkgver=r108.407c0f1
pkgrel=1
arch=('any')
pkgdesc="Backlight setting API and daemon."
depends=('python' 'i2c-tools')
optdepends=('python-docopt')
license=('GPL3')
groups=('homeinfo' 'hidsl')
source=("git+https://gitlab.com/HOMEINFO/backlight.git" "backlight.service")
sha256sums=('SKIP'
            'af6f566d9edcf8f70671ba3d4f5708bf40d2a8a78f17d8b5d89f2856f56b617c')


pkgver() {
    cd ${pkgname}
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}


package() {
    cd ${pkgname}
    python setup.py install --root=${pkgdir} --optimize=1
    mkdir -p ${pkgdir}/usr/lib/systemd/system
    install -m 644 ${srcdir}/backlight.service ${pkgdir}/usr/lib/systemd/system/
}

Some recent commits ago, I splitted the python module backlight.py into the several packages and modules, the repository contains now.
While executing makepkg after that, however, the git pull issued by makepkg did obviusly not delete the file backlight.py so that the pkg.tar.xz contained both, the python package and module.
After manually removing the checked-out repository under src/backlight, the package built correctly without the backlight.py module.
My question is, shouldn't the git command issued by makepkg automatically remove files, that were removed from the remote repository?
Or is it intended that before each build of packages sourced with git, one needs to manually clean the source tree beforehand?

Last edited by schard (2018-08-10 15:03:39)

Offline

#2 2018-08-10 14:46:43

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,374

Re: [solved] Building packages from git may include deleted files

It will remove deleted files from git, but it won't remove additional files generated by the build system.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2018-08-10 14:55:07

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 79

Re: [solved] Building packages from git may include deleted files

I know that it should work like that. But it didn't:

[build@abs backlight]$ pacman -Qpl backlight-r108.407c0f1-1-any.pkg.tar.xz
backlight /usr/
backlight /usr/bin/
backlight /usr/bin/backlight
backlight /usr/bin/backlightd
backlight /usr/lib/
backlight /usr/lib/python3.7/
backlight /usr/lib/python3.7/site-packages/
backlight /usr/lib/python3.7/site-packages/__pycache__/
backlight /usr/lib/python3.7/site-packages/__pycache__/backlight.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/__pycache__/backlight.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight-latest-py3.7.egg-info
backlight /usr/lib/python3.7/site-packages/backlight.py
backlight /usr/lib/python3.7/site-packages/backlight/
backlight /usr/lib/python3.7/site-packages/backlight/__init__.py
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/__init__.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/__init__.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/api.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/api.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/cli.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/cli.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/daemon.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/daemon.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/i2c.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/i2c.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api.py
backlight /usr/lib/python3.7/site-packages/backlight/api/
backlight /usr/lib/python3.7/site-packages/backlight/api/__init__.py
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/__init__.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/__init__.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/exceptions.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/exceptions.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/i2c.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/i2c.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/linux.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/linux.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/misc.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/misc.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/xrandr.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/xrandr.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/exceptions.py
backlight /usr/lib/python3.7/site-packages/backlight/api/i2c.py
backlight /usr/lib/python3.7/site-packages/backlight/api/linux.py
backlight /usr/lib/python3.7/site-packages/backlight/api/misc.py
backlight /usr/lib/python3.7/site-packages/backlight/api/xrandr.py
backlight /usr/lib/python3.7/site-packages/backlight/cli.py
backlight /usr/lib/python3.7/site-packages/backlight/daemon.py
backlight /usr/lib/python3.7/site-packages/backlight/i2c.py
backlight /usr/lib/systemd/
backlight /usr/lib/systemd/system/
backlight /usr/lib/systemd/system/backlight.service
backlight /usr/share/
backlight /usr/share/licenses/
backlight /usr/share/licenses/backlight/
backlight /usr/share/licenses/backlight/LICENSE
[build@abs backlight]$ find -name backlight.py
./src/backlight/build/lib/backlight.py
./src/backlight/usr/lib/python3.6/site-packages/backlight.py
./pkg/backlight/usr/lib/python3.7/site-packages/backlight.py
[build@abs backlight]$ rm -rf src/backlight
[build@abs backlight]$ makepkg -f
==> Erstelle Paket: backlight r108.407c0f1-1 (Fr 10 Aug 2018 14:01:09 CEST)
==> Prüfe Laufzeit-Abhängigkeiten...
==> Prüfe Buildtime-Abhängigkeiten...
==> Empfange Quellen...
  -> Aktualisiere das backlight git Repo...
Fordere an von origin
  -> backlight.service gefunden
==> Überprüfe source Dateien mit sha256sums...
    backlight ... Übersprungen
    backlight.service ... Durchgelaufen
==> Entpacke Quellen...
  -> Erstelle Arbeitskopie des backlight git Repos...
Klone nach 'backlight' ...
Fertig.
==> Beginne pkgver()...
==> Entferne existierendes $pkgdir/ Verzeichnis...
==> Betrete fakeroot Umgebung...
==> Beginne package()...
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/backlight
copying backlight/cli.py -> build/lib/backlight
copying backlight/daemon.py -> build/lib/backlight
copying backlight/__init__.py -> build/lib/backlight
creating build/lib/backlight/api
copying backlight/api/exceptions.py -> build/lib/backlight/api
copying backlight/api/linux.py -> build/lib/backlight/api
copying backlight/api/misc.py -> build/lib/backlight/api
copying backlight/api/xrandr.py -> build/lib/backlight/api
copying backlight/api/i2c.py -> build/lib/backlight/api
copying backlight/api/__init__.py -> build/lib/backlight/api
running build_scripts
creating build/scripts-3.7
copying and adjusting files/backlight -> build/scripts-3.7
copying and adjusting files/backlightd -> build/scripts-3.7
changing mode of build/scripts-3.7/backlight from 644 to 755
changing mode of build/scripts-3.7/backlightd from 644 to 755
running install_lib
creating /home/build/packages/backlight/pkg/backlight/usr
creating /home/build/packages/backlight/pkg/backlight/usr/lib
creating /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7
creating /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages
creating /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight
copying build/lib/backlight/cli.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight
copying build/lib/backlight/daemon.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight
creating /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api
copying build/lib/backlight/api/exceptions.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api
copying build/lib/backlight/api/linux.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api
copying build/lib/backlight/api/misc.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api
copying build/lib/backlight/api/xrandr.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api
copying build/lib/backlight/api/i2c.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api
copying build/lib/backlight/api/__init__.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api
copying build/lib/backlight/__init__.py -> /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/cli.py to cli.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/daemon.py to daemon.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api/exceptions.py to exceptions.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api/linux.py to linux.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api/misc.py to misc.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api/xrandr.py to xrandr.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api/i2c.py to i2c.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/api/__init__.py to __init__.cpython-37.pyc
byte-compiling /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight/__init__.py to __init__.cpython-37.pyc
writing byte-compilation script '/tmp/tmp2i8bt_ts.py'
/usr/sbin/python /tmp/tmp2i8bt_ts.py
removing /tmp/tmp2i8bt_ts.py
running install_scripts
creating /home/build/packages/backlight/pkg/backlight/usr/bin
copying build/scripts-3.7/backlight -> /home/build/packages/backlight/pkg/backlight/usr/bin
copying build/scripts-3.7/backlightd -> /home/build/packages/backlight/pkg/backlight/usr/bin
changing mode of /home/build/packages/backlight/pkg/backlight/usr/bin/backlight to 755
changing mode of /home/build/packages/backlight/pkg/backlight/usr/bin/backlightd to 755
running install_data
creating /home/build/packages/backlight/pkg/backlight/usr/share
creating /home/build/packages/backlight/pkg/backlight/usr/share/licenses
creating /home/build/packages/backlight/pkg/backlight/usr/share/licenses/backlight
copying LICENSE -> /home/build/packages/backlight/pkg/backlight/usr/share/licenses/backlight/
running install_egg_info
Writing /home/build/packages/backlight/pkg/backlight/usr/lib/python3.7/site-packages/backlight-latest-py3.7.egg-info
==> Säubere Installation...
  -> Entferne libtool Dateien...
  -> Bereinige ungewollte Dateien...
  -> Entferne statische Bibliotheken...
  -> Entferne unnötige Symbole aus Binär-Dateien und Bibliotheken...
  -> Komprimiere Man-Pages und Info-Seiten...
==> Checking for packaging issues...
==> Erstelle Paket "backlight"...
  -> Erstelle .PKGINFO Datei...
  -> Erstelle .BUILDINFO Datei...
  -> Erstelle .MTREE-Datei...
  -> Komprimiere Paket... 
==> Verlasse fakeroot Umgebung.
==> Signiere Paket(e)
  -> Signaturdatei backlight-r108.407c0f1-1-any.pkg.tar.xz.sig erstellt.
==> Beendete Erstellung: backlight r108.407c0f1-1 (Fr 10 Aug 2018 14:01:20 CEST)
[build@abs backlight]$ pacman -Qpl backlight-r108.407c0f1-1-any.pkg.tar.xz
backlight /usr/
backlight /usr/bin/
backlight /usr/bin/backlight
backlight /usr/bin/backlightd
backlight /usr/lib/
backlight /usr/lib/python3.7/
backlight /usr/lib/python3.7/site-packages/
backlight /usr/lib/python3.7/site-packages/backlight-latest-py3.7.egg-info
backlight /usr/lib/python3.7/site-packages/backlight/
backlight /usr/lib/python3.7/site-packages/backlight/__init__.py
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/__init__.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/__init__.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/cli.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/cli.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/daemon.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/__pycache__/daemon.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/
backlight /usr/lib/python3.7/site-packages/backlight/api/__init__.py
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/__init__.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/__init__.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/exceptions.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/exceptions.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/i2c.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/i2c.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/linux.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/linux.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/misc.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/misc.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/xrandr.cpython-37.opt-1.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/__pycache__/xrandr.cpython-37.pyc
backlight /usr/lib/python3.7/site-packages/backlight/api/exceptions.py
backlight /usr/lib/python3.7/site-packages/backlight/api/i2c.py
backlight /usr/lib/python3.7/site-packages/backlight/api/linux.py
backlight /usr/lib/python3.7/site-packages/backlight/api/misc.py
backlight /usr/lib/python3.7/site-packages/backlight/api/xrandr.py
backlight /usr/lib/python3.7/site-packages/backlight/cli.py
backlight /usr/lib/python3.7/site-packages/backlight/daemon.py
backlight /usr/lib/systemd/
backlight /usr/lib/systemd/system/
backlight /usr/lib/systemd/system/backlight.service
backlight /usr/share/
backlight /usr/share/licenses/
backlight /usr/share/licenses/backlight/
backlight /usr/share/licenses/backlight/LICENSE
[build@abs backlight]$

Update:
Oh. Now I understand you.
The file was leftover within the build dir, which is untracked by git and thus was never cleaned up.
Thanks for the hint. I will add a cleanup call to the PKGBUILD.

Last edited by schard (2018-08-10 15:03:29)

Offline

#4 2018-08-11 13:49:25

loqs
Member
Registered: 2014-03-06
Posts: 5,966

Re: [solved] Building packages from git may include deleted files

schard wrote:

Thanks for the hint. I will add a cleanup call to the PKGBUILD.

There is already makepkg -C

Offline

#5 2018-08-13 09:26:52

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 79

Re: [solved] Building packages from git may include deleted files

loqs wrote:
schard wrote:

Thanks for the hint. I will add a cleanup call to the PKGBUILD.

There is already makepkg -C

The problem ist not "${srcdir}", but rather "${pkgname}/build".
Thanks. This is also solves the issue.

Last edited by schard (2018-08-13 09:29:58)

Offline

Board footer

Powered by FluxBB