Patchwork [1/1] classes/rootfs_deb: implement query functions for buildhistory

login
register
mail settings
Submitter Paul Eggleton
Date Dec. 9, 2011, 5:34 p.m.
Message ID <2d2d1743ef68945a58a377e5787b955b3e0e1a84.1323451977.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/16577/
State Accepted
Commit 58fbb430040c9cce9f2c5f1515a4453dd49032cc
Headers show

Comments

Paul Eggleton - Dec. 9, 2011, 5:34 p.m.
Implement the functions required for buildhistory to be able to query
installed packages, get dependencies etc. for deb-based images.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/rootfs_deb.bbclass |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
Richard Purdie - Dec. 10, 2011, 12:15 a.m.
On Fri, 2011-12-09 at 17:34 +0000, Paul Eggleton wrote:
> Implement the functions required for buildhistory to be able to query
> installed packages, get dependencies etc. for deb-based images.
> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>

Merged to master, thanks.

Richard

Patch

diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass
index bab8e1e..bef055c 100644
--- a/meta/classes/rootfs_deb.bbclass
+++ b/meta/classes/rootfs_deb.bbclass
@@ -81,3 +81,26 @@  remove_packaging_data_files() {
 	rm -rf ${IMAGE_ROOTFS}${opkglibdir}
 	rm -rf ${IMAGE_ROOTFS}/usr/dpkg/
 }
+
+DPKG_QUERY_COMMAND = "${STAGING_BINDIR_NATIVE}/dpkg --admindir=${IMAGE_ROOTFS}/var/lib/dpkg"
+
+list_installed_packages() {
+	${DPKG_QUERY_COMMAND} -l | grep ^ii | awk '{ print $2 }'
+}
+
+get_package_filename() {
+	fullname=`find ${DEPLOY_DIR_DEB} -name "$1_*.deb" || true`
+	if [ "$fullname" = "" ] ; then
+		echo $name
+	else
+		echo $fullname
+	fi
+}
+
+list_package_depends() {
+	${DPKG_QUERY_COMMAND} -s $1 | grep ^Depends | sed -e 's/^Depends: //' -e 's/,//g' -e 's:([=<>]* [0-9a-zA-Z.~\-]*)::g'
+}
+
+list_package_recommends() {
+	${DPKG_QUERY_COMMAND} -s $1 | grep ^Recommends | sed -e 's/^Recommends: //' -e 's/,//g' -e 's:([=<>]* [0-9a-zA-Z.~\-]*)::g'
+}