You are not logged in.

#1 2015-05-02 14:19:23

drizzd
Member
Registered: 2012-10-20
Posts: 4

Moving post_install() to build()/package()

Hi,

I am maintaining a lot of octave-* packages on AUR. They currently do this in ocave-<pkg>.install:

post_install() {
  octave -q -f --eval "pkg install -verbose -global /usr/share/octave/$_pack.tar.gz"
}

This is an ugly hack that was necessary because the install modifies /usr/share/octave/octave_packages, where it keeps a list of installed packages. I now found a way to do the install in build()/package(), and to update octave_packages in the post_install() step. This is clearly a better solution.

To demonstrate, I have updated octave-miscellaneous accordingly:

Old: https://github.com/drizzd/octave-forge- … cellaneous
New: https://github.com/drizzd/octave-forge- … cellaneous

Now, I have the old package installed, and I should update to the new package with:

  pacman -U octave-miscellaneous-1.2.1-2-any.pkg.tar.xz

This results in the following error:

  error: failed to commit transaction (conflicting files)
  octave-miscellaneous: /usr/lib/octave/packages/miscellaneous-1.2.1/x86_64-unknown-linux-gnu-api-v49+/PKG_ADD exists in filesystem
  [...]

The reason is, of course, that pacman does not remove the files installed in the post_install() step of the old package. I tried to remove the files in the pre_upgrade() function of the new package, but the error above happens before pre_upgrade() is called. The only workaround I could find was to remove the package and all the packages it depends on:

pacman -R octave-miscellaneous <packages which depend on octave-miscellaneous>

Is there any way I can do this such that not every user of octave-* packages has to do this?

Cheers,
Clemens

Offline

#2 2015-05-02 14:51:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,438

Re: Moving post_install() to build()/package()

https://wiki.archlinux.org/index.php/PKGBUILD#install
Can you clean up in pre_remove or post_remove? It won't help with the currently installed packages.

Offline

#3 2015-05-02 15:08:36

Allan
Pacman Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,538
Website

Re: Moving post_install() to build()/package()

karol wrote:

https://wiki.archlinux.org/index.php/PKGBUILD#install
Can you clean up in pre_remove or post_remove? It won't help with the currently installed packages.

Nope - the remove (and thus install scripts) are run after conflict checking.

Offline

#4 2015-06-10 08:14:10

drizzd
Member
Registered: 2012-10-20
Posts: 4

Re: Moving post_install() to build()/package()

Ok, so I will instruct users to do this:

    pacman -Rc octave-miscellaneous
    pacman -U octave-miscellaneous-1.2.1-2-any.pkg.tar.xz

Last edited by drizzd (2015-06-10 08:14:33)

Offline

#5 2015-06-10 08:53:13

progandy
Member
Registered: 2012-05-17
Posts: 2,191

Re: Moving post_install() to build()/package()

You could release a new "octave" package, that removes all untracked files for all the addons.

pre_upgrade() {
    if (( $(vercmp 1.2.1-2 $2) < 0 )); then
        pkg ...
    fi
}

Offline

Board footer

Powered by FluxBB