Bug 2894 - rpm mishandling pkg_postinst
Summary: rpm mishandling pkg_postinst
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.5
Assignee: Mark Hatle
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2012-08-05 02:30 UTC by Khem Raj
Modified: 2013-09-24 15:19 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Khem Raj 2012-08-05 02:30:31 UTC
I have a situation like this

I have got a package openjdk-6-vm-cacao which rdepends on openjdk-6-common
and this openjdk-6-vm-cacao has a postinst script which modifies a file that should be installed by openjdk-6-common

so I think it should all work fine since 

rpm -qlp --requires ../../../build/tmp/deploy/rpm/x86_64/openjdk-6-vm-cacao-6b24+1.11.1-r21.0.x86_64.rpm 
libgcc1 >= 4.7.1.0+git1+d07e24f4ab59f264d68d21838795349faab5dede
openjdk-6-common

and postinst is 

pkg_postinst_${JDKPN}-vm-cacao () {
        if grep -q "\-server ERROR" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && ! grep -q "KNOWN" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
          sed -i -e "/\-cacao.*/d" -e "s|\(^\-server*\)|\-cacao KNOWN\n\1|" -e "/^$/d" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
        else
          sed -i -e "s/\-cacao.*/\-cacao KNOWN/" ${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
        fi
}


its modifying jvm.cfg which should come from openjdk-6-common

 /work/yocto/poky/build/tmp/sysroots/x86_64-linux/usr/bin/rpm -qlp ../../../build/tmp/deploy/rpm/x86_64/openjdk-6-common-6b24+1.11.1-r21.0.x86_64.rpm  | grep jvm.cfg
/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jvm.cfg

so we see the file is there


Now at install (image do_rootfs) time


 openjdk-6-vm-cacao          ##################################################
| grep: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jvm.cfg: No such file or directory
| sed: can't read /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jvm.cfg: No such file or directory
| libxtst6                    ##################################################
| Running useradd commands...
| avahi-daemon                ##################################################
|  Adding system startup for /work/yocto/poky/build/tmp/work/re_64b-poky-linux/core-image-junos-1.0-r0/rootfs/etc/init.d/avahi-daemon.
| at                          ##################################################
| pam-plugin-deny             ##################################################
| pam-plugin-permit           ##################################################
| pam-plugin-warn             ##################################################


.........

| update-alternatives: Linking /work/yocto/poky/build/tmp/work/re_64b-poky-linux/core-image-junos-1.0-r0/rootfs//usr/bin/flock to flock.util-linux
| update-alternatives: Linking /work/yocto/poky/build/tmp/work/re_64b-poky-linux/core-image-junos-1.0-r0/rootfs//sbin/hwclock to ../bin/busybox
| openjdk-6-common            ##################################################
| openjdk-6-jre               ##################################################
| update-alternatives: Linking /work/yocto/poky/build/tmp/work/re_64b-poky-linux/core-image-junos-1.0-r0/rootfs//usr/bin/java to /usr/lib/jvm/java-6-openjdk/jre/bin/java
| openjdk-6-java              ##################################################


as you can see the order of installation is wrong. I would have expected
openjdk-6-common to install before openjdk-6-vm-cacao
Comment 1 Khem Raj 2012-08-05 18:11:20 UTC
OK one problem is that postrm hook should have used $D which I did make a change but result is still same.

new postrm is 

pkg_postinst_${JDKPN}-vm-cacao () {
        if grep -q "\-server ERROR" $D${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg && ! grep -q "KNOWN" $D${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg; then
          sed -i -e "/\-cacao.*/d" -e "s|\(^\-server*\)|\-cacao KNOWN\n\1|" -e "/^$/d" $D${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
        else
          sed -i -e "s/\-cacao.*/\-cacao KNOWN/" $D${JDK_HOME}/jre/lib/${JDK_ARCH}/jvm.cfg
        fi
}


and error is same

openjdk-6-vm-cacao          ##################################################
grep: /work/yocto/poky/build/tmp/work/re_64b-poky-linux/core-image-junos-1.0-r0/rootfs/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jvm.cfg: No such file or directory
sed: can't read /work/yocto/poky/build/tmp/work/re_64b-poky-linux/core-image-junos-1.0-r0/rootfs/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/jvm.cfg: No such file or directory
Comment 2 Mark Hatle 2012-08-24 21:17:09 UTC
I think the issue is related to the way the items are being called..

Someone needs to do a bit more triage on this item and figure out if the thing being searched for is not yet installed (install order issue) or there is some other type of problem.
Comment 3 Saul Wold 2013-04-30 23:18:21 UTC
Khem, can you verify if this is still a problem?
Comment 4 Mark Hatle 2013-09-24 15:19:53 UTC
I believe this is fixed, see oe-core commit:


commit c1acac8c46aa75d78634c30de773b28a1466070c
Author: Mark Hatle <mark.hatle@windriver.com>
Date:   Thu Nov 15 15:31:11 2012 -0600