aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/freeze
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/freeze
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
downloadopenembedded-709c4d66e0b107ca606941b988bad717c0b45d9b.tar.gz
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/freeze')
-rw-r--r--recipes/freeze/files/freeze203
-rw-r--r--recipes/freeze/files/unfreeze65
-rw-r--r--recipes/freeze/freeze.bb53
-rw-r--r--recipes/freeze/unfreeze.bb41
4 files changed, 362 insertions, 0 deletions
diff --git a/recipes/freeze/files/freeze b/recipes/freeze/files/freeze
new file mode 100644
index 0000000000..b92c66054e
--- /dev/null
+++ b/recipes/freeze/files/freeze
@@ -0,0 +1,203 @@
+#!/bin/sh
+#
+# This script must be executed with the following environment variables
+# and arguments:
+#
+# export FROZEN_DIR=<place to write conf files>
+# export PKGDIR=<location of openembedded package source>
+# export DISTRO=<distro being frozen>
+# freeze {directories}
+#
+# where {directories} are one or more directories containing built
+# packages. If not given or empty FROZEN_DIR defaults to the directory
+# on BBPATH containing conf/local.conf. With no arguments $TMPDIR/work must
+# be the location of the built packages.
+#
+# The output of the script consists of two files:
+# $FROZEN_DIR/$DISTRO-bbfiles.conf
+# defines BBFILES to a list of all the .bb files required
+#
+# $FROZEN_DIR/$DISTRO-packages.conf
+# defines BBFILES to a list of the directories containing
+# those bb files.
+#
+# The output path definitions use ${PKGDIR} (literally)
+#
+# Check the arguments.
+test -n "$DISTRO" || {
+ echo "FATAL: freeze: set \$DISTRO to the name of the distro to freeze" >&2
+ exit 1
+}
+test -r "$PKGDIR/packages/freeze/freeze.bb" || {
+ echo "FATAL: freeze: set \$PKGDIR to the directory containing OE packages" >&2
+ exit 1
+}
+if test -n "$FROZEN_DIR" -a -d "$FROZEN_DIR"
+then
+ : # ok, given a directory
+else
+ if test -n "$BBPATH"
+ then
+ FROZEN_DIR=""
+ for d in ${BBPATH//:/ }
+ do
+ if test -r "$d/conf/local.conf" -o -r "$d/conf/auto.conf"
+ then
+ FROZEN_DIR="$d/conf"
+ break
+ elif test -z "$FROZEN_DIR" -a -d "$d"
+ then
+ # default to the first existing directory on
+ # the path
+ FROZEN_DIR="$d"
+ fi
+ done
+ fi
+ if test -n "$FROZEN_DIR"
+ then
+ echo "NOTE: freeze: \$FROZEN_DIR=\"$FROZEN_DIR\"" >&2
+ echo "NOTE: (defaulted from \$BBPATH=\"$BBPATH\")" >&2
+ else
+ echo "FATAL: freeze: set \$FROZEN_DIR to the directory for the new .conf files" >&2
+ exit 1
+ fi
+fi
+test -d "$1" || {
+ if test -d "$TMPDIR/work"
+ then
+ set "$TMPDIR/work"
+ else
+ echo "FATAL: freeze: give one or more directories containing built packages" >&2
+ exit 1
+ fi
+}
+#
+# First some helper functions
+#
+# output "$@" if there is exactly one argument (so this selectively
+# outputs a file name if the pattern matches exactly one file).
+output() {
+ if test $# -eq 1 -a -r "$1"
+ then
+ echo '${PKGDIR}/packages/'"$1 \\"
+ return 0
+ else
+ return 1
+ fi
+}
+#
+# Perform edit '$1' on '$2' and check to see if the result is a valid
+# file name. If '$1' is empty '$2' is checked with no edit
+check() {
+ local nf
+ if test -n "$1"
+ then
+ nf="$(echo "$2" | sed -n "$1")"
+ test -n "$nf" && output */$nf.bb
+ else
+ output */"$2.bb"
+ fi
+}
+#
+# Output a note - because bitbake swallows the stderr stream and redirects to the
+# log file, which never gets read, it is necessary to do something horrible here.
+bberror(){
+ echo "ERROR:" "$@" >/dev/tty
+}
+bbnote(){
+ echo "NOTE:" "$@" >/dev/tty
+}
+#
+# Say where the files go (this goes to the log file)
+bbnote "frozen bbfiles.conf --> $FROZEN_DIR/$DISTRO-bbfiles.conf" >&2
+bbnote "frozen packages.conf --> $FROZEN_DIR/$DISTRO-packages.conf" >&2
+#
+# List the built packages, for each one find the corresponding bb file
+# (from the packages directory).
+for d in "$@"
+do
+ (cd "$d"; ls) | while read x
+ do
+ echo "$x" "$d/$x"
+ done
+done | {
+ report=
+ while read d full
+ do
+ if test ! -d "$full"
+ then
+ bberror "$full: not a directory, ignored" >&2
+ elif echo "$d" | egrep '\-[^-][^-]*-[a-z][a-z]*[0-9][0-9.]*$'
+ then
+ :
+ else
+ bberror "$full: expected package-version-rev" >&2
+ if test -z "$report"
+ then
+ bberror " name not recognised as a package and so ignored" >&2
+ report="$d"
+ fi
+ fi
+ done
+ if test -n "$report"
+ then
+ bberror "$report: at least this directory was ignored" >&2
+ bberror " The output files may be wrong, some .bb files may be missing!" >&2
+ fi
+} | sed 's/^\(.*\)-\([^-]*\)-\([^-]*\)$/\1 \2 \3/' | {
+ # the check commands need to be executed from the packages directory so they
+ # can use shell wildcarding to match the bb files
+ cd "$PKGDIR/packages"
+ # This would be several orders of magnitude easier if portmap did not have
+ # the version '5-7' (etc). This is the only package with a '-' in the
+ # version number...
+ report=
+ while read p v r
+ do
+ # Each package/version must be found in $PKGDIR/packages, this search
+ # is a heuristic, note that there are never any '_' characters in the
+ # work directory name.
+ f="${p}_$v"
+ check '' "$f" ||
+ check 's/-/[-_]/gp' "$p-$v" ||
+ check 's/_1\.0$//p' "$f" ||
+ check 's/_\([0-9.]*\)cvs200[0-9]*$/_\1cvs/p' "$f" ||
+ check 's/_\([0-9.]*\)+cvs200[0-9]*$/_\1+cvs/p' "$f" ||
+ check 's/_0\.1cvs200[0-9]*$/_cvs/p' "$f" ||
+ check 's/_\([0-9.]*\)+cvs200[0-9]*$/_cvs/p' "$f" ||
+ check 's/_\([0-9.]*\)cvs200[0-9]*$/_cvs/p' "$f" ||
+ check 's/_0\.1cvs\(200[0-9]*\)$/_\1/p' "$f" ||
+ check 's/_\([0-9.]*\)+svn200[0-9]*$/_svn/p' "$f" || {
+ bberror "($p,$v,$r): package not found" >&2
+ if test -z "$report"
+ then
+ report="($p,$v,$r)"
+ bberror "at least one package has not been found" >&2
+ fi
+ }
+ done
+ # in all cases add freeze and unfreeze
+ echo '${PKGDIR}/packages/freeze/freeze.bb '"\\"
+ echo '${PKGDIR}/packages/freeze/unfreeze.bb '"\\"
+ # check for a problem
+ if test -n "$report"
+ then
+ bberror "At least $report was not found." >&2
+ bberror "This can be ignored if the .bb file has been removed, however if not" >&2
+ bberror "the frozen .conf output files are useless unless you fix them up" >&2
+ fi
+} | sort | uniq | {
+ # the simple bb file list (package/bbfile.bb)
+ out="$FROZEN_DIR/$DISTRO-bbfiles.conf"
+ echo '# automatically generated by bitbake freeze' >"$out"
+ echo 'BBFILES := "\' >>"$out"
+ tee -a "$out"
+ echo '"' >>"$out"
+} | sed 's!^\(.*\)/[^/]*\.bb \\$!\1/*.bb \\!' | uniq | {
+ # the package directories list (package)
+ out="$FROZEN_DIR/$DISTRO-packages.conf"
+ echo '# automatically generated by bitbake freeze' >"$out"
+ echo 'BBFILES := "\' >>"$out"
+ cat >>"$out"
+ echo '"' >>"$out"
+}
diff --git a/recipes/freeze/files/unfreeze b/recipes/freeze/files/unfreeze
new file mode 100644
index 0000000000..5be1459c3c
--- /dev/null
+++ b/recipes/freeze/files/unfreeze
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# This script must be executed with the following environment variables
+# and arguments:
+#
+# export FROZEN_DIR=<place to write conf files>
+# export DISTRO=<distro being frozen>
+# unfreeze
+#
+# If not given or empty FROZEN_DIR defaults to the directory on BBPATH containing
+# conf/local.conf.
+#
+# The output of the script consists of two files:
+# $FROZEN_DIR/$DISTRO-bbfiles.conf
+# empty
+#
+# $FROZEN_DIR/$DISTRO-packages.conf
+# empty
+#
+# Check the arguments.
+test -n "$DISTRO" || {
+ echo "FATAL: unfreeze: set \$DISTRO to the name of the distro to freeze" >&2
+ exit 1
+}
+if test -n "$FROZEN_DIR" -a -d "$FROZEN_DIR"
+then
+ : # ok, given a directory
+else
+ if test -n "$BBPATH"
+ then
+ FROZEN_DIR=""
+ for d in ${BBPATH//:/ }
+ do
+ if test -r "$d/conf/local.conf" -o -r "$d/conf/auto.conf"
+ then
+ FROZEN_DIR="$d/conf"
+ break
+ elif test -z "$FROZEN_DIR" -a -d "$d"
+ then
+ # default to the first existing directory on
+ # the path
+ FROZEN_DIR="$d"
+ fi
+ done
+ fi
+ if test -n "$FROZEN_DIR"
+ then
+ echo "NOTE: unfreeze: \$FROZEN_DIR=\"$FROZEN_DIR\"" >&2
+ echo "NOTE: (defaulted from \$BBPATH=\"$BBPATH\")" >&2
+ else
+ echo "FATAL: unfreeze: set \$FROZEN_DIR to the directory for the new .conf files" >&2
+ exit 1
+ fi
+fi
+#
+# do it
+#
+# the simple bb file list (package/bbfile.bb)
+out="$FROZEN_DIR/$DISTRO-bbfiles.conf"
+echo '# automatically generated by bitbake unfreeze' >"$out"
+#
+# the package directories list (package)
+out="$FROZEN_DIR/$DISTRO-packages.conf"
+echo '# automatically generated by bitbake unfreeze' >"$out"
+echo 'BBFILES := "${PKGDIR}/packages/*/*.bb"' >>"$out"
diff --git a/recipes/freeze/freeze.bb b/recipes/freeze/freeze.bb
new file mode 100644
index 0000000000..fa11fecb97
--- /dev/null
+++ b/recipes/freeze/freeze.bb
@@ -0,0 +1,53 @@
+# freeze finds all the bitbake files used by the stuff
+# currently built in ${TMPDIR}/work and writes those
+# files into frozen-bbfiles.conf, then it writes the
+# directories containing the files into frozen-packages.conf
+#
+# The two files define (just) the BBFILES variable.
+#
+# The path names in the BBFILES variable are of the form:
+#
+# ${PKGDIR}/packages/directory/bbfile.bb
+# ${PKGDIR}/packages/directory/*.bb
+#
+# as appropriate, directory is the sub-directory of 'packages'.
+#
+DESCRIPTION = "Freeze the bitbake files in the build"
+SECTION = "console/network"
+PRIORITY = "optional"
+LICENSE = "MIT"
+PR = "r1"
+
+INHIBIT_DEFAULT_DEPS = "1"
+PATCH_DEPENDS = ""
+ALLOW_EMPTY = "1"
+PACKAGES = ""
+
+SRC_URI = "file://freeze"
+
+do_configure() {
+}
+do_compile() {
+}
+do_install() {
+}
+do_stage() {
+}
+
+do_build[nostamp] = "1"
+do_build() {
+ # export FROZEN_DIR=<place to write conf files>
+ # export PKGDIR=<location of openembedded package source>
+ # export DISTRO=<distro being frozen>
+ # freeze {directories}
+ set -x
+ if test -d "${PKGDIR}/packages"
+ then
+ FROZEN_DIR="${FROZEN_DIR}" PKGDIR="${PKGDIR}" DISTRO="${DISTRO}" \
+ sh "${WORKDIR}/freeze" "${TMPDIR}/work"
+ else
+ oenote "\$PKGDIR/packages ($PKGDIR/packages) not found"
+ oefatal "\$PKGDIR must be defined for freeze to work"
+ fi
+ set +x
+}
diff --git a/recipes/freeze/unfreeze.bb b/recipes/freeze/unfreeze.bb
new file mode 100644
index 0000000000..f2232c304f
--- /dev/null
+++ b/recipes/freeze/unfreeze.bb
@@ -0,0 +1,41 @@
+# unfreeze undoes the work of freeze by making the frozen
+# configuration fails empty (they just contain a comment).
+#
+DESCRIPTION = "Unfreeze the bitbake files in the build"
+SECTION = "console/network"
+PRIORITY = "optional"
+LICENSE = "MIT"
+PR = "r1"
+
+INHIBIT_DEFAULT_DEPS = "1"
+PATCH_DEPENDS = ""
+ALLOW_EMPTY = "1"
+PACKAGES = ""
+
+SRC_URI = "file://unfreeze"
+
+do_configure() {
+}
+do_compile() {
+}
+do_install() {
+}
+do_stage() {
+}
+
+do_build[nostamp] = "1"
+do_build() {
+ # export FROZEN_DIR=<place to write conf files>
+ # export PKGDIR=<location of openembedded package source>
+ # unfreeze
+ set -x
+ # this is a sanity check:
+ if test -d "${PKGDIR}/packages"
+ then
+ FROZEN_DIR="${FROZEN_DIR}" DISTRO="${DISTRO}" sh "${WORKDIR}/unfreeze"
+ else
+ oenote "\$PKGDIR/packages ($PKGDIR/packages) not found"
+ oefatal "\$PKGDIR must be defined for freeze/unfreeze to work"
+ fi
+ set +x
+}