cornucopia: bump SRCREV
[openembedded.git] / contrib / gstreamer / generate-packages-dynamic-list.sh
blob932aca4c29b9e2f69ac10b1db78e59282187eb2e
1 #!/bin/sh
3 # PATH to tmpdir
4 TMPDIR=tmp
6 if [ $# -lt 1 ] ; then
7 echo "Usage: $0 path/to/recipe.bb"
8 exit 1
9 fi
11 if [ $# -eq 2 ] ; then
12 TMPDIR=$2
15 if [ ! -d ${TMPDIR} ] ; then
16 echo "TMPDIR '${TMPDIR}' does not exist, update TMPDIR in script or use 2nd parameter"
17 exit 2
20 RECIPE=$1
22 if grep PACKAGES_DYNAMIC ${RECIPE} >/dev/null; then
23 echo "${RECIPE} already has PACKAGES_DYNAMIC defined, please remove it first"
24 exit 3
27 # force old behavior spliting all
28 echo 'PACKAGES_DYNAMIC = "gst-plugin-*"' >> ${RECIPE}
30 echo "Cleaning ${RECIPE}"
31 # don't know better way to get right WORKDIR from shell, we need to clean it anyways
32 WORKDIR=`bitbake -c clean -v -b ${RECIPE} | grep "NOTE: removing work" | sed 's/NOTE: removing //g'`
34 TMPDIR_PKGS=${TMPDIR}/${WORKDIR}/packages-split/
35 echo "Packages are expected in ${TMPDIR_PKGS}"
37 echo "Building ${RECIPE}"
38 # -c build because some people use rm_work
39 bitbake -c build -b ${RECIPE}
41 if [ $? -ne 0 ] ; then
42 echo "${RECIPE} build failed, fix build first"
43 sed -i '/^PACKAGES_DYNAMIC = "gst-plugin-\*"$/d' ${RECIPE}
44 exit 4
48 if ls -1d ${TMPDIR_PKGS}/gst-plugin-*-dev | grep gst-plugin-.*-dev >/dev/null; then
49 # replace temporary PACKAGES_DYNAMIC spliting all with list of created packages
50 sed -i '/^PACKAGES_DYNAMIC = "gst-plugin-\*"$/d' ${RECIPE}
51 echo '' >> ${RECIPE}
52 echo 'PACKAGES_DYNAMIC = "\' >> ${RECIPE}
53 ls -1d ${TMPDIR_PKGS}/gst-plugin-*-dev | grep gst-plugin-.*-dev| sed "s#${TMPDIR_PKGS}/\(.*\)-dev#\1* \\\#g" >> ${RECIPE}
54 echo '"' >> ${RECIPE}
55 echo "${RECIPE} PACKAGES_DYNAMIC were hopefully updated"
56 else
57 echo "No directories found ${TMPDIR_PKGS}/gst-plugin-*-dev"
58 exit 5