diff options
| author | Lianhao Lu <lianhao.lu@intel.com> | 2011-01-30 14:07:50 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-01 23:59:37 +0000 |
| commit | 382075a9c2a5877d198a217161558da6ad2d5f89 (patch) | |
| tree | 33b53b274eb1c921721f71cf87904e24851c7627 /meta/classes | |
| parent | b94f9ccd05a339a5e3e8ec4c7bd8c727ca575871 (diff) | |
| download | poky-382075a9c2a5877d198a217161558da6ad2d5f89.tar.gz | |
rootfs_rpm/package_rpm.bbclass: Move func from rootfs_rpm to package_rpm
package_deb.bbclass:
1. Modified package_update_index_rpm() and package_generate_rpm_conf()
to generate sperate depsolver db and rpm configuration, for target
packages and host packages respectively.
2. Added new function package_install_internal_rpm() to install a list
deb packages to a specified root directory, with the specified package
architecutre information.
3. Added new function resolve_package_rpm() to resolve package names to
filepaths.
rootfs_deb.bbclass:
Used the above new functions to install the rootfs.
[sgw: merged changes for createrepo]
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/package_rpm.bbclass | 230 | ||||
| -rw-r--r-- | meta/classes/rootfs_rpm.bbclass | 145 |
2 files changed, 234 insertions, 141 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 8891f06ffa..cc262dc831 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
| @@ -15,6 +15,8 @@ python package_rpm_install () { | |||
| 15 | bb.fatal("package_rpm_install not implemented!") | 15 | bb.fatal("package_rpm_install not implemented!") |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | RPMCONF_TARGET_BASE = "${DEPLOY_DIR_RPM}/solvedb" | ||
| 19 | RPMCONF_HOST_BASE = "${DEPLOY_DIR_RPM}/solvedb-sdk" | ||
| 18 | # | 20 | # |
| 19 | # Update the Packages depsolver db in ${DEPLOY_DIR_RPM} | 21 | # Update the Packages depsolver db in ${DEPLOY_DIR_RPM} |
| 20 | # | 22 | # |
| @@ -26,15 +28,18 @@ package_update_index_rpm () { | |||
| 26 | fi | 28 | fi |
| 27 | 29 | ||
| 28 | packagedirs="" | 30 | packagedirs="" |
| 31 | packagedirs_sdk="" | ||
| 29 | for arch in $rpmarchs ; do | 32 | for arch in $rpmarchs ; do |
| 30 | sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'` | 33 | sdkarch=`echo $arch | sed -e 's/${HOST_ARCH}/${SDK_ARCH}/'` |
| 34 | extension="-nativesdk" | ||
| 35 | if [ "$sdkarch" = "all" -o "$sdkarch" = "any" -o "$sdkarch" = "noarch" ]; then | ||
| 36 | extension="" | ||
| 37 | fi | ||
| 31 | packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/$arch" | 38 | packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/$arch" |
| 32 | #packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/$sdkarch-nativesdk" | 39 | packagedirs_sdk="$packagedirs_sdk ${DEPLOY_DIR_RPM}/$sdkarch$extension" |
| 33 | done | 40 | done |
| 34 | 41 | ||
| 35 | #packagedirs="$packagedirs ${DEPLOY_DIR_RPM}/${SDK_ARCH}-${TARGET_ARCH}-canadian" | 42 | cat /dev/null > ${RPMCONF_TARGET_BASE}.conf |
| 36 | |||
| 37 | cat /dev/null > ${DEPLOY_DIR_RPM}/solvedb.conf | ||
| 38 | for pkgdir in $packagedirs; do | 43 | for pkgdir in $packagedirs; do |
| 39 | if [ -e $pkgdir/ ]; then | 44 | if [ -e $pkgdir/ ]; then |
| 40 | echo "Generating solve db for $pkgdir..." | 45 | echo "Generating solve db for $pkgdir..." |
| @@ -48,7 +53,25 @@ package_update_index_rpm () { | |||
| 48 | --ignoresize --nosignature --nodigest \ | 53 | --ignoresize --nosignature --nodigest \ |
| 49 | -D "__dbi_txn create nofsync" \ | 54 | -D "__dbi_txn create nofsync" \ |
| 50 | $pkgdir/solvedb/manifest | 55 | $pkgdir/solvedb/manifest |
| 51 | echo $pkgdir/solvedb >> ${DEPLOY_DIR_RPM}/solvedb.conf | 56 | echo $pkgdir/solvedb >> ${RPMCONF_TARGET_BASE}.conf |
| 57 | fi | ||
| 58 | done | ||
| 59 | |||
| 60 | cat /dev/null > ${RPMCONF_HOST_BASE}.conf | ||
| 61 | for pkgdir in $packagedirs_sdk; do | ||
| 62 | if [ -e $pkgdir/ ]; then | ||
| 63 | echo "Generating solve db for $pkgdir..." | ||
| 64 | rm -rf $pkgdir/solvedb | ||
| 65 | mkdir -p $pkgdir/solvedb | ||
| 66 | echo "# Dynamically generated solve manifest" >> $pkgdir/solvedb/manifest | ||
| 67 | find $pkgdir -maxdepth 1 -type f >> $pkgdir/solvedb/manifest | ||
| 68 | ${RPM} -i --replacepkgs --replacefiles --oldpackage \ | ||
| 69 | -D "_dbpath $pkgdir/solvedb" --justdb \ | ||
| 70 | --noaid --nodeps --noorder --noscripts --notriggers --noparentdirs --nolinktos --stats \ | ||
| 71 | --ignoresize --nosignature --nodigest \ | ||
| 72 | -D "__dbi_txn create nofsync" \ | ||
| 73 | $pkgdir/solvedb/manifest | ||
| 74 | echo $pkgdir/solvedb >> ${RPMCONF_HOST_BASE}.conf | ||
| 52 | fi | 75 | fi |
| 53 | done | 76 | done |
| 54 | } | 77 | } |
| @@ -58,16 +81,27 @@ package_update_index_rpm () { | |||
| 58 | # generated depsolver db's... | 81 | # generated depsolver db's... |
| 59 | # | 82 | # |
| 60 | package_generate_rpm_conf () { | 83 | package_generate_rpm_conf () { |
| 61 | printf "_solve_dbpath " > ${DEPLOY_DIR_RPM}/solvedb.macro | 84 | printf "_solve_dbpath " > ${RPMCONF_TARGET_BASE}.macro |
| 85 | colon=false | ||
| 86 | for each in `cat ${RPMCONF_TARGET_BASE}.conf` ; do | ||
| 87 | if [ "$colon" == true ]; then | ||
| 88 | printf ":" >> ${RPMCONF_TARGET_BASE}.macro | ||
| 89 | fi | ||
| 90 | printf "%s" $each >> ${RPMCONF_TARGET_BASE}.macro | ||
| 91 | colon=true | ||
| 92 | done | ||
| 93 | printf "\n" >> ${RPMCONF_TARGET_BASE}.macro | ||
| 94 | |||
| 95 | printf "_solve_dbpath " > ${RPMCONF_HOST_BASE}.macro | ||
| 62 | colon=false | 96 | colon=false |
| 63 | for each in `cat ${DEPLOY_DIR_RPM}/solvedb.conf` ; do | 97 | for each in `cat ${RPMCONF_HOST_BASE}.conf` ; do |
| 64 | if [ "$colon" == true ]; then | 98 | if [ "$colon" == true ]; then |
| 65 | printf ":" >> ${DEPLOY_DIR_RPM}/solvedb.macro | 99 | printf ":" >> ${RPMCONF_HOST_BASE}.macro |
| 66 | fi | 100 | fi |
| 67 | printf "%s" $each >> ${DEPLOY_DIR_RPM}/solvedb.macro | 101 | printf "%s" $each >> ${RPMCONF_HOST_BASE}.macro |
| 68 | colon=true | 102 | colon=true |
| 69 | done | 103 | done |
| 70 | printf "\n" >> ${DEPLOY_DIR_RPM}/solvedb.macro | 104 | printf "\n" >> ${RPMCONF_HOST_BASE}.macro |
| 71 | } | 105 | } |
| 72 | 106 | ||
| 73 | rpm_log_check() { | 107 | rpm_log_check() { |
| @@ -90,6 +124,182 @@ rpm_log_check() { | |||
| 90 | true | 124 | true |
| 91 | } | 125 | } |
| 92 | 126 | ||
| 127 | |||
| 128 | # | ||
| 129 | # Resolve package names to filepaths | ||
| 130 | # resolve_pacakge <pkgname> <solvdb conffile> | ||
| 131 | # | ||
| 132 | resolve_package_rpm () { | ||
| 133 | local pkg="$1" | ||
| 134 | local conffile="$2" | ||
| 135 | local pkg_name="" | ||
| 136 | for solve in `cat ${conffile}`; do | ||
| 137 | pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2) | ||
| 138 | if [ -n "$pkg_name" ]; then | ||
| 139 | break; | ||
| 140 | fi | ||
| 141 | done | ||
| 142 | echo $pkg_name | ||
| 143 | } | ||
| 144 | |||
| 145 | # | ||
| 146 | # install a bunch of packages using rpm | ||
| 147 | # the following shell variables needs to be set before calling this func: | ||
| 148 | # INSTALL_ROOTFS_RPM - install root dir | ||
| 149 | # INSTALL_PLATFORM_RPM - main platform | ||
| 150 | # INSTALL_PLATFORM_EXTRA_RPM - extra platform | ||
| 151 | # INSTALL_CONFBASE_RPM - configuration file base name | ||
| 152 | # INSTALL_PACKAGES_NORMAL_RPM - packages to be installed | ||
| 153 | # INSTALL_PACKAGES_ATTEMPTONLY_RPM - packages attemped to be installed only | ||
| 154 | # INSTALL_PACKAGES_LINGUAS_RPM - additional packages for uclibc | ||
| 155 | # INSTALL_PROVIDENAME_RPM - content for provide name | ||
| 156 | # INSTALL_TASK_RPM - task name | ||
| 157 | |||
| 158 | package_install_internal_rpm () { | ||
| 159 | |||
| 160 | local target_rootfs="${INSTALL_ROOTFS_RPM}" | ||
| 161 | local platform="${INSTALL_PLATFORM_RPM}" | ||
| 162 | local platform_extra="${INSTALL_PLATFORM_EXTRA_RPM}" | ||
| 163 | local confbase="${INSTALL_CONFBASE_RPM}" | ||
| 164 | local package_to_install="${INSTALL_PACKAGES_NORMAL_RPM}" | ||
| 165 | local package_attemptonly="${INSTALL_PACKAGES_ATTEMPTONLY_RPM}" | ||
| 166 | local package_lingusa="${INSTALL_PACKAGES_LINGUAS_RPM}" | ||
| 167 | local providename="${INSTALL_PROVIDENAME_RPM}" | ||
| 168 | local task="${INSTALL_TASK_RPM}" | ||
| 169 | |||
| 170 | # Setup base system configuration | ||
| 171 | mkdir -p ${target_rootfs}/etc/rpm/ | ||
| 172 | echo "${platform}-unknown-linux" >${target_rootfs}/etc/rpm/platform | ||
| 173 | if [ ! -z "$platform_extra" ]; then | ||
| 174 | for pt in $platform_extra ; do | ||
| 175 | echo "$pt-unknown-linux" >> ${target_rootfs}/etc/rpm/platform | ||
| 176 | done | ||
| 177 | fi | ||
| 178 | |||
| 179 | # Tell RPM that the "/" directory exist and is available | ||
| 180 | mkdir -p ${target_rootfs}/etc/rpm/sysinfo | ||
| 181 | echo "/" >${target_rootfs}/etc/rpm/sysinfo/Dirnames | ||
| 182 | if [ ! -z "$providename" ]; then | ||
| 183 | >>${target_rootfs}/etc/rpm/sysinfo/Providename | ||
| 184 | for provide in $providename ; do | ||
| 185 | echo $provide >> ${target_rootfs}/etc/rpm/sysinfo/Providename | ||
| 186 | done | ||
| 187 | fi | ||
| 188 | |||
| 189 | # Setup manifest of packages to install... | ||
| 190 | mkdir -p ${target_rootfs}/install | ||
| 191 | echo "# Install manifest" > ${target_rootfs}/install/install.manifest | ||
| 192 | |||
| 193 | # Uclibc builds don't provide this stuff... | ||
| 194 | if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then | ||
| 195 | if [ ! -z "${package_lingusa}" ]; then | ||
| 196 | for pkg in ${package_lingusa}; do | ||
| 197 | echo "Processing $pkg..." | ||
| 198 | pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf) | ||
| 199 | if [ -z "$pkg_name" ]; then | ||
| 200 | echo "Unable to find package $pkg!" | ||
| 201 | exit 1 | ||
| 202 | fi | ||
| 203 | echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest | ||
| 204 | done | ||
| 205 | fi | ||
| 206 | fi | ||
| 207 | |||
| 208 | if [ ! -z "${package_to_install}" ]; then | ||
| 209 | for pkg in ${package_to_install} ; do | ||
| 210 | echo "Processing $pkg..." | ||
| 211 | pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf) | ||
| 212 | if [ -z "$pkg_name" ]; then | ||
| 213 | echo "Unable to find package $pkg!" | ||
| 214 | exit 1 | ||
| 215 | fi | ||
| 216 | echo $pkg_name >> ${target_rootfs}/install/install.manifest | ||
| 217 | done | ||
| 218 | fi | ||
| 219 | |||
| 220 | # Generate an install solution by doing a --justdb install, then recreate it with | ||
| 221 | # an actual package install! | ||
| 222 | ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ | ||
| 223 | -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \ | ||
| 224 | -D "__dbi_txn create nofsync" \ | ||
| 225 | -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ | ||
| 226 | ${target_rootfs}/install/install.manifest | ||
| 227 | |||
| 228 | if [ ! -z "${package_attemptonly}" ]; then | ||
| 229 | echo "Adding attempt only packages..." | ||
| 230 | for pkg in ${package_attemptonly} ; do | ||
| 231 | echo "Processing $pkg..." | ||
| 232 | pkg_name=$(resolve_package_rpm $pkg ${confbase}.conf) | ||
| 233 | if [ -z "$pkg_name" ]; then | ||
| 234 | echo "Unable to find package $pkg!" | ||
| 235 | exit 1 | ||
| 236 | fi | ||
| 237 | echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" | ||
| 238 | ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ | ||
| 239 | -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \ | ||
| 240 | -D "__dbi_txn create nofsync private" \ | ||
| 241 | -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ | ||
| 242 | $pkg_name >> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" || true | ||
| 243 | done | ||
| 244 | fi | ||
| 245 | |||
| 246 | #### Note: 'Recommends' is an arbitrary tag that means _SUGGESTS_ in Poky.. | ||
| 247 | # Add any recommended packages to the image | ||
| 248 | # RPM does not solve for recommended packages because they are optional... | ||
| 249 | # So we query them and tree them like the ATTEMPTONLY packages above... | ||
| 250 | # Change the loop to "1" to run this code... | ||
| 251 | loop=0 | ||
| 252 | if [ $loop -eq 1 ]; then | ||
| 253 | echo "Processing recommended packages..." | ||
| 254 | cat /dev/null > ${target_rootfs}/install/recommend.list | ||
| 255 | while [ $loop -eq 1 ]; do | ||
| 256 | # Dump the full set of recommends... | ||
| 257 | ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ | ||
| 258 | -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${confbase}.macro`" \ | ||
| 259 | -D "__dbi_txn create nofsync private" \ | ||
| 260 | -qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${target_rootfs}/install/recommend | ||
| 261 | # Did we add more to the list? | ||
| 262 | grep -v -x -F -f ${target_rootfs}/install/recommend.list ${target_rootfs}/install/recommend > ${target_rootfs}/install/recommend.new || true | ||
| 263 | # We don't want to loop unless there is a change to the list! | ||
| 264 | loop=0 | ||
| 265 | cat ${target_rootfs}/install/recommend.new | \ | ||
| 266 | while read pkg ; do | ||
| 267 | # Ohh there was a new one, we'll need to loop again... | ||
| 268 | loop=1 | ||
| 269 | echo "Processing $pkg..." | ||
| 270 | pkg_name=$(resolve_package $pkg ${confbase}.conf) | ||
| 271 | if [ -z "$pkg_name" ]; then | ||
| 272 | echo "Unable to find package $pkg." >> "${WORKDIR}/temp/log.do_${task}_recommend.${PID}" | ||
| 273 | continue | ||
| 274 | fi | ||
| 275 | echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_{task}_recommend.${PID}" | ||
| 276 | ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ | ||
| 277 | -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \ | ||
| 278 | -D "__dbi_txn create nofsync private" \ | ||
| 279 | -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ | ||
| 280 | $pkg_name >> "${WORKDIR}/temp/log.do_${task}_recommend.${PID}" 2>&1 || true | ||
| 281 | done | ||
| 282 | cat ${target_rootfs}/install/recommend.list ${target_rootfs}/install/recommend.new | sort -u > ${target_rootfs}/install/recommend.new.list | ||
| 283 | mv -f ${target_rootfs}/install/recommend.new.list ${target_rootfs}/install/recommend.list | ||
| 284 | rm ${target_rootfs}/install/recommend ${target_rootfs}/install/recommend.new | ||
| 285 | done | ||
| 286 | fi | ||
| 287 | |||
| 288 | # Now that we have a solution, pull out a list of what to install... | ||
| 289 | echo "Manifest: ${target_rootfs}/install/install.manifest" | ||
| 290 | ${RPM} -D "_dbpath ${target_rootfs}/install" -qa --yaml \ | ||
| 291 | -D "__dbi_txn create nofsync private" \ | ||
| 292 | | grep -i 'Packageorigin' | cut -d : -f 2 > ${target_rootfs}/install/install_solution.manifest | ||
| 293 | |||
| 294 | # Attempt install | ||
| 295 | ${RPM} --root ${target_rootfs} \ | ||
| 296 | -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ | ||
| 297 | -D "_dbpath ${rpmlibdir}" \ | ||
| 298 | --noscripts --notriggers --noparentdirs --nolinktos \ | ||
| 299 | -D "__dbi_txn create nofsync private" \ | ||
| 300 | -Uhv ${target_rootfs}/install/install_solution.manifest | ||
| 301 | } | ||
| 302 | |||
| 93 | python write_specfile () { | 303 | python write_specfile () { |
| 94 | import textwrap | 304 | import textwrap |
| 95 | 305 | ||
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass index 26aaa1f8c3..d9a9c7d8a8 100644 --- a/meta/classes/rootfs_rpm.bbclass +++ b/meta/classes/rootfs_rpm.bbclass | |||
| @@ -37,7 +37,7 @@ RPM="rpm ${RPMOPTS}" | |||
| 37 | do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock" | 37 | do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock" |
| 38 | 38 | ||
| 39 | fakeroot rootfs_rpm_do_rootfs () { | 39 | fakeroot rootfs_rpm_do_rootfs () { |
| 40 | set +x | 40 | #set +x |
| 41 | 41 | ||
| 42 | ${RPM_PREPROCESS_COMMANDS} | 42 | ${RPM_PREPROCESS_COMMANDS} |
| 43 | 43 | ||
| @@ -46,123 +46,18 @@ fakeroot rootfs_rpm_do_rootfs () { | |||
| 46 | # Setup base system configuration | 46 | # Setup base system configuration |
| 47 | mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ | 47 | mkdir -p ${IMAGE_ROOTFS}/etc/rpm/ |
| 48 | 48 | ||
| 49 | # Default arch is the top.. | 49 | #install pacakges |
| 50 | echo "${TARGET_ARCH}-unknown-linux" >${IMAGE_ROOTFS}/etc/rpm/platform | 50 | export INSTALL_ROOTFS_RPM="${IMAGE_ROOTFS}" |
| 51 | # Add the rest in sort order.. | 51 | export INSTALL_PLATFORM_RPM="${TARGET_ARCH}" |
| 52 | for each in ${PACKAGE_ARCHS} ; do | 52 | export INSTALL_PLATFORM_EXTRA_RPM="${PACKAGE_ARCHS}" |
| 53 | echo "$each""-unknown-linux" >>${IMAGE_ROOTFS}/etc/rpm/platform | 53 | export INSTALL_CONFBASE_RPM="${RPMCONF_TARGET_BASE}" |
| 54 | done | 54 | export INSTALL_PACKAGES_NORMAL_RPM="${PACKAGE_INSTALL}" |
| 55 | 55 | export INSTALL_PACKAGES_ATTEMPTONLY_RPM="${PACKAGE_INSTALL_ATTEMPTONLY}" | |
| 56 | # Tell RPM that the "/" directory exist and is available | 56 | export INSTALL_PACKAGES_LINGUAS_RPM="${LINGUAS_INSTALL}" |
| 57 | mkdir -p ${IMAGE_ROOTFS}/etc/rpm/sysinfo | 57 | export INSTALL_PROVIDENAME_RPM="" |
| 58 | echo "/" >${IMAGE_ROOTFS}/etc/rpm/sysinfo/Dirnames | 58 | export INSTALL_TASK_RPM="populate_sdk" |
| 59 | |||
| 60 | # Setup manifest of packages to install... | ||
| 61 | mkdir -p ${IMAGE_ROOTFS}/install | ||
| 62 | echo "# Install manifest" > ${IMAGE_ROOTFS}/install/install.manifest | ||
| 63 | |||
| 64 | # Uclibc builds don't provide this stuff... | ||
| 65 | if [ x${TARGET_OS} = "xlinux" ] || [ x${TARGET_OS} = "xlinux-gnueabi" ] ; then | ||
| 66 | if [ ! -z "${LINGUAS_INSTALL}" ]; then | ||
| 67 | for pkg in ${LINGUAS_INSTALL}; do | ||
| 68 | echo "Processing $pkg..." | ||
| 69 | pkg_name=$(resolve_package $pkg) | ||
| 70 | if [ -z "$pkg_name" ]; then | ||
| 71 | echo "Unable to find package $pkg!" | ||
| 72 | exit 1 | ||
| 73 | fi | ||
| 74 | echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest | ||
| 75 | done | ||
| 76 | fi | ||
| 77 | fi | ||
| 78 | 59 | ||
| 79 | if [ ! -z "${PACKAGE_INSTALL}" ]; then | 60 | package_install_internal_rpm |
| 80 | for pkg in ${PACKAGE_INSTALL} ; do | ||
| 81 | echo "Processing $pkg..." | ||
| 82 | pkg_name=$(resolve_package $pkg) | ||
| 83 | if [ -z "$pkg_name" ]; then | ||
| 84 | echo "Unable to find package $pkg!" | ||
| 85 | exit 1 | ||
| 86 | fi | ||
| 87 | echo $pkg_name >> ${IMAGE_ROOTFS}/install/install.manifest | ||
| 88 | done | ||
| 89 | fi | ||
| 90 | |||
| 91 | # Generate an install solution by doing a --justdb install, then recreate it with | ||
| 92 | # an actual package install! | ||
| 93 | ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \ | ||
| 94 | -D "__dbi_txn create nofsync" \ | ||
| 95 | -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ | ||
| 96 | ${IMAGE_ROOTFS}/install/install.manifest | ||
| 97 | |||
| 98 | if [ ! -z "${PACKAGE_INSTALL_ATTEMPTONLY}" ]; then | ||
| 99 | echo "Adding attempt only packages..." | ||
| 100 | for pkg in ${PACKAGE_INSTALL_ATTEMPTONLY} ; do | ||
| 101 | echo "Processing $pkg..." | ||
| 102 | pkg_name=$(resolve_package $pkg) | ||
| 103 | if [ -z "$pkg_name" ]; then | ||
| 104 | echo "Unable to find package $pkg!" | ||
| 105 | exit 1 | ||
| 106 | fi | ||
| 107 | echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}" | ||
| 108 | ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \ | ||
| 109 | -D "__dbi_txn create nofsync private" \ | ||
| 110 | -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ | ||
| 111 | $pkg_name >> "${WORKDIR}/temp/log.do_rootfs_attemptonly.${PID}" || true | ||
| 112 | done | ||
| 113 | fi | ||
| 114 | |||
| 115 | #### Note: 'Recommends' is an arbitrary tag that means _SUGGESTS_ in Poky.. | ||
| 116 | # Add any recommended packages to the image | ||
| 117 | # RPM does not solve for recommended packages because they are optional... | ||
| 118 | # So we query them and tree them like the ATTEMPTONLY packages above... | ||
| 119 | # Change the loop to "1" to run this code... | ||
| 120 | loop=0 | ||
| 121 | if [ $loop -eq 1 ]; then | ||
| 122 | echo "Processing recommended packages..." | ||
| 123 | cat /dev/null > ${IMAGE_ROOTFS}/install/recommend.list | ||
| 124 | while [ $loop -eq 1 ]; do | ||
| 125 | # Dump the full set of recommends... | ||
| 126 | ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \ | ||
| 127 | -D "__dbi_txn create nofsync private" \ | ||
| 128 | -qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${IMAGE_ROOTFS}/install/recommend | ||
| 129 | # Did we add more to the list? | ||
| 130 | grep -v -x -F -f ${IMAGE_ROOTFS}/install/recommend.list ${IMAGE_ROOTFS}/install/recommend > ${IMAGE_ROOTFS}/install/recommend.new || true | ||
| 131 | # We don't want to loop unless there is a change to the list! | ||
| 132 | loop=0 | ||
| 133 | cat ${IMAGE_ROOTFS}/install/recommend.new | \ | ||
| 134 | while read pkg ; do | ||
| 135 | # Ohh there was a new one, we'll need to loop again... | ||
| 136 | loop=1 | ||
| 137 | echo "Processing $pkg..." | ||
| 138 | pkg_name=$(resolve_package $pkg) | ||
| 139 | if [ -z "$pkg_name" ]; then | ||
| 140 | echo "Unable to find package $pkg." >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}" | ||
| 141 | continue | ||
| 142 | fi | ||
| 143 | echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}" | ||
| 144 | ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${DEPLOY_DIR_RPM}/solvedb.macro`" \ | ||
| 145 | -D "__dbi_txn create nofsync private" \ | ||
| 146 | -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ | ||
| 147 | $pkg_name >> "${WORKDIR}/temp/log.do_rootfs_recommend.${PID}" 2>&1 || true | ||
| 148 | done | ||
| 149 | cat ${IMAGE_ROOTFS}/install/recommend.list ${IMAGE_ROOTFS}/install/recommend.new | sort -u > ${IMAGE_ROOTFS}/install/recommend.new.list | ||
| 150 | mv ${IMAGE_ROOTFS}/install/recommend.new.list ${IMAGE_ROOTFS}/install/recommend.list | ||
| 151 | rm ${IMAGE_ROOTFS}/install/recommend ${IMAGE_ROOTFS}/install/recommend.new | ||
| 152 | done | ||
| 153 | fi | ||
| 154 | |||
| 155 | # Now that we have a solution, pull out a list of what to install... | ||
| 156 | echo "Manifest: ${IMAGE_ROOTFS}/install/install.manifest" | ||
| 157 | ${RPM} -D "_dbpath ${IMAGE_ROOTFS}/install" -qa --yaml \ | ||
| 158 | -D "__dbi_txn create nofsync private" \ | ||
| 159 | | grep -i 'Packageorigin' | cut -d : -f 2 > ${IMAGE_ROOTFS}/install/install_solution.manifest | ||
| 160 | |||
| 161 | # Attempt install | ||
| 162 | ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ | ||
| 163 | --noscripts --notriggers --noparentdirs --nolinktos \ | ||
| 164 | -D "__dbi_txn create nofsync private" \ | ||
| 165 | -Uhv ${IMAGE_ROOTFS}/install/install_solution.manifest | ||
| 166 | 61 | ||
| 167 | export D=${IMAGE_ROOTFS} | 62 | export D=${IMAGE_ROOTFS} |
| 168 | export OFFLINE_ROOT=${IMAGE_ROOTFS} | 63 | export OFFLINE_ROOT=${IMAGE_ROOTFS} |
| @@ -227,7 +122,7 @@ EOF | |||
| 227 | 122 | ||
| 228 | # Workaround so the parser knows we need the resolve_package function! | 123 | # Workaround so the parser knows we need the resolve_package function! |
| 229 | if false ; then | 124 | if false ; then |
| 230 | resolve_package foo || true | 125 | resolve_package_rpm foo ${RPMCONF_TARGET_BASE}.conf || true |
| 231 | fi | 126 | fi |
| 232 | } | 127 | } |
| 233 | 128 | ||
| @@ -236,18 +131,6 @@ remove_packaging_data_files() { | |||
| 236 | rm -rf ${IMAGE_ROOTFS}${opkglibdir} | 131 | rm -rf ${IMAGE_ROOTFS}${opkglibdir} |
| 237 | } | 132 | } |
| 238 | 133 | ||
| 239 | # Resolve package names to filepaths | ||
| 240 | resolve_package() { | ||
| 241 | pkg="$1" | ||
| 242 | pkg_name="" | ||
| 243 | for solve in `cat ${DEPLOY_DIR_RPM}/solvedb.conf`; do | ||
| 244 | pkg_name=$(${RPM} -D "_dbpath $solve" -D "__dbi_txn create nofsync" -q --yaml $pkg | grep -i 'Packageorigin' | cut -d : -f 2) | ||
| 245 | if [ -n "$pkg_name" ]; then | ||
| 246 | break; | ||
| 247 | fi | ||
| 248 | done | ||
| 249 | echo $pkg_name | ||
| 250 | } | ||
| 251 | 134 | ||
| 252 | install_all_locales() { | 135 | install_all_locales() { |
| 253 | PACKAGES_TO_INSTALL="" | 136 | PACKAGES_TO_INSTALL="" |
| @@ -263,7 +146,7 @@ install_all_locales() { | |||
| 263 | # but this should be good enough for the few users of this function... | 146 | # but this should be good enough for the few users of this function... |
| 264 | for pkg in $INSTALLED_PACKAGES; do | 147 | for pkg in $INSTALLED_PACKAGES; do |
| 265 | for lang in ${IMAGE_LOCALES}; do | 148 | for lang in ${IMAGE_LOCALES}; do |
| 266 | pkg_name=$(resolve_package $pkg-locale-$lang) | 149 | pkg_name=$(resolve_package_rpm $pkg-locale-$lang ${RPMCONF_TARGET_BASE}.conf) |
| 267 | if [ -n "$pkg_name" ]; then | 150 | if [ -n "$pkg_name" ]; then |
| 268 | ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ | 151 | ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ |
| 269 | -D "__dbi_txn create nofsync private" \ | 152 | -D "__dbi_txn create nofsync private" \ |
