You are not logged in.

#1 2023-01-06 15:27:10

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 168

[SOLVED] PKGBUILD - <file> exists in filesystem (owned by <package>)

Hello,
I created two PKGBUILD files, one for a package called "python-vtapi3" with the following content:

pkgname=python-vtapi3
_pkgname=virustotalapi3
pkgver=259.7d9e278
pkgrel=1
pkgdesc='The module that implements the VirusTotal API functions (3 version).'
arch=('any')
url='https://github.com/drobotun/virustotalapi3'
license=('MIT')
depends=('python' 'python-requests')
makedepends=('python-setuptools')
backup=('usr/lib/python3.10/site-packages/tests/__init__.py'
        'usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.opt-1.pyc'
        'usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.pyc'
)
options=(!emptydirs)
source=("git+https://github.com/drobotun/$_pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $_pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd "$_pkgname"

  python setup.py build
}

package() {
  cd "$_pkgname"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

and "python-aiosmtplib":

pkgname=python-aiosmtplib
_pkgname=aiosmtplib
pkgver=2.0.0
pkgrel=1
pkgdesc='Asynchronous SMTP client for use with asyncio.'
arch=('any')
url='https://github.com/cole/aiosmtplib'
license=('MIT')
depends=('python')
makedepends=('python-setuptools')
backup=('usr/lib/python3.10/site-packages/tests/__init__.py'
        'usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.opt-1.pyc'
        'usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.pyc')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('SKIP')

build() {
  cd "$_pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

so, as you can see in these two pieces of code, I added the following statement for avoiding any conflict according to the "backup" definition (https://wiki.archlinux.org/title/PKGBUILD#backup):

backup=('usr/lib/python3.10/site-packages/tests/__init__.py'
        'usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.opt-1.pyc'
        'usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.pyc'
)

When I try to install both of them by "makepkg -si", I get the following error:

<SNIP>
:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                                               [--------------------------------------------] 100%
(1/1) checking package integrity                                             [--------------------------------------------] 100%
(1/1) loading package files                                                  [--------------------------------------------] 100%
(1/1) checking for file conflicts                                            [--------------------------------------------] 100%
error: failed to commit transaction (conflicting files)
python-vtapi3: /usr/lib/python3.10/site-packages/tests/__init__.py exists in filesystem (owned by python-aiosmtplib)
python-vtapi3: /usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.opt-1.pyc exists in filesystem (owned by python-aiosmtplib)
python-vtapi3: /usr/lib/python3.10/site-packages/tests/__pycache__/__init__.cpython-310.pyc exists in filesystem (owned by python-aiosmtplib)
Errors occurred, no packages were upgraded.

So, I'm supposing "backup" works only with files inside "/etc/ folder. Is there a way to manage this case for files in "/usr" folder?

Last edited by D3vil0p3r (2023-04-11 19:36:46)

Offline

#2 2023-01-06 15:30:31

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: [SOLVED] PKGBUILD - <file> exists in filesystem (owned by <package>)

The package shouldn't have anything at all in /usr/lib/python3.10/site-packages/tests/. Get rid of the whole thing.

Offline

#3 2023-01-06 15:43:59

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 168

Re: [SOLVED] PKGBUILD - <file> exists in filesystem (owned by <package>)

Scimmia wrote:

The package shouldn't have anything at all in /usr/lib/python3.10/site-packages/tests/. Get rid of the whole thing.

So do you mean that the problem is at source that has files in /usr/lib/python3.10/site-packages/tests/?

Maybe I could remove them in "package()".

Offline

#4 2023-01-07 01:02:07

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [SOLVED] PKGBUILD - <file> exists in filesystem (owned by <package>)

Backup does not do what you seem to think. It is not a workaround for packages installing conflicting files. It wouldn't work if the second package tried to install identically named files to the first under /etc either.

You can't have two packages which install files with the same path/name installed at the same time. A file can belong to at most one installed package.

Edit: See https://wiki.archlinux.org/title/Python … te-package.

Last edited by cfr (2023-01-07 01:22:08)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2023-04-11 19:35:53

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 168

Re: [SOLVED] PKGBUILD - <file> exists in filesystem (owned by <package>)

In this specific case, I think that the developer of those Python packages should exclude tests folder on "setup.py". It solves this issue.

Last edited by D3vil0p3r (2023-04-11 19:36:04)

Offline

Board footer

Powered by FluxBB