I need to backup some conf files of my package during upgrade into directory 
called e.g `/mypackage-<old-version>`.
So I'm trying to get old package version in `%pre` scriplet and doing it in the 
following way:
```
%pre
VERS=$(rpm --queryformat='%{VERSION}' -q mypackage)
VERS_ALTERNATIVE=$(rpm -qi mypackage | awk -F': ' '/Version/ {print $2}')
```
And the strange thing is that `VERS` variable got version of the package that 
I'm upgrading to (newer), while value of `VERS_ALTERNATIVE` contains version of 
the package that I'm upgrading from (older).

I'm do realize that invoking `rpm -q` in RPM scirplets is not the best idea, 
but anyway for me seems like this behavior is some kind of bug, as I suppose 
that in all cases result of `rpm -qi` and `rpm --queryformat` should output 
similar information.

I got this in CentOS 8 with RPM version 4.14.2. Same problem in CentOS 7.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1331
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to