diff options
| -rw-r--r-- | meta/classes/package_rpm.bbclass | 33 | ||||
| -rw-r--r-- | meta/classes/rootfs_rpm.bbclass | 25 | ||||
| -rw-r--r-- | meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch | 159 | ||||
| -rw-r--r-- | meta/recipes-devtools/rpm/rpm_5.4.0.bb | 3 |
4 files changed, 199 insertions, 21 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 2c5545c11d..2ace0537ac 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
| @@ -382,13 +382,39 @@ package_install_internal_rpm () { | |||
| 382 | cat ${target_rootfs}/install/install_solution.manifest > ${target_rootfs}/install/total_solution.manifest | 382 | cat ${target_rootfs}/install/install_solution.manifest > ${target_rootfs}/install/total_solution.manifest |
| 383 | cat ${target_rootfs}/install/install_multilib_solution.manifest >> ${target_rootfs}/install/total_solution.manifest | 383 | cat ${target_rootfs}/install/install_multilib_solution.manifest >> ${target_rootfs}/install/total_solution.manifest |
| 384 | 384 | ||
| 385 | # Construct install scriptlet wrapper | ||
| 386 | cat << EOF > ${WORKDIR}/scriptlet_wrapper | ||
| 387 | #!/bin/bash | ||
| 388 | |||
| 389 | export PATH="${PATH}" | ||
| 390 | export D="${target_rootfs}" | ||
| 391 | export OFFLINE_ROOT="\$D" | ||
| 392 | export IPKG_OFFLINE_ROOT="\$D" | ||
| 393 | export OPKG_OFFLINE_ROOT="\$D" | ||
| 394 | |||
| 395 | \$2 \$1/\$3 \$4 | ||
| 396 | if [ \$? -ne 0 ]; then | ||
| 397 | mkdir -p \$1/etc/rpm-postinsts | ||
| 398 | num=100 | ||
| 399 | while [ -e \$1/etc/rpm-postinsts/\${num} ]; do num=\$((num + 1)); done | ||
| 400 | echo "#!\$2" > \$1/etc/rpm-postinsts/\${num} | ||
| 401 | echo "# Arg: \$4" >> \$1/etc/rpm-postinsts/\${num} | ||
| 402 | cat \$1/\$3 >> \$1/etc/rpm-postinsts/\${num} | ||
| 403 | chmod +x \$1/etc/rpm-postinsts/\${num} | ||
| 404 | fi | ||
| 405 | EOF | ||
| 406 | |||
| 407 | chmod 0755 ${WORKDIR}/scriptlet_wrapper | ||
| 408 | |||
| 385 | # Attempt install | 409 | # Attempt install |
| 386 | ${RPM} --root ${target_rootfs} \ | 410 | ${RPM} --root ${target_rootfs} \ |
| 387 | --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ | 411 | --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ |
| 388 | --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ | 412 | --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \ |
| 413 | -D "_var ${localstatedir}" \ | ||
| 389 | -D "_dbpath ${rpmlibdir}" \ | 414 | -D "_dbpath ${rpmlibdir}" \ |
| 390 | --noscripts --notriggers --noparentdirs --nolinktos --replacepkgs \ | 415 | --noparentdirs --nolinktos --replacepkgs \ |
| 391 | -D "__dbi_txn create nofsync private" \ | 416 | -D "__dbi_txn create nofsync private" \ |
| 417 | -D "_cross_scriptlet_wrapper ${WORKDIR}/scriptlet_wrapper" \ | ||
| 392 | -Uhv ${target_rootfs}/install/total_solution.manifest | 418 | -Uhv ${target_rootfs}/install/total_solution.manifest |
| 393 | } | 419 | } |
| 394 | 420 | ||
| @@ -685,6 +711,7 @@ python write_specfile () { | |||
| 685 | elif script == 'postrm': | 711 | elif script == 'postrm': |
| 686 | spec_scriptlets_bottom.append('%%postun -n %s' % splitname) | 712 | spec_scriptlets_bottom.append('%%postun -n %s' % splitname) |
| 687 | scriptvar = wrap_uninstall(scriptvar) | 713 | scriptvar = wrap_uninstall(scriptvar) |
| 714 | spec_scriptlets_bottom.append('# %s - %s' % (splitname, script)) | ||
| 688 | spec_scriptlets_bottom.append(scriptvar) | 715 | spec_scriptlets_bottom.append(scriptvar) |
| 689 | spec_scriptlets_bottom.append('') | 716 | spec_scriptlets_bottom.append('') |
| 690 | 717 | ||
| @@ -762,19 +789,23 @@ python write_specfile () { | |||
| 762 | 789 | ||
| 763 | if srcpreinst: | 790 | if srcpreinst: |
| 764 | spec_scriptlets_top.append('%pre') | 791 | spec_scriptlets_top.append('%pre') |
| 792 | spec_scriptlets_top.append('# %s - preinst' % srcname) | ||
| 765 | spec_scriptlets_top.append(srcpreinst) | 793 | spec_scriptlets_top.append(srcpreinst) |
| 766 | spec_scriptlets_top.append('') | 794 | spec_scriptlets_top.append('') |
| 767 | if srcpostinst: | 795 | if srcpostinst: |
| 768 | spec_scriptlets_top.append('%post') | 796 | spec_scriptlets_top.append('%post') |
| 797 | spec_scriptlets_top.append('# %s - postinst' % srcname) | ||
| 769 | spec_scriptlets_top.append(srcpostinst) | 798 | spec_scriptlets_top.append(srcpostinst) |
| 770 | spec_scriptlets_top.append('') | 799 | spec_scriptlets_top.append('') |
| 771 | if srcprerm: | 800 | if srcprerm: |
| 772 | spec_scriptlets_top.append('%preun') | 801 | spec_scriptlets_top.append('%preun') |
| 802 | spec_scriptlets_top.append('# %s - prerm' % srcname) | ||
| 773 | scriptvar = wrap_uninstall(srcprerm) | 803 | scriptvar = wrap_uninstall(srcprerm) |
| 774 | spec_scriptlets_top.append(scriptvar) | 804 | spec_scriptlets_top.append(scriptvar) |
| 775 | spec_scriptlets_top.append('') | 805 | spec_scriptlets_top.append('') |
| 776 | if srcpostrm: | 806 | if srcpostrm: |
| 777 | spec_scriptlets_top.append('%postun') | 807 | spec_scriptlets_top.append('%postun') |
| 808 | spec_scriptlets_top.append('# %s - postrm' % srcname) | ||
| 778 | scriptvar = wrap_uninstall(srcpostrm) | 809 | scriptvar = wrap_uninstall(srcpostrm) |
| 779 | spec_scriptlets_top.append(scriptvar) | 810 | spec_scriptlets_top.append(scriptvar) |
| 780 | spec_scriptlets_top.append('') | 811 | spec_scriptlets_top.append('') |
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass index 95e9455e5c..b3875a437c 100644 --- a/meta/classes/rootfs_rpm.bbclass +++ b/meta/classes/rootfs_rpm.bbclass | |||
| @@ -20,8 +20,6 @@ do_rootfs[depends] += "opkg-native:do_populate_sysroot" | |||
| 20 | 20 | ||
| 21 | do_rootfs[recrdeptask] += "do_package_write_rpm" | 21 | do_rootfs[recrdeptask] += "do_package_write_rpm" |
| 22 | 22 | ||
| 23 | AWKPOSTINSTSCRIPT = "${COREBASE}/scripts/rootfs_rpm-extract-postinst.awk" | ||
| 24 | |||
| 25 | RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf; " | 23 | RPM_PREPROCESS_COMMANDS = "package_update_index_rpm; package_generate_rpm_conf; " |
| 26 | RPM_POSTPROCESS_COMMANDS = "" | 24 | RPM_POSTPROCESS_COMMANDS = "" |
| 27 | 25 | ||
| @@ -108,19 +106,9 @@ EOF | |||
| 108 | 106 | ||
| 109 | ${ROOTFS_POSTINSTALL_COMMAND} | 107 | ${ROOTFS_POSTINSTALL_COMMAND} |
| 110 | 108 | ||
| 111 | mkdir -p ${IMAGE_ROOTFS}/etc/rpm-postinsts/ | 109 | # Report delayed package scriptlets |
| 112 | ${RPM} --root ${IMAGE_ROOTFS} -D '_dbpath ${rpmlibdir}' -qa \ | 110 | for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*; do |
| 113 | -D "__dbi_txn create nofsync private" \ | 111 | echo "Delayed package scriptlet: `head -n 3 $i | tail -n 1`" |
| 114 | --qf 'Name: %{NAME}\n%|POSTIN?{postinstall scriptlet%|POSTINPROG?{ (using %{POSTINPROG})}|:\n%{POSTIN}\n}:{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|' \ | ||
| 115 | > ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined | ||
| 116 | awk -f ${AWKPOSTINSTSCRIPT} < ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined | ||
| 117 | rm ${IMAGE_ROOTFS}/etc/rpm-postinsts/combined | ||
| 118 | |||
| 119 | for i in ${IMAGE_ROOTFS}/etc/rpm-postinsts/*.sh; do | ||
| 120 | if [ -f $i ] && sh $i; then | ||
| 121 | # rm $i | ||
| 122 | mv $i $i.done | ||
| 123 | fi | ||
| 124 | done | 112 | done |
| 125 | 113 | ||
| 126 | install -d ${IMAGE_ROOTFS}/${sysconfdir}/rcS.d | 114 | install -d ${IMAGE_ROOTFS}/${sysconfdir}/rcS.d |
| @@ -128,11 +116,10 @@ EOF | |||
| 128 | i=\$i | 116 | i=\$i |
| 129 | cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}configure << EOF | 117 | cat > ${IMAGE_ROOTFS}${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}configure << EOF |
| 130 | #!/bin/sh | 118 | #!/bin/sh |
| 131 | for i in /etc/rpm-postinsts/*.sh; do | 119 | for i in /etc/rpm-postinsts/*; do |
| 132 | echo "Running postinst $i..." | 120 | echo "Running postinst $i..." |
| 133 | if [ -f $i ] && sh $i; then | 121 | if [ -f $i ] && $i; then |
| 134 | # rm $i | 122 | rm $i |
| 135 | mv $i $i.done | ||
| 136 | else | 123 | else |
| 137 | echo "ERROR: postinst $i failed." | 124 | echo "ERROR: postinst $i failed." |
| 138 | fi | 125 | fi |
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch b/meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch new file mode 100644 index 0000000000..e4db0e4211 --- /dev/null +++ b/meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | Enable a cross-install scriptlet helper. | ||
| 2 | |||
| 3 | The helper is called from outside of the chroot with the arguments: | ||
| 4 | |||
| 5 | <root> <prog> <script> <arg1> [<arg2> ... <argN>] | ||
| 6 | |||
| 7 | The helper script is used by oe-core to facilitate shell script actions that | ||
| 8 | can not be run from within a chroot on a foreign target system during a | ||
| 9 | cross install. | ||
| 10 | |||
| 11 | Upstream-Status: Pending | ||
| 12 | |||
| 13 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
| 14 | |||
| 15 | diff -ur rpm-5.4.0.orig/lib/psm.c rpm-5.4.0/lib/psm.c | ||
| 16 | --- rpm-5.4.0.orig/lib/psm.c 2010-12-29 07:42:11.000000000 -0600 | ||
| 17 | +++ rpm-5.4.0/lib/psm.c 2011-11-08 13:38:48.132791154 -0600 | ||
| 18 | @@ -792,6 +792,10 @@ | ||
| 19 | int xx; | ||
| 20 | int i; | ||
| 21 | |||
| 22 | +#ifdef RPM_VENDOR_POKY | ||
| 23 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
| 24 | +#endif | ||
| 25 | + | ||
| 26 | if (psm->sstates != NULL && ix >= 0 && ix < RPMSCRIPT_MAX) | ||
| 27 | ssp = psm->sstates + ix; | ||
| 28 | if (ssp != NULL) | ||
| 29 | @@ -858,14 +862,29 @@ | ||
| 30 | (F_ISSET(psm, UNORDERED) ? "a" : "")); | ||
| 31 | |||
| 32 | if (Phe->p.argv == NULL) { | ||
| 33 | - argv = alloca(5 * sizeof(*argv)); | ||
| 34 | - argv[0] = "/bin/sh"; | ||
| 35 | - argc = 1; | ||
| 36 | + argv = alloca(7 * sizeof(*argv)); | ||
| 37 | + argc = 0; | ||
| 38 | + } else { | ||
| 39 | + argv = alloca((Phe->c + 6) * sizeof(*argv)); | ||
| 40 | + argc = 0; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | +#ifdef RPM_VENDOR_POKY | ||
| 44 | + if (scriptletWrapper && *scriptletWrapper) { | ||
| 45 | + argv[argc++] = scriptletWrapper; | ||
| 46 | + argv[argc] = rpmtsRootDir(ts); | ||
| 47 | + if (!argv[argc] || !*argv[argc]) | ||
| 48 | + argv[argc] = "/"; | ||
| 49 | + argc++; | ||
| 50 | + } | ||
| 51 | +#endif | ||
| 52 | + | ||
| 53 | + if (Phe->p.argv == NULL) { | ||
| 54 | + argv[argc++] = "/bin/sh"; | ||
| 55 | ldconfig_done = 0; | ||
| 56 | } else { | ||
| 57 | - argv = alloca((Phe->c + 4) * sizeof(*argv)); | ||
| 58 | - memcpy(argv, Phe->p.argv, Phe->c * sizeof(*argv)); | ||
| 59 | - argc = Phe->c; | ||
| 60 | + memcpy((argv + argc), Phe->p.argv, Phe->c * sizeof(*argv)); | ||
| 61 | + argc += Phe->c; | ||
| 62 | ldconfig_done = (ldconfig_path && !strcmp(argv[0], ldconfig_path) | ||
| 63 | ? 1 : 0); | ||
| 64 | } | ||
| 65 | @@ -916,7 +935,12 @@ | ||
| 66 | goto exit; | ||
| 67 | |||
| 68 | if (rpmIsDebug() && | ||
| 69 | - (!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash"))) | ||
| 70 | + (!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash")) | ||
| 71 | +#ifdef RPM_VENDOR_POKY | ||
| 72 | + || (scriptletWrapper && *scriptletWrapper && !strcmp(argv[1], "/bin/sh")) | ||
| 73 | + || (scriptletWrapper && *scriptletWrapper && !strcmp(argv[1], "/bin/bash")) | ||
| 74 | +#endif | ||
| 75 | + ) | ||
| 76 | { | ||
| 77 | static const char set_x[] = "set -x\n"; | ||
| 78 | nw = Fwrite(set_x, sizeof(set_x[0]), sizeof(set_x)-1, fd); | ||
| 79 | @@ -1051,12 +1075,22 @@ | ||
| 80 | |||
| 81 | { const char * rootDir = rpmtsRootDir(ts); | ||
| 82 | if (!rpmtsChrootDone(ts) && rootDir != NULL && | ||
| 83 | +#ifdef RPM_VENDOR_POKY | ||
| 84 | + !(scriptletWrapper && *scriptletWrapper) && | ||
| 85 | +#endif | ||
| 86 | !(rootDir[0] == '/' && rootDir[1] == '\0')) | ||
| 87 | { | ||
| 88 | /*@-modobserver@*/ | ||
| 89 | xx = Chroot(rootDir); | ||
| 90 | /*@=modobserver@*/ | ||
| 91 | } | ||
| 92 | +#ifdef RPM_VENDOR_POKY | ||
| 93 | + if (!rpmtsChrootDone(ts) && rootDir != NULL && | ||
| 94 | + (scriptletWrapper && *scriptletWrapper) && | ||
| 95 | + !(rootDir[0] == '/' && rootDir[1] == '\0')) | ||
| 96 | + xx = Chdir(rootDir); | ||
| 97 | + else | ||
| 98 | +#endif | ||
| 99 | xx = Chdir("/"); | ||
| 100 | rpmlog(RPMLOG_DEBUG, D_("%s: %s(%s)\texecv(%s) pid %d\n"), | ||
| 101 | psm->stepName, sln, NVRA, | ||
| 102 | @@ -2961,6 +2995,13 @@ | ||
| 103 | case PSM_SCRIPT: /* Run current package scriptlets. */ | ||
| 104 | /* XXX running %verifyscript/%sanitycheck doesn't have psm->te */ | ||
| 105 | { rpmtxn _parent = (psm && psm->te ? psm->te->txn : NULL); | ||
| 106 | + | ||
| 107 | +#ifdef RPM_VENDOR_POKY | ||
| 108 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
| 109 | + if (scriptletWrapper && *scriptletWrapper) | ||
| 110 | + rc = rpmpsmNext(psm, PSM_CHROOT_OUT); | ||
| 111 | +#endif | ||
| 112 | + | ||
| 113 | xx = rpmtxnBegin(rpmtsGetRdb(ts), _parent, NULL); | ||
| 114 | rc = runInstScript(psm); | ||
| 115 | if (rc) | ||
| 116 | @@ -2968,11 +3009,24 @@ | ||
| 117 | else | ||
| 118 | xx = rpmtxnCommit(rpmtsGetRdb(ts)->db_txn); | ||
| 119 | rpmtsGetRdb(ts)->db_txn = NULL; | ||
| 120 | +#ifdef RPM_VENDOR_POKY | ||
| 121 | + if (scriptletWrapper && *scriptletWrapper) | ||
| 122 | + rc = rpmpsmNext(psm, PSM_CHROOT_IN); | ||
| 123 | +#endif | ||
| 124 | } break; | ||
| 125 | case PSM_TRIGGERS: | ||
| 126 | /* Run triggers in other package(s) this package sets off. */ | ||
| 127 | if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break; | ||
| 128 | +#ifdef RPM_VENDOR_POKY | ||
| 129 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
| 130 | + if (scriptletWrapper && *scriptletWrapper) | ||
| 131 | + rc = rpmpsmNext(psm, PSM_CHROOT_OUT); | ||
| 132 | +#endif | ||
| 133 | rc = runTriggers(psm); | ||
| 134 | +#ifdef RPM_VENDOR_POKY | ||
| 135 | + if (scriptletWrapper && *scriptletWrapper) | ||
| 136 | + rc = rpmpsmNext(psm, PSM_CHROOT_IN); | ||
| 137 | +#endif | ||
| 138 | break; | ||
| 139 | case PSM_IMMED_TRIGGERS: | ||
| 140 | /* Run triggers in this package other package(s) set off. */ | ||
| 141 | @@ -2982,7 +3036,18 @@ | ||
| 142 | F_SET(psm, GOTTRIGGERS); | ||
| 143 | } | ||
| 144 | if (psm->triggers != NULL) | ||
| 145 | +#ifdef RPM_VENDOR_POKY | ||
| 146 | + { | ||
| 147 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
| 148 | + if (scriptletWrapper && *scriptletWrapper) | ||
| 149 | + rc = rpmpsmNext(psm, PSM_CHROOT_OUT); | ||
| 150 | +#endif | ||
| 151 | rc = runImmedTriggers(psm); | ||
| 152 | +#ifdef RPM_VENDOR_POKY | ||
| 153 | + if (scriptletWrapper && *scriptletWrapper) | ||
| 154 | + rc = rpmpsmNext(psm, PSM_CHROOT_IN); | ||
| 155 | + } | ||
| 156 | +#endif | ||
| 157 | break; | ||
| 158 | |||
| 159 | case PSM_RPMIO_FLAGS: | ||
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.0.bb b/meta/recipes-devtools/rpm/rpm_5.4.0.bb index bbef0be71e..f8fe836562 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.0.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.0.bb | |||
| @@ -45,7 +45,7 @@ LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1" | |||
| 45 | DEPENDS = "bzip2 zlib db openssl elfutils expat libpcre attr acl popt ${extrarpmdeps}" | 45 | DEPENDS = "bzip2 zlib db openssl elfutils expat libpcre attr acl popt ${extrarpmdeps}" |
| 46 | extrarpmdeps = "python perl" | 46 | extrarpmdeps = "python perl" |
| 47 | extrarpmdeps_virtclass-native = "file-native" | 47 | extrarpmdeps_virtclass-native = "file-native" |
| 48 | PR = "r22" | 48 | PR = "r23" |
| 49 | 49 | ||
| 50 | # rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed | 50 | # rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed |
| 51 | # in order to extract the distribution SRPM into a format we can extract... | 51 | # in order to extract the distribution SRPM into a format we can extract... |
| @@ -63,6 +63,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.0-0.20101229.src.rpm;ex | |||
| 63 | file://rpm-fileclass.patch \ | 63 | file://rpm-fileclass.patch \ |
| 64 | file://rpm-canonarch.patch \ | 64 | file://rpm-canonarch.patch \ |
| 65 | file://rpm-no-loopmsg.patch \ | 65 | file://rpm-no-loopmsg.patch \ |
| 66 | file://rpm-scriptletexechelper.patch \ | ||
| 66 | file://pythondeps.sh \ | 67 | file://pythondeps.sh \ |
| 67 | " | 68 | " |
| 68 | 69 | ||
