Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] rootfs_rpm: Add Multilib prefix to installed_packages list
@ 2012-09-18 19:19 Saul Wold
  2012-09-19 15:29 ` Saul Wold
  0 siblings, 1 reply; 3+ messages in thread
From: Saul Wold @ 2012-09-18 19:19 UTC (permalink / raw)
  To: openembedded-core

RPM does not name it's packages with the Multilib prefix,
but the rootfs_rpm class keeps track of the Multilib prefixs
in a list. Use that list to re-attach the prefix for use with
the license bbclass, buildhistory bbclass will also use this
and make it more accurate between multilib and non-multilib.
Use the embedded "Platform" information to ensure we get all
the correct matching.

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/classes/rootfs_rpm.bbclass |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index c0207d8..a93b3ec 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -142,12 +142,27 @@ RPM_QUERY_CMD = '${RPM} --root $INSTALL_ROOTFS_RPM -D "_dbpath ${rpmlibdir}" \
 
 list_installed_packages() {
 	if [ "$1" = "arch" ] ; then
-		${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]"
-	elif [ "$1" = "file" ] ; then
-		${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{PACKAGEORIGIN}\n]"
+		GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{Platform}\n]")
+        elif [ "$1" = "file" ] ; then
+		GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{PACKAGEORIGIN} %{Platform}\n]")
+        else
+		GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{Platform}\n]")
+	fi
+	if [ "x${MULTILIB_PREFIX_LIST}" = "x" ] ; then
+		echo "$GET_LIST"
 	else
-		${RPM_QUERY_CMD} -qa --qf "[%{NAME}\n]"
+		for prefix in `echo ${MULTILIB_PREFIX_LIST}`; do
+			# Use awk to find the multilib prefix and then
+			# print the info, need to different return counts
+			if [ "x$1" = "x" ] ; then
+				echo "$GET_LIST" | awk -v prefix="$prefix" '$0 ~ prefix {printf("%s-%s\n", prefix, $1); } $0 !~ prefix {print $1}'
+			else
+				echo "$GET_LIST" | awk -v prefix="$prefix" '$0 ~ prefix {printf("%s-%s %s\n", prefix, $1, $2); } $0 !~ prefix {print $1, $2}'
+			fi
+		done
 	fi
+
+
 }
 
 rootfs_list_installed_depends() {
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] rootfs_rpm: Add Multilib prefix to installed_packages list
@ 2012-09-19 16:41 Saul Wold
  0 siblings, 0 replies; 3+ messages in thread
From: Saul Wold @ 2012-09-19 16:41 UTC (permalink / raw)
  To: openembedded-core

RPM does not name it's packages with the Multilib prefix,
but the rootfs_rpm class keeps track of the Multilib prefixs
in a list. Use that list to re-attach the prefix for use with
the license bbclass, buildhistory bbclass will also use this
and make it more accurate between multilib and non-multilib.
Use the embedded "Platform" information to ensure we get all
the correct matching.

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/classes/rootfs_rpm.bbclass |   48 +++++++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 5 deletions(-)

diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass
index c0207d8..3ea5eb2 100644
--- a/meta/classes/rootfs_rpm.bbclass
+++ b/meta/classes/rootfs_rpm.bbclass
@@ -140,13 +140,51 @@ remove_packaging_data_files() {
 RPM_QUERY_CMD = '${RPM} --root $INSTALL_ROOTFS_RPM -D "_dbpath ${rpmlibdir}" \
 		-D "__dbi_txn create nofsync private"'
 
-list_installed_packages() {
+Old_list_installed_packages() {
 	if [ "$1" = "arch" ] ; then
-		${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH}\n]"
-	elif [ "$1" = "file" ] ; then
-		${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{PACKAGEORIGIN}\n]"
+		GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{Platform}\n]")
+        elif [ "$1" = "file" ] ; then
+		GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{PACKAGEORIGIN} %{Platform}\n]")
+        else
+		GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{Platform}\n]")
+	fi
+	# Use awk to find the multilib prefix and then
+	# print the info, need to different return counts
+	if [ "x${MULTILIB_PREFIX_LIST}" = "x" ] ; then
+		if [ "x$1" = "x" ] ; then
+			echo "$GET_LIST" | awk '{print $1}' 
+		else
+			echo "$GET_LIST" | awk '{print $1 $2}'
+		fi
 	else
-		${RPM_QUERY_CMD} -qa --qf "[%{NAME}\n]"
+		for prefix in `echo ${MULTILIB_PREFIX_LIST}`; do
+			if [ "x$1" = "x" ] ; then
+				echo "$GET_LIST" | awk -v prefix="$prefix" '$0 ~ prefix {printf("%s-%s\n", prefix, $1); } $0 !~ prefix {print $1}'
+			else
+				echo "$GET_LIST" | awk -v prefix="$prefix" '$0 ~ prefix {printf("%s-%s %s\n", prefix, $1, $2); } $0 !~ prefix {print $1, $2}'
+			fi
+		done
+	fi
+
+
+}
+
+list_installed_packages() {
+	GET_LIST=$(${RPM_QUERY_CMD} -qa --qf "[%{NAME} %{ARCH} %{PACKAGEORIGIN} %{Platform}\n]")
+
+	# Use awk to find the multilib prefix and compare it
+	# with the platform RPM thinks it is part of
+	for prefix in `echo ${MULTILIB_PREFIX_LIST}`; do
+		GET_LIST=$(echo "$GET_LIST" | awk -v prefix="$prefix" '$0 ~ prefix {printf("%s-%s\n", prefix, $0); } $0 !~ prefix {print $0}')
+	done
+
+	# print the info, need to different return counts
+	if [ "$1" = "arch" ] ; then
+		echo "$GET_LIST" | awk '{print $1, $2}'
+        elif [ "$1" = "file" ] ; then
+		echo "$GET_LIST" | awk '{print $1, $3}'
+        else
+		echo "$GET_LIST" | awk '{print $1}' 
 	fi
 }
 
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-19 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-18 19:19 [PATCH] rootfs_rpm: Add Multilib prefix to installed_packages list Saul Wold
2012-09-19 15:29 ` Saul Wold
  -- strict thread matches above, loose matches on Subject: below --
2012-09-19 16:41 Saul Wold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox