blob: 0e84ca9ee5a09c0768df9ccf44fa5621b54f6d68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 oe-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
|