package_deb.bbclass: create a proper package_update_index_deb task.
authorFilip Zyzniewski <filip.zyzniewski@gmail.com>
Thu, 24 Feb 2011 04:42:28 +0000 (04:42 +0000)
committerTom Rini <tom_rini@mentor.com>
Wed, 23 Feb 2011 21:26:17 +0000 (14:26 -0700)
Until now the Packages.gz generation was hardcoded in rootfs_deb_do_rootfs.

(Tom Rini: While in here, trailing whitespace cleanup)

Signed-off-by: Filip Zyzniewski <filip.zyzniewski@gmail.com>
Signed-off-by: Tom Rini <tom_rini@mentor.com>
classes/package_deb.bbclass
classes/rootfs_deb.bbclass

index f94771c..d1e7f73 100644 (file)
@@ -9,7 +9,7 @@ DISTRO_EXTRA_RDEPENDS += "apt"
 IMAGE_PKGTYPE ?= "deb"
 
 # Map TARGET_ARCH to Debian's ideas about architectures
-DPKG_ARCH ?= "${TARGET_ARCH}" 
+DPKG_ARCH ?= "${TARGET_ARCH}"
 DPKG_ARCH_x86 ?= "i386"
 DPKG_ARCH_i486 ?= "i386"
 DPKG_ARCH_i586 ?= "i386"
@@ -276,3 +276,31 @@ python do_package_write_deb () {
 do_package_write_deb[dirs] = "${D}"
 addtask package_write_deb before do_package_write after do_package
 
+do_package_update_index_deb[lockfiles] = "${DEPLOY_DIR_DEB}.lock"
+do_package_update_index_deb[nostamp] = "1"
+do_package_update_index_deb[recrdeptask] += "do_package_write_deb"
+do_package_update_index_deb[depends] += "dpkg-native:do_populate_sysroot"
+
+do_package_update_index_deb () {
+       set -x
+
+       if [ ! -z "${DEPLOY_KEEP_PACKAGES}" ]; then
+               return
+       fi
+
+       cd "${DEPLOY_DIR_DEB}"
+       for arch in ${PACKAGE_ARCHS}; do
+               if [ -e "$arch" ] ; then
+                       dpkg-scanpackages "$arch" | gzip > "$arch/Packages.gz"
+               fi
+               if [ -e "${BUILD_ARCH}-$arch-sdk" ] ; then
+                       dpkg-scanpackages "${BUILD_ARCH}-$arch-sdk" | gzip > "${BUILD_ARCH}-$arch-sdk/Packages.gz"
+               fi
+               if [ -e "${SDK_SYS}-sdk-$arch" ] ; then
+                       dpkg-scanpackages "${SDK_SYS}-sdk-$arch" | gzip > "${SDK_SYS}-sdk-$arch/Packages.gz"
+               fi
+       done
+       cd -
+}
+
+addtask package_update_index_deb before do_rootfs
index 2130ad6..bfa361c 100644 (file)
@@ -24,11 +24,6 @@ fakeroot rootfs_deb_do_rootfs () {
                        continue;
                fi
                cd ${DEPLOY_DIR_DEB}/$arch
-               rm -f Packages.gz Packages Packages.bz2
-
-               # apt-native ignores Packages.bz2 unless /bin/bzip2 exists
-               # on the build host, so stick with gzip
-               dpkg-scanpackages . | gzip > Packages.gz
 
                echo "Label: $arch" > Release
 
@@ -44,7 +39,7 @@ fakeroot rootfs_deb_do_rootfs () {
 
        cat "${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample" \
                | sed -e 's#Architecture ".*";#Architecture "${DPKG_ARCH}";#' \
-               | sed -e 's#status ".*";#status "${IMAGE_ROOTFS}/var/lib/dpkg/status";#' \ 
+               | sed -e 's#status ".*";#status "${IMAGE_ROOTFS}/var/lib/dpkg/status";#' \
                | sed -e 's#DPkg::Options {".*"};#DPkg::Options {"--root=${IMAGE_ROOTFS}";"--admindir=${IMAGE_ROOTFS}/var/lib/dpkg";"--force-all";"--no-debsig"};#' \
                > "${STAGING_ETCDIR_NATIVE}/apt/apt-rootfs.conf"
 
@@ -134,7 +129,7 @@ fakeroot rootfs_deb_do_rootfs () {
 
        ${ROOTFS_POSTPROCESS_COMMAND}
 
-       log_check rootfs 
+       log_check rootfs
 }
 
 rootfs_deb_log_check() {
@@ -143,7 +138,7 @@ rootfs_deb_log_check() {
 
        lf_txt="`cat $lf_path`"
        for keyword_die in "E:"
-       do                              
+       do
                if (echo "$lf_txt" | grep -v log_check | grep "$keyword_die") >/dev/null 2>&1
                then
                        echo "log_check: There were error messages in the logfile"
@@ -153,7 +148,7 @@ rootfs_deb_log_check() {
                        do_exit=1
                fi
        done
-       test "$do_exit" = 1 && exit 1                                           
+       test "$do_exit" = 1 && exit 1
        true
 }