You are not logged in.

#1 2017-07-01 13:33:52

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Requesting review for a new AUR package.

Hello

I created a makepkg file for a plugin for blender called Animation Nodes and I want to have a review and some help.

# Maintainer: Omar Ahmad <omar.squircleart@gmail.com>
pkgname=animation_nodes
pkgver=2.0
pkgrel=1
pkgdesc="Node based visual scripting system designed for motion graphics in Blender."
arch=('any')
url="https://github.com/JacquesLucke/animation_nodes"
license=('GPL')
depends=('blender' 'python' 'cython' 'python-numpy')
source=('git+https://github.com/JacquesLucke/animation_nodes.git#branch=cython')
md5sums=('SKIP')
_blender_version=$(blender --version | grep -Po 'Blender \K[0-9]\...')

prepare() {
  cd "animation_nodes"
  sed -i 's/5/6/g' "setup.py"
  echo addonsDirectory = r"'$HOME/.config/blender/$_blender_version/scripts/addons'" > config.default.py
}
package() {
  cd "animation_nodes"
  mkdir -p "$HOME/.config/blender/$_blender_version/scripts/addons"
  python setup.py --all
}

The file build the plugin directly to its right directory, so I don't actually need to install it using pacman or build an arch package out of it. So is there is anyway I can stop makepkg from creating the tar file? Or is there a better way to do this?

Offline

#2 2017-07-01 14:12:06

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: Requesting review for a new AUR package.

Welcome to the Arch Linux forums and thank you for the contribution.

Two things.  First, never mess with the user's home directory.  That should always be left to a manual operation and you should send a message to the user using a post_install message
https://wiki.archlinux.org/index.php/Ar … irectories
--
What does setup.py do?  Where does it put those files?  The problem being, it runs as root -- it could do something nasty.   You should probably redesign it to but files into the the pkg directory structure so they can be put into the pkg tar file.  The whole point here is to let pacman be aware of where things are placed in the file system.  Don't circumvent that.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2017-07-01 14:13:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

The first thing I noticed is the pkgname - you are using vcs source, so the pkgname needs to have "-git" at the end and you should have a pkgver function.

But *far far* more important is what I saw after that: this is completely non-workable as a PKGBUILD.  A PKGBUILD cannot place anything in $HOME - the concept of $HOME doesn't even make sense in the context of making packages.

You seem to recognize this in what you say after the PKGBUILD - but then what is this?  A PKGBUILD is for building packages.  If you don't want to build a package, don't use a PKGBUILD.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2017-07-01 16:03:34

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

Blender store plugins in one of two directories, at .config/blender/... or at usr/share/blender/... and they both work. Setup.py is a python script that compile the code and put the result in the directory defined by "$HOME/.config/blender/$_blender_version/scripts/addons" which is one of the directories blender accepts. I tried putting it to the other directory but it returns a permission denied error. That's the main reason why I am compiling in home.

From what I understood from your post, I should compile the script in the pkg directory then move the file into usr/share/blender/...? Can you elaborate with an example on that? Sorry, I just moved to linux and have no much experience.

Offline

#5 2017-07-01 16:55:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

OmarSquircleArt wrote:

I should compile the script in the pkg directory then move the file into usr/share/blender/...? Can you elaborate with an example on that? Sorry, I just moved to linux and have no much experience.

See the wiki.

You direct the script to install files to ${pkgdir}/usr/share/blender/.  That's it.  They are placed in /usr/share/blender by pacman when you install the package.  Think of ${pkgdir} as the root of an imaginary filesystem.  Everything in a package is placed under ${pkgdir} into this imaginary filesystem.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2017-07-01 17:26:42

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

I am starting to understand this better, I tried that here:

# Maintainer: Omar Ahmad <omar.squircleart@gmail.com>
pkgname=animation-nodes-git
pkgver=2.0
pkgrel=1
pkgdesc="Node based visual scripting system designed for motion graphics in Blender."
arch=('any')
url="https://github.com/JacquesLucke/animation_nodes"
license=('GPL')
depends=('blender' 'python' 'cython' 'python-numpy')
source=('git+https://github.com/JacquesLucke/animation_nodes.git#branch=cython')
md5sums=('SKIP')
_blender_version=$(blender --version | grep -Po 'Blender \K[0-9]\...')

prepare() {
  cd "animation_nodes"
  sed -i 's/5/6/g' "setup.py"
  echo addonsDirectory = r"'${pkgdir}/usr/share/blender/$_blender_version/scripts/addons'" > config.default.py
}
package() {
  cd "animation_nodes"
  python setup.py --all
}

However, the setup script returns an error saying that the path doesn't exist probably because python doesn't know what ${pkgdir} means. The python script copies files based on the path given in the config.default.py file which we set to r"'${pkgdir}/usr/share/blender/$_blender_version/scripts/addons'".

Offline

#7 2017-07-01 18:30:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

The script doesn't need to know what ${pkgdir} means as it will be expanded by the shell before the script sees it.  You may need to make the path first: `mkdir -p ${pkgdir}/usr/share/blender/$_blender_version/scripts/addons`.  But there's also some very odd quoting in your prepare function - the single quotes could prevent the expansion of the pkgdir variable.  That whole echo line looks very odd to me.  Can you give an example of what should end up in config.default.py?

EDIT: it seems the pkgdir will properly be exanded as is, but should the config file set that variable equal to the letter r followed by a path in single quotes?  I'm crap with python, but that just doesn't seem right to me - what's the 'r'?

Also defining the blender version variable outside the functions is not a good idea.  The PKGBUILD is parsed before any dependencies are installed - so creating that variable will fail if someone tries to run `makepkg -s` to install dependencies.  Do these blender addons need to be tied to a specific version?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2017-07-01 18:38:17

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

The 'r' tell python that the following string is a raw string that doesn't contain any escape characters.
An example for the resulting final path is '/usr/share/blender/2.78/scripts/addons'.
I am pretty sure that the path exist because blender has multiple plugins there.
Every new blender installation creates its own blender addons folder so I think the version is needed.

Last edited by OmarSquircleArt (2017-07-01 18:39:54)

Offline

#9 2017-07-01 18:40:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

Thanks for clarifying the 'r'.

No, that path does not exist.  The variable expands to the directory you are building in followed by pkg/animation-nodes-git/ - nothing exists there when makepkg starts.  Again see above: you are assembling your build results in a "fake" root directory - it starts out *completely* empty.  If you want a path like /usr/share to exist there, you need to create it in your PKGBUILD.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2017-07-01 18:51:38

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

I see, Thanks for the clarification. I just tested it and it is working properly. Thanks again. So after your notes the makepkg is as follows:

# Maintainer: Omar Ahmad <omar.squircleart@gmail.com>
pkgname=animation-nodes-git
pkgver=2.0
pkgrel=1
pkgdesc="Node based visual scripting system designed for motion graphics in Blender."
arch=('any')
url="https://github.com/JacquesLucke/animation_nodes"
license=('GPL')
depends=('blender' 'python' 'cython' 'python-numpy')
source=('git+https://github.com/JacquesLucke/animation_nodes.git#branch=cython')
md5sums=('SKIP')

prepare() {
  cd "animation_nodes"
  sed -i 's/5/6/g' "setup.py"
  _blender_version=$(blender --version | grep -Po 'Blender \K[0-9]\...')
  echo addonsDirectory = r"'$pkgdir/usr/share/blender/$_blender_version/scripts/addons'" > config.default.py
}
package() {
  cd "animation_nodes"
  mkdir -p ${pkgdir}/usr/share/blender/$_blender_version/scripts/addons
  python setup.py --all
}

Are there more things to be fixed?

Offline

#11 2017-07-01 19:02:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

That looks great.

I don't have blender to test it myself - but if it's working then you are almost there.  You should include a pkgver function rather than just specifying 2.0 as this builds from git.

https://wiki.archlinux.org/index.php/VC … 9_function


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#12 2017-07-01 19:59:28

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

I asked the developer and he said he wanted some special pkgver function so I will have to do some studying before making it. Will get back when I make it by tomorrow.

Offline

#13 2017-07-02 13:16:32

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

Here is the script after adding the pkgver function. I tested it again and it is working.

# Maintainer: Omar Ahmad <omar.squircleart@gmail.com>
pkgname=animation-nodes-git
pkgver=2.0.1
pkgrel=1
pkgdesc="Node based visual scripting system designed for motion graphics in Blender."
arch=('any')
url="https://github.com/JacquesLucke/animation_nodes"
license=('GPL')
depends=('blender' 'python' 'cython' 'python-numpy')
source=('git+https://github.com/JacquesLucke/animation_nodes.git#branch=cython')
md5sums=('SKIP')

pkgver() {
  cd "animation_nodes/animation_nodes"
  sed -n 's/.*\"version\":[^(]*(\(.*\)).*/\1/p' __init__.py |sed 's/, /\./g'
}
prepare() {
  cd "animation_nodes"
  sed -i 's/5/6/g' "setup.py"
  _blender_version=$(blender --version | grep -Po 'Blender \K[0-9]\...')
  echo addonsDirectory = r"'$pkgdir/usr/share/blender/$_blender_version/scripts/addons'" > config.default.py
}
package() {
  cd "animation_nodes"
  _blender_version=$(blender --version | grep -Po 'Blender \K[0-9]\...')
  mkdir -p ${pkgdir}/usr/share/blender/$_blender_version/scripts/addons
  python setup.py --all
}

Based on what you said, I had to initialize the variable $_blender_version twice in both function. Is there is better way of handling this?
Also, there is a "-1" beside the version, what is it?

Offline

#14 2017-07-02 13:58:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

That pkgver function doesn't return an appropriate pkgver for a vcs build.  That may be what the upstream developer would want the version number to be for a stable release, but you are not packaging a stable versioned release, you are packaging development code.  This must have a monotonic value that is increased with each change.  You *could* use that followed by a git-based revision number if you really want:

pkgver() {
   cd animation_nodes
   echo $(sed -n 's/ *"version":[^(]*(\([0-9]*\), \([0-9]*\), \([0-9]*\).*/\1.\2.\3/p' animation_nodes/__init__.py).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

But there are tags, I'd say it'd really be better to use them as advised in the wiki:

pkgver() {
   cd animation_nodes
   git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

As for finding the blender version in each function - I don't think there is a better way.  Note that doing it outside the function may look like less code, but it would still actually be executed multiple times (the PKGBUILD can be sourced more than once).  More importantly, that code to determine the version will fail outside the functions under many cases.

Lastly, the -1 is the pkgrel.  Build packages always have a pkgver and a pkgrel.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#15 2017-07-02 15:30:25

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

Ok got it, Thanks !

# Maintainer: Omar Ahmad <omar.squircleart@gmail.com>
pkgname=animation-nodes-git
pkgver=2.0.1.r4629.ed9873f4
pkgrel=1
pkgdesc="Node based visual scripting system designed for motion graphics in Blender."
arch=('any')
url="https://github.com/JacquesLucke/animation_nodes"
license=('GPL')
depends=('blender' 'python' 'cython' 'python-numpy')
source=('git+https://github.com/JacquesLucke/animation_nodes.git#branch=cython')
md5sums=('SKIP')

pkgver() {
  cd "animation_nodes"
  echo $(sed -n 's/ *"version":[^(]*(\([0-9]*\), \([0-9]*\), \([0-9]*\).*/\1.\2.\3/p' animation_nodes/__init__.py).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
prepare() {
  cd "animation_nodes"
  sed -i 's/5/6/g' "setup.py"
  _blender_version=$(blender --version | grep -Po 'Blender \K[0-9]\...')
  echo addonsDirectory = r"'$pkgdir/usr/share/blender/$_blender_version/scripts/addons'" > config.default.py
}
package() {
  cd "animation_nodes"
  _blender_version=$(blender --version | grep -Po 'Blender \K[0-9]\...')
  mkdir -p ${pkgdir}/usr/share/blender/$_blender_version/scripts/addons
  python setup.py --all
}

Should I worry about package upgrading or does pacman take care of that automatically?

Offline

#16 2017-07-02 17:01:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

OmarSquircleArt wrote:

Should I worry about package upgrading or does pacman take care of that automatically?

I'm not sure if I'm understanding this correctly.  Pacman will only automatically update packages from the repos, not from the AUR.  You can rebuild and install your AUR packages whenever you want/need to.  There are helper tools that assist with this, but you should avoid relying on them until you know how the AUR works.  You should probably read over the AUR page in the wiki:
https://wiki.archlinux.org/index.php/Ar … Repository


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#17 2017-07-02 17:09:25

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

I mean when I rebuilt and install. Will the old package be automatically removed and replaced by the new one? Aren't pacman the one who does that?

Should I now move to submitting the file to AUR now?

Offline

#18 2017-07-02 17:15:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

Ah, yes, when you rebuild the package it you will install it with pacman (or if you pass the -i flag to makepkg it will install it with pacman) and pacman will remove any existing versions of the package with the same name.

If you installed a previous version of this with a different pkgname (e.g., without the "-git" on the end) then pacman will not remove the previous version unless this one includes a replaces variable.

In any case, it looks good to go to the AUR to me.: I've not tested it myself, but it looks like a good PKGBUILD now.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#19 2017-07-02 18:12:50

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

I am following the AUR page for submitting and I am having some issue.After creating the SSH keys and making the configuration file. Running "git clone ssh://aur@aur.archlinux.org/package_name.git" gives me this error:

sudo git clone ssh://aur@aur.archlinux.org/package_name.git
Cloning into 'package_name'...
The authenticity of host 'aur.archlinux.org (5.9.250.164)' can't be established.
ECDSA key fingerprint is SHA256:L71Q91yHwmHPYYkJMDgj0xmUuw16qFOhJbBr1mzsiOI.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'aur.archlinux.org,5.9.250.164' (ECDSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Offline

#20 2017-07-02 19:58:16

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

Actually, it was just looking at the global configuration and not the user one. So I just had to configure the global SSH to make it work.

Offline

#21 2017-07-02 20:15:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

It was looking for the global config because you used sudo.  The directions don't say to use sudo - break the habit of randomly running commands as root for no reason.

Also package_name is a placeholder, you should fill it in with your package's name.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#22 2017-07-02 23:34:21

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Requesting review for a new AUR package.

Trilby wrote:

If you installed a previous version of this with a different pkgname (e.g., without the "-git" on the end) then pacman will not remove the previous version unless this one includes a replaces variable.

Well, not really. I assume you meant to write "a conflicts variable".

replaces would work as well, assuming the package was then added to a repository (for example a "custom" repository, possibly using aurutils), and then ran `pacman -Syu`. Which is to say, not usually.


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

Offline

#23 2017-07-02 23:55:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: Requesting review for a new AUR package.

Oops, yes.  Sorry about that.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#24 2017-07-03 07:49:30

OmarSquircleArt
Member
From: Cairo, Egypt
Registered: 2017-07-01
Posts: 23
Website

Re: Requesting review for a new AUR package.

Ok, it is up: https://aur.archlinux.org/packages/animation-nodes-git/

Thanks alot for guiding me through it. I now have a better understanding of linux and makepkg. Thanks for the tips as well.

Offline

Board footer

Powered by FluxBB