You are not logged in.

#1 2021-12-02 16:35:25

Grossi_Claps
Member
Registered: 2017-03-28
Posts: 5

PKGBUILD review request: python-pytango

Hello, this is my first PKGBUILD, I wanted to make sure it's ok:

# Maintainer: Antonio Bartalesi <antonio.bartalesi@gmail.com>

pkgname=python-pytango
_name=${pkgname#python-}
pkgver=9.3.3
pkgrel=1
pkgdesc="A python binding for the Tango control system"
arch=('any')
url='https://pytango.readthedocs.io/en/stable/'
license=('LGPL3')
depends=('python>=3.6.0' 'tango>=9.3.0' 'boost>=1.33.0' 'python-numpy>=1.1.0' 'python-six>=1.10.10')
makedepends=(python-setuptools python-sphinx python-sphinx_rtd_theme)
optdepends=('python-gevent: for green mode')
source=("$_name-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz"
        "identity.patch")
sha256sums=('c09fc7a44cac8c2d95d3ad39ba644998e8f468c730dc495443a74de05a07e9f9'
            'c9f837b2cbe7c91eb76c1753ed1ae889cb30a0d65130086758ced6a3f404c750')

prepare() {
  cd ${srcdir}/${_name}-${pkgver}
  patch -Np1 -i "${srcdir}/identity.patch"
}

build() {
  cd "$_name-$pkgver"
  python setup.py build
}

package() {
  cd "$_name-$pkgver"
  python setup.py install --root="${pkgdir}/" --optimize=1 --skip-build
  install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE.txt"
}

and the identity.patch here:

diff '--color=auto' --unified --recursive --text pytango-9.3.3.a/tango/pytango_pprint.py pytango-9.3.3.b/tango/pytango_pprint.py
--- a/tango/pytango_pprint.py	2020-12-23 21:11:28.000000000 +0100
+++ b/tango/pytango_pprint.py	2021-01-22 11:08:02.273377683 +0100
@@ -51,7 +51,7 @@
 
 def __single_param(obj, param_name, f=repr, fmt='%s = %s'):
     param_value = getattr(obj, param_name)
-    if param_name is 'data_type':
+    if param_name == 'data_type':
         param_value = CmdArgType.values.get(param_value, param_value)
     return fmt % (param_name, f(param_value))
 

They both end with an extra linefeed (if you want to match the checksum).

Any feedback is welcome,
thank you!
Antonio

Offline

#2 2021-12-02 18:47:53

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: PKGBUILD review request: python-pytango

python-pytango E: ELF file ('usr/lib/python3.9/site-packages/tango/_tango.cpython-39-x86_64-linux-gnu.so') found in an 'any' package.

arch should be x86_64.

  cd ${srcdir}/${_name}-${pkgver}

$srcdir like $pkgdir can contain spaces and should be double quoted.

Offline

#3 2021-12-02 23:12:41

Grossi_Claps
Member
Registered: 2017-03-28
Posts: 5

Re: PKGBUILD review request: python-pytango

Thanks for your reply!
I don't understand the first error, when I compiled this on an armv7h and run namcap I got:

python-pytango E: ELF file ('usr/lib/python3.9/site-packages/tango/_tango.cpython-39-arm-linux-gnueabihf.so') found in an 'any' package.

Offline

#4 2021-12-02 23:43:49

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: PKGBUILD review request: python-pytango

.so shared objects are libraries compiled for a particular architecture.
Set the arch to the list of architectures the PKGBUILD supports.  It would seem to be at least x86_64 and armv7h.
The built package will include the architecture it is built for in the package name and will only work on that architecture.

Last edited by loqs (2021-12-02 23:44:18)

Offline

#5 2021-12-03 01:17:03

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: PKGBUILD review request: python-pytango

To elaborate on loqs answer, the "any" architecture should only be used for packages which do not contain architecture-specific (i.e. compiled) code. For example, data files for a game or a collection of Python scripts can be used as-is on any architecture.

However, compiled code such as C++ binary executables and libraries are compiled for specific architectures and will not work on others (e.g. if you compile for x86_64, you cannot use the same compiled package on armv7h). For packages that contain compiled and thus architecture-specific code, you specify the different architectures for which it can be compiled in the "arch" array. When you build the package with makepkg for a specific architecture listed in the arch array, the resulting package will be restricted to it to prevent installation on other architectures on which it wouldn't work. Architecture-specific packages include the architecture in the name, e.g. foo-1.3-1-x86_64.pkg.tar.zst or foo-1.3-1-armv7h.pkg.tar.zst. Pacman will only install packages that are supported by the system's architecture.

The ELF file warning is showing you that the package contains compiled code that will only work on a specific architecture, which means that it should not be marked as an "any" package.



General comments about the PKGBUILD:

The convention is to set the "_name" variable and then use it in the "pkgname":

_name=pytango
pkgname=python-$_name

Doing the inverse is functionally equivalent, but it's not as legible and may be confusing to users who are not familiar with Bash's builtin string manipulation.

It's also uncommon to specify minimum versions for dependencies. As Arch is a rolling release distro, you can assume that all packages are up-to-date when the package is built and you should consider older versions as unsupported. The version specification is usually used for pinning a dependency version when a package is tightly bound to one of its dependencies (e.g. directly compiled against a specific version and unable to work with others).

If the license already exists under /usr/share/licenses/common, then it should not be installed. Simply naming it in the license array is sufficient. See https://archlinux.org/pacman/PKGBUILD.5.html


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB