diff options
author | Qing He <qing.he@intel.com> | 2011-01-18 18:00:29 +0800 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2011-01-30 12:09:52 -0800 |
commit | e67698743eb6fea77f03d712be5d838fbc887f16 (patch) | |
tree | e53c9dfcc1b0703ec651e0bb6aa4986a594ef999 | |
parent | f6fc1f3475e389551af440608159baeea786ba6d (diff) | |
download | openembedded-core-e67698743eb6fea77f03d712be5d838fbc887f16.tar.gz openembedded-core-e67698743eb6fea77f03d712be5d838fbc887f16.tar.bz2 openembedded-core-e67698743eb6fea77f03d712be5d838fbc887f16.tar.xz openembedded-core-e67698743eb6fea77f03d712be5d838fbc887f16.zip |
creating the rpmrepo metadata
This includes two method for build rpm repo:
1. create the metadata in rootfs_rpm
2. standalone binary for building the metadata
Not both of them are needed, generally #2 fits more for the purpose,
but #1 may have its use on rootfs creation using zypper.
Both share some problems and are subjected for future improvement:
1. the createrepo now builds metadata for the whole directory,
if there are more than one arch, it builds for all, which means
rootfs_rpm may run longer if more builds have been run.
2. createrepo builds metadata for stale rpms
Signed-off-by: Qing He <qing.he@intel.com>
-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 93223abae..0cea3945a 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" # Needed for update-alternatives do_rootfs[depends] += "opkg-native:do_populate_sysroot" +# Creating the repo info in do_rootfs +do_rootfs[depends] += "createrepo-native:do_populate_sysroot" + do_rootfs[recrdeptask] += "do_package_write_rpm" AWKPOSTINSTSCRIPT = "${POKYBASE}/scripts/rootfs_rpm-extract-postinst.awk" @@ -38,6 +41,8 @@ fakeroot rootfs_rpm_do_rootfs () { ${RPM_PREPROCESS_COMMANDS} + createrepo "${DEPLOY_DIR_RPM}" + # Setup base system configuration mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ diff --git a/scripts/poky-setup-rpmrepo b/scripts/poky-setup-rpmrepo new file mode 100755 index 000000000..42a9b6aed --- /dev/null +++ b/scripts/poky-setup-rpmrepo @@ -0,0 +1,89 @@ +#!/bin/bash +# +# This utility setup the necessary metadata for an rpm repo +# +# Copyright (c) 2011 Intel Corp. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +function usage() { + echo "Usage: $0 <rpm-dir>" + echo " <rpm-dir>: default is $TPMDIR/deploy/rpm" +} + +if [ $# -gt 1 ]; then + usage + exit 1 +fi + +setup_tmpdir() { + if [ -z "$TMPDIR" ]; then + if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then + # BUILDDIR unset, try and get TMPDIR from bitbake + type -P bitbake &>/dev/null || { + echo "In order for this script to dynamically infer paths"; + echo "to kernels or filesystem images, you either need"; + echo "bitbake in your PATH or to source poky-init-build-env"; + echo "before running this script" >&2; + exit 1; } + + # We have bitbake in PATH, get TMPDIR from bitbake + TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` + else + TMPDIR=$BUILDDIR/tmp + fi + fi +} + +setup_sysroot() { + # Toolchain installs set up $POKY_NATIVE_SYSROOT in their + # environment script. If that variable isn't set, we're + # either in an in-tree poky scenario or the environment + # script wasn't source'd. + if [ -z "$POKY_NATIVE_SYSROOT" ]; then + setup_tmpdir + BUILD_ARCH=`uname -m` + BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` + BUILD_SYS="$BUILD_ARCH-$BUILD_OS" + + POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS + fi +} + +setup_tmpdir +setup_sysroot + + +if [ -n "$1" ]; then + RPM_DIR="$1" +else + RPM_DIR="$TMPDIR/deploy/rpm" +fi + +if [ ! -d "$RPM_DIR" ]; then + echo "Error: rpm dir $RPM_DIR doesn't exist" + exit 1 +fi + +CREATEREPO=$POKY_NATIVE_SYSROOT/usr/bin/createrepo +if [ ! -e "$CREATEREPO" ]; then + echo "Error: can't find createrepo binary" + echo "please run bitbake createrepo-native first" + exit 1 +fi + + +$CREATEREPO "$RPM_DIR" + +exit 0 |