Hi,
We do exactly that in our images, keep rpm but avoid dnf. We do it by adding
this to the image recipes (via in inc file).
ROOTFS_PKGMANAGE_remove = "dnf"
ROOTFS_POSTUNINSTALL_COMMAND += "spx_wipe_dnf_data ; "
spx_wipe_dnf_data() {
bbnote "Removing all dnf runtime data"
for d in /var/lib/dnf /var/cache/dnf; do
[ -d ${IMAGE_ROOTFS}$d ] || continue
dirsize=`du -ks ${IMAGE_ROOTFS}/$d | awk '{ print $1 }'`
bbnote "Removing $d with $dirsize KiB"
rm -rf ${IMAGE_ROOTFS}$d/*
done
}
I hope this helps
--
Diego Santa Cruz, PhD
Technology Architect
spinetix.com
From: [email protected]
<[email protected]> On Behalf Of hongxu via
lists.openembedded.org
Sent: 20 January 2022 03:54
To: Alexander Kanavin <[email protected]>
Cc: OE-core <[email protected]>; Yang, Liezhi
<[email protected]>
Subject: Re: [OE-core] [PATCH] package_manager/rpm: conditional remove package
manager database
I am afraid doing remove operation in ROOTFS_POSTPROCESS_COMMAND could not
satisfy this case
The background is in order to save spaces in embedded device, user do not
install
package dnf which introduces python3, and use rpm to manage package on target
In oe-core, the dnf, rpm and pkg database are introduced by package-management
of IMAGE_FEATURES,
if package-management in IMAGE_FEATURES, we could remove unused pkg data in
ROOTFS_POSTPROCESS_COMMAND as you suggested, but we could not uninstall
dnf and all related depend(such as python3) gracefully;
if package-management not in IMAGE_FEATURES, the pkg data will be removed
before ROOTFS_POSTPROCESS_COMMAND, that's why this commit are trying to resolve
The root cause maybe dnf is too heavy for disk sensitive device
//Hongxu
________________________________
From: Alexander Kanavin <[email protected]<mailto:[email protected]>>
Sent: Wednesday, January 19, 2022 6:15 PM
To: Jia, Hongxu <[email protected]<mailto:[email protected]>>
Cc: OE-core
<[email protected]<mailto:[email protected]>>;
Yang, Liezhi <[email protected]<mailto:[email protected]>>
Subject: Re: [OE-core] [PATCH] package_manager/rpm: conditional remove package
manager database
[Please note: This e-mail is from an EXTERNAL e-mail address]
Apologies, but please no. This adds complexity, isn't possible to disable and
is difficult to understand. You can simply remove the unneeded files from
ROOTFS_POSTPROCESS_COMMAND in your image class.
Alex
On Wed, 19 Jan 2022 at 04:07, hongxu
<[email protected]<mailto:[email protected]>> wrote:
In order to save spaces in target rootfs, the user wants to remove dnf and
keep rpm, in this situation, we should remove dnf database only
If rpm was installed, keep rpm database, after applying this commit:
Edit conf/local.conf
...
IMAGE_FEATURES:remove = "package-management"
IMAGE_INSTALL:append= " rpm"
...
Build image and boot, run rpm -qa on target:
Without this commit
...
root@intel-x86-64:~# rpm -qa | wc -l
0
...
Apply this commit
...
root@intel-x86-64:~# rpm -qa | wc -l
1865
...
With this commit, the rpm -qa works as expected.
It does not make sense to keep dnf and remove rpm, so this commit
does not consider the scenario
Signed-off-by: Hongxu Jia
<[email protected]<mailto:[email protected]>>
---
meta/lib/oe/package_manager/rpm/__init__.py<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__http%3A%2F%2F__init__.py__%3B!!AjveYdw8EvQ!JHTMzGi0-aiMoNjIt7Jb186B-p8VNKpv_Yrm-v87Li0GFTZf07eaSBP1gIDKvdp1Putv%24&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7Ccfe2bf45c56e4efe23b608d9dbc02521%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637782440578878242%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=i0%2B51iSlYuayK9kClXpEUxk%2FhpzlSMHHkNLpa7%2BDSWc%3D&reserved=0>
| 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/meta/lib/oe/package_manager/rpm/__init__.py<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__http%3A%2F%2F__init__.py__%3B!!AjveYdw8EvQ!JHTMzGi0-aiMoNjIt7Jb186B-p8VNKpv_Yrm-v87Li0GFTZf07eaSBP1gIDKvdp1Putv%24&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7Ccfe2bf45c56e4efe23b608d9dbc02521%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637782440578878242%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=i0%2B51iSlYuayK9kClXpEUxk%2FhpzlSMHHkNLpa7%2BDSWc%3D&reserved=0>
b/meta/lib/oe/package_manager/rpm/__init__.py<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__http%3A%2F%2F__init__.py__%3B!!AjveYdw8EvQ!JHTMzGi0-aiMoNjIt7Jb186B-p8VNKpv_Yrm-v87Li0GFTZf07eaSBP1gIDKvdp1Putv%24&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7Ccfe2bf45c56e4efe23b608d9dbc02521%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637782440578878242%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=i0%2B51iSlYuayK9kClXpEUxk%2FhpzlSMHHkNLpa7%2BDSWc%3D&reserved=0>
index b392581069..dce5912329 100644
---
a/meta/lib/oe/package_manager/rpm/__init__.py<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__http%3A%2F%2F__init__.py__%3B!!AjveYdw8EvQ!JHTMzGi0-aiMoNjIt7Jb186B-p8VNKpv_Yrm-v87Li0GFTZf07eaSBP1gIDKvdp1Putv%24&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7Ccfe2bf45c56e4efe23b608d9dbc02521%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637782440578878242%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=i0%2B51iSlYuayK9kClXpEUxk%2FhpzlSMHHkNLpa7%2BDSWc%3D&reserved=0>
+++
b/meta/lib/oe/package_manager/rpm/__init__.py<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__http%3A%2F%2F__init__.py__%3B!!AjveYdw8EvQ!JHTMzGi0-aiMoNjIt7Jb186B-p8VNKpv_Yrm-v87Li0GFTZf07eaSBP1gIDKvdp1Putv%24&data=04%7C01%7Cdiego.santacruz%40spinetix.com%7Ccfe2bf45c56e4efe23b608d9dbc02521%7C5f4034faed2d4840a93facb1e9633b93%7C0%7C0%7C637782440578878242%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=i0%2B51iSlYuayK9kClXpEUxk%2FhpzlSMHHkNLpa7%2BDSWc%3D&reserved=0>
@@ -80,7 +80,9 @@ class RpmPM(PackageManager):
self.saved_packaging_data =
self.d.expand('${T}/saved_packaging_data/%s' % self.task_name)
if not os.path.exists(self.d.expand('${T}/saved_packaging_data')):
bb.utils.mkdirhier(self.d.expand('${T}/saved_packaging_data'))
- self.packaging_data_dirs = ['etc/rpm', 'etc/rpmrc', 'etc/dnf',
'var/lib/rpm', 'var/lib/dnf', 'var/cache/dnf']
+ self.packaging_data_rpm_dirs = ['etc/rpm', 'etc/rpmrc', 'var/lib/rpm']
+ self.packaging_data_dnf_dirs = ['etc/dnf', 'var/lib/dnf',
'var/cache/dnf']
+ self.packaging_data_dirs = self.packaging_data_rpm_dirs +
self.packaging_data_dnf_dirs
self.solution_manifest = self.d.expand('${T}/saved/%s_solution' %
self.task_name)
if not os.path.exists(self.d.expand('${T}/saved')):
@@ -237,8 +239,11 @@ class RpmPM(PackageManager):
self._invoke_dnf(["autoremove"])
def remove_packaging_data(self):
+ remove_packaging_data_dirs = self.packaging_data_dnf_dirs
+ if "rpm" not in self.list_installed():
+ remove_packaging_data_dirs += self.packaging_data_rpm_dirs
self._invoke_dnf(["clean", "all"])
- for dir in self.packaging_data_dirs:
+ for dir in remove_packaging_data_dirs:
bb.utils.remove(oe.path.join(self.target_rootfs, dir), True)
def backup_packaging_data(self):
--
2.27.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#160750):
https://lists.openembedded.org/g/openembedded-core/message/160750
Mute This Topic: https://lists.openembedded.org/mt/88527238/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-