You are not logged in.

#1 2012-10-29 12:43:40

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,420
Website

Old version null when called from function in pkg.install [SOLVED]

According to /usr/share/pacman/proto.install:

## arg 1:  the new package version
## arg 2:  the old package version
#pre_upgrade() {
  # do something here
#}

I understand this to mean that $1 = new version and $2 = old version.  In my case, pacman returns a null for $2 when called in this fashion from my package.install:

pre_upgrade() {
  newpkgver=${1%-*}
  oldpkgver=${2%-*}

echo "dollar 1 is $1"
echo "dollar 2 is $2"
echo "new is $newpkgver"
echo "old is $oldpkgver"
}

I currently have verion 3.16-1 installed.

% pacman -Qm | grep profile-sync
profile-sync-daemon 3.16-1

Here is the output when I ask pacman to install the package I just built.  Why is $2 a null?

loading packages...
resolving dependencies...
looking for inter-conflicts...

Targets (1): profile-sync-daemon-4.02-1

Total Installed Size:   0.07 MiB
Net Upgrade Size:       0.05 MiB

Proceed with installation? [Y/n] 
(1/1) checking package integrity                                                                               [##################################################################] 100%
(1/1) loading package files                                                                                    [##################################################################] 100%
(1/1) checking for file conflicts                                                                              [##################################################################] 100%
dollar 1 is 4.02-1
dollar 2 is 
new is 4.02
old is 

Last edited by graysky (2012-10-29 15:09:55)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2012-10-29 13:42:57

xduugu
Member
Registered: 2008-10-16
Posts: 280

Re: Old version null when called from function in pkg.install [SOLVED]

Okay, I understand now what you meant. This seems to be a bug in pacman which was already fixed half a year ago, but for some reason it hasn't been released yet.

Offline

#3 2012-10-29 14:49:55

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,420
Website

Re: Old version null when called from function in pkg.install [SOLVED]

@xduugu - Thank you!  How in the world did you find that?  Anyway, if I apply that patch, everything works as expected.  I will open a flyspray asking for a 4.0.4 to incorporate this patch.  Dunno if Allan will do it but I can always ask, right?  I do not want to release psd 4.x until this happens.

EDIT: https://bugs.archlinux.org/task/32278

Last edited by graysky (2012-10-29 14:59:11)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2012-10-29 14:55:21

Lekensteyn
Member
From: Netherlands
Registered: 2012-06-19
Posts: 179
Website

Re: Old version null when called from function in pkg.install [SOLVED]

I found it when checking the source code (libalpm). For DKMS packages, I am using a workaround: https://wiki.archlinux.org/index.php/DK … f_files.3F

Last edited by Lekensteyn (2012-10-29 14:55:29)

Offline

#5 2012-10-29 15:07:38

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,420
Website

Re: Old version null when called from function in pkg.install [SOLVED]

@Lekensteyn - Excellent find!  Thank you!

EDIT: So obvious in retrospect smile

Last edited by graysky (2012-10-29 15:26:22)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB