self.show_unresolved_dependencies_msg(unresolved_dependencies)
raise RpmError("Unresolved dependencies, transaction failed.")
- # python rpm has a crash bug while use 'addErase' and 'run' to remove packages
- """
cb = rpmmisc.RPMInstallCallback(self.ts)
logfile = "%s/__catched_stderr.buf" % (self.instroot)
for e in errors:
msger.warning(e[0])
raise RpmError('Could not run transaction.')
- """
-
- self.ts.closeDB()
- self.ts = None
- # chroot into install root and remove packages with rpm cmd
- # note: the rpm package should has been installed in install root
- # some rpm packages only include tpk package, them should be uninstalled
+ # chroot into install root and remove preload packages
+ # note: the preload packages are installed by posttrans script of pkgmgr package
script = """#!/bin/bash
pkgs=$1
if [ -n "$pkgs" ]; then
- if [ -f /usr/bin/rpm ]; then
- rpm -e --allmatches $pkgs
- if [ -f /usr/bin/pkgcmd ]; then
- for pkg in $pkgs; do
- result=$(pkgcmd -l --global | grep -m 1 $pkg)
- pkgid=$(echo ${result#*pkgid} | awk -F ' ' '{print $1}' | sed 's/.*\\[\\(.*\\)\\].*/\\1/')
- if [ -n "$pkgid" ]; then
- echo "Uninstalling preload $pkgtype package $pkgid ..."
- pkginfo=$(pkginfo --pkg $pkgid)
- pkgtype=$(echo "$pkginfo" | grep "Type:" | awk -F ': ' '{print $2}')
- preload=$(echo "$pkginfo" | grep "Preload:" | awk -F ': ' '{print $2}')
- readonly=$(echo "$pkginfo" | grep "Readonly:" | awk -F ': ' '{print $2}')
- options=""
- if [[ $pkgtype == 'tpk' ]]; then
- cmd='/usr/bin/tpk-backend'
- elif [[ $pkgtype == 'wgt' ]]; then
- cmd='/usr/bin/wgt-backend'
- else
- cmd='/usr/bin/unified-backend'
- fi
- if [[ $preload == "1" ]]; then
- if [[ $readonly == "1" ]]; then
- options="--preload"
- else
- options="--preload-rw"
- fi
- fi
- if [ -f $cmd ]; then
- $cmd -d $pkg $options --force-remove
+ if [ -f /usr/bin/pkgcmd ]; then
+ for pkg in $pkgs; do
+ result=$(pkgcmd -l --global | grep -m 1 $pkg)
+ pkgid=$(echo ${result#*pkgid} | awk -F ' ' '{print $1}' | sed 's/.*\\[\\(.*\\)\\].*/\\1/')
+ if [ -n "$pkgid" ]; then
+ echo "Uninstalling preload $pkgtype package $pkgid ..."
+ pkginfo=$(pkginfo --pkg $pkgid)
+ pkgtype=$(echo "$pkginfo" | grep "Type:" | awk -F ': ' '{print $2}')
+ preload=$(echo "$pkginfo" | grep "Preload:" | awk -F ': ' '{print $2}')
+ readonly=$(echo "$pkginfo" | grep "Readonly:" | awk -F ': ' '{print $2}')
+ options=""
+ if [[ $pkgtype == 'tpk' ]]; then
+ cmd='/usr/bin/tpk-backend'
+ elif [[ $pkgtype == 'wgt' ]]; then
+ cmd='/usr/bin/wgt-backend'
+ else
+ cmd='/usr/bin/unified-backend'
+ fi
+ if [[ $preload == "1" ]]; then
+ if [[ $readonly == "1" ]]; then
+ options="--preload"
else
- echo "$cmd is not installed"
- exit 1
+ options="--preload-rw"
fi
fi
- done
- else
- echo 'pkgmgr package is not installed in image, no preload packages'
- fi
+ if [ -f $cmd ]; then
+ $cmd -d $pkg $options --force-remove
+ else
+ echo "$cmd is not installed"
+ exit 1
+ fi
+ fi
+ done
else
- echo 'rpm package is not installed in image'
- exit 1
+ echo 'pkgmgr package is not installed in image, no preload packages'
fi
fi
exit 0