diff options
| -rw-r--r-- | meta/classes/rootfs_rpm.bbclass | 5 | ||||
| -rwxr-xr-x | scripts/poky-setup-rpmrepo | 89 |
2 files changed, 94 insertions, 0 deletions
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass index 93223abaef..0cea3945ad 100644 --- a/meta/classes/rootfs_rpm.bbclass +++ b/meta/classes/rootfs_rpm.bbclass | |||
| @@ -11,6 +11,9 @@ do_rootfs[depends] += "rpm-native:do_populate_sysroot" | |||
| 11 | # Needed for update-alternatives | 11 | # Needed for update-alternatives |
| 12 | do_rootfs[depends] += "opkg-native:do_populate_sysroot" | 12 | do_rootfs[depends] += "opkg-native:do_populate_sysroot" |
| 13 | 13 | ||
| 14 | # Creating the repo info in do_rootfs | ||
| 15 | do_rootfs[depends] += "createrepo-native:do_populate_sysroot" | ||
| 16 | |||
| 14 | do_rootfs[recrdeptask] += "do_package_write_rpm" | 17 | do_rootfs[recrdeptask] += "do_package_write_rpm" |
| 15 | 18 | ||
| 16 | AWKPOSTINSTSCRIPT = "${POKYBASE}/scripts/rootfs_rpm-extract-postinst.awk" | 19 | AWKPOSTINSTSCRIPT = "${POKYBASE}/scripts/rootfs_rpm-extract-postinst.awk" |
| @@ -38,6 +41,8 @@ fakeroot rootfs_rpm_do_rootfs () { | |||
| 38 | 41 | ||
| 39 | ${RPM_PREPROCESS_COMMANDS} | 42 | ${RPM_PREPROCESS_COMMANDS} |
| 40 | 43 | ||
| 44 | createrepo "${DEPLOY_DIR_RPM}" | ||
| 45 | |||
| 41 | # Setup base system configuration | 46 | # Setup base system configuration |
| 42 | mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ | 47 | mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ |
| 43 | 48 | ||
diff --git a/scripts/poky-setup-rpmrepo b/scripts/poky-setup-rpmrepo new file mode 100755 index 0000000000..42a9b6aedf --- /dev/null +++ b/scripts/poky-setup-rpmrepo | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # This utility setup the necessary metadata for an rpm repo | ||
| 4 | # | ||
| 5 | # Copyright (c) 2011 Intel Corp. | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify | ||
| 8 | # it under the terms of the GNU General Public License version 2 as | ||
| 9 | # published by the Free Software Foundation. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, | ||
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 14 | # See the GNU General Public License for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License | ||
| 17 | # along with this program; if not, write to the Free Software | ||
| 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 19 | |||
| 20 | function usage() { | ||
| 21 | echo "Usage: $0 <rpm-dir>" | ||
| 22 | echo " <rpm-dir>: default is $TPMDIR/deploy/rpm" | ||
| 23 | } | ||
| 24 | |||
| 25 | if [ $# -gt 1 ]; then | ||
| 26 | usage | ||
| 27 | exit 1 | ||
| 28 | fi | ||
| 29 | |||
| 30 | setup_tmpdir() { | ||
| 31 | if [ -z "$TMPDIR" ]; then | ||
| 32 | if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then | ||
| 33 | # BUILDDIR unset, try and get TMPDIR from bitbake | ||
| 34 | type -P bitbake &>/dev/null || { | ||
| 35 | echo "In order for this script to dynamically infer paths"; | ||
| 36 | echo "to kernels or filesystem images, you either need"; | ||
| 37 | echo "bitbake in your PATH or to source poky-init-build-env"; | ||
| 38 | echo "before running this script" >&2; | ||
| 39 | exit 1; } | ||
| 40 | |||
| 41 | # We have bitbake in PATH, get TMPDIR from bitbake | ||
| 42 | TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` | ||
| 43 | else | ||
| 44 | TMPDIR=$BUILDDIR/tmp | ||
| 45 | fi | ||
| 46 | fi | ||
| 47 | } | ||
| 48 | |||
| 49 | setup_sysroot() { | ||
| 50 | # Toolchain installs set up $POKY_NATIVE_SYSROOT in their | ||
| 51 | # environment script. If that variable isn't set, we're | ||
| 52 | # either in an in-tree poky scenario or the environment | ||
| 53 | # script wasn't source'd. | ||
| 54 | if [ -z "$POKY_NATIVE_SYSROOT" ]; then | ||
| 55 | setup_tmpdir | ||
| 56 | BUILD_ARCH=`uname -m` | ||
| 57 | BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` | ||
| 58 | BUILD_SYS="$BUILD_ARCH-$BUILD_OS" | ||
| 59 | |||
| 60 | POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS | ||
| 61 | fi | ||
| 62 | } | ||
| 63 | |||
| 64 | setup_tmpdir | ||
| 65 | setup_sysroot | ||
| 66 | |||
| 67 | |||
| 68 | if [ -n "$1" ]; then | ||
| 69 | RPM_DIR="$1" | ||
| 70 | else | ||
| 71 | RPM_DIR="$TMPDIR/deploy/rpm" | ||
| 72 | fi | ||
| 73 | |||
| 74 | if [ ! -d "$RPM_DIR" ]; then | ||
| 75 | echo "Error: rpm dir $RPM_DIR doesn't exist" | ||
| 76 | exit 1 | ||
| 77 | fi | ||
| 78 | |||
| 79 | CREATEREPO=$POKY_NATIVE_SYSROOT/usr/bin/createrepo | ||
| 80 | if [ ! -e "$CREATEREPO" ]; then | ||
| 81 | echo "Error: can't find createrepo binary" | ||
| 82 | echo "please run bitbake createrepo-native first" | ||
| 83 | exit 1 | ||
| 84 | fi | ||
| 85 | |||
| 86 | |||
| 87 | $CREATEREPO "$RPM_DIR" | ||
| 88 | |||
| 89 | exit 0 | ||
