* [PATCH][jethro] rootfs: Modify RPM installation @ 2016-07-08 7:57 David Vincent 2016-07-21 19:50 ` Burton, Ross ` (2 more replies) 0 siblings, 3 replies; 19+ messages in thread From: David Vincent @ 2016-07-08 7:57 UTC (permalink / raw) To: openembedded-core When using a custom RPM data directory instead of the default dir '/var/lib/rpm', the final image did not contain any of the database files in the expected location. This commit takes into account the 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. Signed-off-by: David Vincent <freesilicon@gmail.com> --- meta/lib/oe/package_manager.py | 26 +++++++++++++++----------- meta/lib/oe/rootfs.py | 3 ++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index b9fa6d8..83c9858 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -302,7 +302,8 @@ class RpmPkgsList(PkgsList): super(RpmPkgsList, self).__init__(d, rootfs_dir) self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir', True) + self.image_rpmlib = os.path.join(self.rootfs_dir, self.rpm_libdir[1:]) self.ml_prefix_list, self.ml_os_list = \ RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var) @@ -369,7 +370,7 @@ class RpmPkgsList(PkgsList): return self._list_pkg_deps() cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir - cmd += ' -D "_dbpath /var/lib/rpm" -qa' + cmd += ' -D "_dbpath %s" -qa' % self.rpm_libdir if self.rpm_version == 4: cmd += " --qf '[%{NAME} %{ARCH} %{VERSION}\n]'" else: @@ -670,7 +671,8 @@ class RpmPM(PackageManager): self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % self.task_name) self.saved_rpmlib = self.d.expand('${T}/saved/%s' % self.task_name) - self.image_rpmlib = os.path.join(self.target_rootfs, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir', True) + self.image_rpmlib = os.path.join(self.target_rootfs, self.rpm_libdir[1:]) if not os.path.exists(self.d.expand('${T}/saved')): bb.utils.mkdirhier(self.d.expand('${T}/saved')) @@ -924,8 +926,8 @@ class RpmPM(PackageManager): opt = "-qa" if self.rpm_version == 4: opt = "--initdb" - cmd = "%s --root %s --dbpath /var/lib/rpm %s > /dev/null" % ( - self.rpm_cmd, self.target_rootfs, opt) + cmd = "%s --root %s --dbpath %s %s > /dev/null" % ( + self.rpm_cmd, self.target_rootfs, self.rpm_libdir, opt) try: subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as e: @@ -934,8 +936,8 @@ class RpmPM(PackageManager): # Import GPG key to RPM database of the target system if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1': pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True) - cmd = "%s --root %s --dbpath /var/lib/rpm --import %s > /dev/null" % ( - self.rpm_cmd, self.target_rootfs, pubkey_path) + cmd = "%s --root %s --dbpath %s --import %s > /dev/null" % ( + self.rpm_cmd, self.target_rootfs, self.rpm_libdir, pubkey_path) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) # Configure smart @@ -943,7 +945,7 @@ class RpmPM(PackageManager): bb.utils.remove(os.path.join(self.target_rootfs, 'var/lib/smart'), True) self._invoke_smart('config --set rpm-root=%s' % self.target_rootfs) - self._invoke_smart('config --set rpm-dbpath=/var/lib/rpm') + self._invoke_smart('config --set rpm-dbpath=%s' % self.rpm_libdir) self._invoke_smart('config --set rpm-extra-macros._var=%s' % self.d.getVar('localstatedir', True)) cmd = "config --set rpm-extra-macros._tmppath=/%s/tmp" % (self.install_dir_name) @@ -1179,7 +1181,7 @@ class RpmPM(PackageManager): if not with_dependencies: cmd = "%s -e --nodeps " % self.rpm_cmd cmd += "--root=%s " % self.target_rootfs - cmd += "--dbpath=/var/lib/rpm " + cmd += "--dbpath=%s " % self.rpm_libdir cmd += "--define='_cross_scriptlet_wrapper %s' " % \ self.scriptlet_wrapper cmd += "--define='_tmppath /%s/tmp' %s" % (self.install_dir_name, ' '.join(pkgs)) @@ -1333,7 +1335,8 @@ class RpmPM(PackageManager): saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') + new_pkg cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg + cmd += ' --dbpath=%s ' % self.rpm_libdir + cmd += new_pkg cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}"' cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir @@ -1365,7 +1368,8 @@ class RpmPM(PackageManager): ''' def unlock_rpm_db(self): # Remove rpm db lock files - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.target_rootfs) + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, + self.rpm_libdir)) for f in rpm_db_locks: bb.utils.remove(f, True) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index 18df22d..a4ee433 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -420,6 +420,7 @@ class RpmRootfs(Rootfs): def _create(self): pkgs_to_install = self.manifest.parse_initial_manifest() + rpm_libdir = self.d.getVar('rpmlibdir', True) rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS', True) rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS', True) @@ -449,7 +450,7 @@ class RpmRootfs(Rootfs): self.pm.install_complementary() - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) execute_pre_post_process(self.d, rpm_post_process_cmds) -- 2.9.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH][jethro] rootfs: Modify RPM installation 2016-07-08 7:57 [PATCH][jethro] rootfs: Modify RPM installation David Vincent @ 2016-07-21 19:50 ` Burton, Ross 2016-09-30 20:03 ` Leonardo Sandoval 2016-11-24 10:49 ` [PATCH v3] " David Vincent 2 siblings, 0 replies; 19+ messages in thread From: Burton, Ross @ 2016-07-21 19:50 UTC (permalink / raw) To: David Vincent; +Cc: OE-core [-- Attachment #1: Type: text/plain, Size: 412 bytes --] On 8 July 2016 at 08:57, David Vincent <freesilicon@gmail.com> wrote: > When using a custom RPM data directory instead of the default dir > '/var/lib/rpm', the final image did not contain any of the database > files in the expected location. This commit takes into account the > 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. Can you resend this based on current master please? Thanks, Ross [-- Attachment #2: Type: text/html, Size: 841 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH][jethro] rootfs: Modify RPM installation 2016-07-08 7:57 [PATCH][jethro] rootfs: Modify RPM installation David Vincent 2016-07-21 19:50 ` Burton, Ross @ 2016-09-30 20:03 ` Leonardo Sandoval 2016-11-24 10:49 ` [PATCH v3] " David Vincent 2 siblings, 0 replies; 19+ messages in thread From: Leonardo Sandoval @ 2016-09-30 20:03 UTC (permalink / raw) To: David Vincent, openembedded-core; +Cc: Plascencia, Daniela On 07/08/2016 02:57 AM, David Vincent wrote: > When using a custom RPM data directory instead of the default dir > '/var/lib/rpm', the final image did not contain any of the database > files in the expected location. This commit takes into account the > 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. > > Signed-off-by: David Vincent <freesilicon@gmail.com> > --- > meta/lib/oe/package_manager.py | 26 +++++++++++++++----------- > meta/lib/oe/rootfs.py | 3 ++- > 2 files changed, 17 insertions(+), 12 deletions(-) > > diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py > index b9fa6d8..83c9858 100644 > --- a/meta/lib/oe/package_manager.py > +++ b/meta/lib/oe/package_manager.py > @@ -302,7 +302,8 @@ class RpmPkgsList(PkgsList): > super(RpmPkgsList, self).__init__(d, rootfs_dir) > > self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") > - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') > + self.rpm_libdir = self.d.getVar('rpmlibdir', True) > + self.image_rpmlib = os.path.join(self.rootfs_dir, self.rpm_libdir[1:]) > > self.ml_prefix_list, self.ml_os_list = \ > RpmIndexer(d, > rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var) > @@ -369,7 +370,7 @@ class RpmPkgsList(PkgsList): > return self._list_pkg_deps() > > cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir > - cmd += ' -D "_dbpath /var/lib/rpm" -qa' > + cmd += ' -D "_dbpath %s" -qa' % self.rpm_libdir > if self.rpm_version == 4: > cmd += " --qf '[%{NAME} %{ARCH} %{VERSION}\n]'" > else: > @@ -670,7 +671,8 @@ class RpmPM(PackageManager): > self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % > self.task_name) > self.saved_rpmlib = self.d.expand('${T}/saved/%s' % self.task_name) > - self.image_rpmlib = os.path.join(self.target_rootfs, 'var/lib/rpm') > + self.rpm_libdir = self.d.getVar('rpmlibdir', True) > + self.image_rpmlib = os.path.join(self.target_rootfs, > self.rpm_libdir[1:]) the above line is not valid for a patcher like git-apply. Did you send the patch with git-send-email? It may be the case that the email client you are using it truncate this line. > > if not os.path.exists(self.d.expand('${T}/saved')): > bb.utils.mkdirhier(self.d.expand('${T}/saved')) > @@ -924,8 +926,8 @@ class RpmPM(PackageManager): > opt = "-qa" > if self.rpm_version == 4: > opt = "--initdb" > - cmd = "%s --root %s --dbpath /var/lib/rpm %s > /dev/null" % ( > - self.rpm_cmd, self.target_rootfs, opt) > + cmd = "%s --root %s --dbpath %s %s > /dev/null" % ( > + self.rpm_cmd, self.target_rootfs, self.rpm_libdir, opt) > try: > subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) > except subprocess.CalledProcessError as e: > @@ -934,8 +936,8 @@ class RpmPM(PackageManager): > # Import GPG key to RPM database of the target system > if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1': > pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True) > - cmd = "%s --root %s --dbpath /var/lib/rpm --import %s > > /dev/null" % ( > - self.rpm_cmd, self.target_rootfs, pubkey_path) > + cmd = "%s --root %s --dbpath %s --import %s > /dev/null" % ( > + self.rpm_cmd, self.target_rootfs, self.rpm_libdir, > pubkey_path) > subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) > > # Configure smart > @@ -943,7 +945,7 @@ class RpmPM(PackageManager): > bb.utils.remove(os.path.join(self.target_rootfs, 'var/lib/smart'), > True) > self._invoke_smart('config --set rpm-root=%s' % self.target_rootfs) > - self._invoke_smart('config --set rpm-dbpath=/var/lib/rpm') > + self._invoke_smart('config --set rpm-dbpath=%s' % self.rpm_libdir) > self._invoke_smart('config --set rpm-extra-macros._var=%s' % > self.d.getVar('localstatedir', True)) > cmd = "config --set rpm-extra-macros._tmppath=/%s/tmp" % > (self.install_dir_name) > @@ -1179,7 +1181,7 @@ class RpmPM(PackageManager): > if not with_dependencies: > cmd = "%s -e --nodeps " % self.rpm_cmd > cmd += "--root=%s " % self.target_rootfs > - cmd += "--dbpath=/var/lib/rpm " > + cmd += "--dbpath=%s " % self.rpm_libdir > cmd += "--define='_cross_scriptlet_wrapper %s' " % \ > self.scriptlet_wrapper > cmd += "--define='_tmppath /%s/tmp' %s" % > (self.install_dir_name, ' '.join(pkgs)) > @@ -1333,7 +1335,8 @@ class RpmPM(PackageManager): > saved_dir = self.target_rootfs + > self.d.expand('${sysconfdir}/rpm-postinsts/') + new_pkg > > cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs > - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg > + cmd += ' --dbpath=%s ' % self.rpm_libdir > + cmd += new_pkg > cmd += ' | sed -n -e "/^postinstall scriptlet (using > .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}"' > cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' > cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir > @@ -1365,7 +1368,8 @@ class RpmPM(PackageManager): > ''' > def unlock_rpm_db(self): > # Remove rpm db lock files > - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.target_rootfs) > + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, > + self.rpm_libdir)) > for f in rpm_db_locks: > bb.utils.remove(f, True) > > diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py > index 18df22d..a4ee433 100644 > --- a/meta/lib/oe/rootfs.py > +++ b/meta/lib/oe/rootfs.py > @@ -420,6 +420,7 @@ class RpmRootfs(Rootfs): > > def _create(self): > pkgs_to_install = self.manifest.parse_initial_manifest() > + rpm_libdir = self.d.getVar('rpmlibdir', True) > rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS', True) > rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS', True) > > @@ -449,7 +450,7 @@ class RpmRootfs(Rootfs): > > self.pm.install_complementary() > > - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) > + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) > > execute_pre_post_process(self.d, rpm_post_process_cmds) > ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3] rootfs: Modify RPM installation 2016-07-08 7:57 [PATCH][jethro] rootfs: Modify RPM installation David Vincent 2016-07-21 19:50 ` Burton, Ross 2016-09-30 20:03 ` Leonardo Sandoval @ 2016-11-24 10:49 ` David Vincent 2016-11-25 18:17 ` Burton, Ross 2016-12-12 15:59 ` [PATCH v4] " David Vincent 2 siblings, 2 replies; 19+ messages in thread From: David Vincent @ 2016-11-24 10:49 UTC (permalink / raw) To: openembedded-core, ross.burton, leonardo.sandoval.gonzalez, daniela.plascencia When using a custom RPM data directory instead of the default dir '/var/lib/rpm', the final image did not contain any of the database files in the expected location. This commit takes into account the 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. Signed-off-by: David Vincent <freesilicon@gmail.com> --- meta/lib/oe/package_manager.py | 26 +++++++++++++++----------- meta/lib/oe/rootfs.py | 3 ++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 7ba2e4d..6344543 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -352,7 +352,8 @@ class RpmPkgsList(PkgsList): super(RpmPkgsList, self).__init__(d, rootfs_dir) self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir', True) + self.image_rpmlib = os.path.join(self.rootfs_dir, self.rpm_libdir[1:]) self.ml_prefix_list, self.ml_os_list = \ RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var) @@ -413,7 +414,7 @@ class RpmPkgsList(PkgsList): def list_pkgs(self): cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir - cmd += ' -D "_dbpath /var/lib/rpm" -qa' + cmd += ' -D "_dbpath %s" -qa' % self.rpm_libdir cmd += " --qf '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]'" try: @@ -681,7 +682,8 @@ class RpmPM(PackageManager): self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % self.task_name) self.saved_rpmlib = self.d.expand('${T}/saved/%s' % self.task_name) - self.image_rpmlib = os.path.join(self.target_rootfs, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir', True) + self.image_rpmlib = os.path.join(self.target_rootfs, self.rpm_libdir[1:]) if not os.path.exists(self.d.expand('${T}/saved')): bb.utils.mkdirhier(self.d.expand('${T}/saved')) @@ -950,8 +952,8 @@ class RpmPM(PackageManager): # Create database so that smart doesn't complain (lazy init) opt = "-qa" - cmd = "%s --root %s --dbpath /var/lib/rpm %s > /dev/null" % ( - self.rpm_cmd, self.target_rootfs, opt) + cmd = "%s --root %s --dbpath %s %s > /dev/null" % ( + self.rpm_cmd, self.target_rootfs, self.rpm_libdir, opt) try: subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as e: @@ -960,8 +962,8 @@ class RpmPM(PackageManager): # Import GPG key to RPM database of the target system if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1': pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True) - cmd = "%s --root %s --dbpath /var/lib/rpm --import %s > /dev/null" % ( - self.rpm_cmd, self.target_rootfs, pubkey_path) + cmd = "%s --root %s --dbpath %s --import %s > /dev/null" % ( + self.rpm_cmd, self.target_rootfs, self.rpm_libdir, pubkey_path) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) # Configure smart @@ -969,7 +971,7 @@ class RpmPM(PackageManager): bb.utils.remove(os.path.join(self.target_rootfs, 'var/lib/smart'), True) self._invoke_smart('config --set rpm-root=%s' % self.target_rootfs) - self._invoke_smart('config --set rpm-dbpath=/var/lib/rpm') + self._invoke_smart('config --set rpm-dbpath=%s' % self.rpm_libdir) self._invoke_smart('config --set rpm-extra-macros._var=%s' % self.d.getVar('localstatedir', True)) cmd = "config --set rpm-extra-macros._tmppath=/%s/tmp" % (self.install_dir_name) @@ -1231,7 +1233,7 @@ class RpmPM(PackageManager): if not with_dependencies: cmd = "%s -e --nodeps " % self.rpm_cmd cmd += "--root=%s " % self.target_rootfs - cmd += "--dbpath=/var/lib/rpm " + cmd += "--dbpath=%s " % self.rpm_libdir cmd += "--define='_cross_scriptlet_wrapper %s' " % \ self.scriptlet_wrapper cmd += "--define='_tmppath /%s/tmp' %s" % (self.install_dir_name, ' '.join(pkgs)) @@ -1385,7 +1387,8 @@ class RpmPM(PackageManager): saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') + new_pkg cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg + cmd += ' --dbpath=%s ' % self.rpm_libdir + cmd += new_pkg cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}"' cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir @@ -1417,7 +1420,8 @@ class RpmPM(PackageManager): ''' def unlock_rpm_db(self): # Remove rpm db lock files - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.target_rootfs) + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, + self.rpm_libdir)) for f in rpm_db_locks: bb.utils.remove(f, True) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index a348b97..7cf8ce8 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -426,6 +426,7 @@ class RpmRootfs(Rootfs): def _create(self): pkgs_to_install = self.manifest.parse_initial_manifest() + rpm_libdir = self.d.getVar('rpmlibdir', True) rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS', True) rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS', True) @@ -473,7 +474,7 @@ class RpmRootfs(Rootfs): if self.progress_reporter: self.progress_reporter.next_stage() - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) execute_pre_post_process(self.d, rpm_post_process_cmds) -- 2.10.2 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v3] rootfs: Modify RPM installation 2016-11-24 10:49 ` [PATCH v3] " David Vincent @ 2016-11-25 18:17 ` Burton, Ross 2016-11-25 19:09 ` Mark Hatle 2016-12-12 15:59 ` [PATCH v4] " David Vincent 1 sibling, 1 reply; 19+ messages in thread From: Burton, Ross @ 2016-11-25 18:17 UTC (permalink / raw) To: David Vincent; +Cc: Plascencia, Daniela, OE-core [-- Attachment #1: Type: text/plain, Size: 475 bytes --] On 24 November 2016 at 10:49, David Vincent <freesilicon@gmail.com> wrote: > - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', > '/var/lib/smart']) > + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, > '/var/lib/smart']) > Can we extend the un-hardcoding so this uses ${localstatedir}/lib/smart, and rpmlibdir also uses ${localstatedir}? Also current master lets you not bother passing True to d.getVar() as that is the default now. Ross [-- Attachment #2: Type: text/html, Size: 993 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3] rootfs: Modify RPM installation 2016-11-25 18:17 ` Burton, Ross @ 2016-11-25 19:09 ` Mark Hatle 2016-11-28 10:59 ` David Vincent 0 siblings, 1 reply; 19+ messages in thread From: Mark Hatle @ 2016-11-25 19:09 UTC (permalink / raw) To: openembedded-core On 11/25/16 12:17 PM, Burton, Ross wrote: > > On 24 November 2016 at 10:49, David Vincent <freesilicon@gmail.com > <mailto:freesilicon@gmail.com>> wrote: > > - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) > + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) > > > Can we extend the un-hardcoding so this uses ${localstatedir}/lib/smart, and > rpmlibdir also uses ${localstatedir}? The value for the rpm directory is hard coded into the configuration file. Anything we do outside of that MUST match. Inspect the rpm macros file for the matching value. (This is why /var/lib/rpm was hard coded in the past.) As for smart, I don't remember the rules offhand, so someone will need to figure out if it's variable (compile time) or hard coded. --Mark > Also current master lets you not bother passing True to d.getVar() as that is > the default now. > > Ross > > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3] rootfs: Modify RPM installation 2016-11-25 19:09 ` Mark Hatle @ 2016-11-28 10:59 ` David Vincent 0 siblings, 0 replies; 19+ messages in thread From: David Vincent @ 2016-11-28 10:59 UTC (permalink / raw) To: openembedded-core On vendredi 25 novembre 2016 13:09:30 CET Mark Hatle wrote: > On 11/25/16 12:17 PM, Burton, Ross wrote: > > On 24 November 2016 at 10:49, David Vincent <freesilicon@gmail.com > > > > <mailto:freesilicon@gmail.com>> wrote: > > - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', > > '/var/lib/smart']) + self._setup_dbg_rootfs(['/etc/rpm', > > rpm_libdir, '/var/lib/smart'])> > > Can we extend the un-hardcoding so this uses ${localstatedir}/lib/smart, > > and rpmlibdir also uses ${localstatedir}? > > The value for the rpm directory is hard coded into the configuration file. > Anything we do outside of that MUST match. Inspect the rpm macros file for > the matching value. (This is why /var/lib/rpm was hard coded in the past.) And that was the root cause of the problem when rpmlibdir is modified from its default value. Maybe the rpmlibdir variable should be documented in the ref- manual for those who wants to tinker with it. > > As for smart, I don't remember the rules offhand, so someone will need to > figure out if it's variable (compile time) or hard coded. > > --Mark > > > Also current master lets you not bother passing True to d.getVar() as that > > is the default now. So should I send a v4 ? > > > > Ross ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4] rootfs: Modify RPM installation 2016-11-24 10:49 ` [PATCH v3] " David Vincent 2016-11-25 18:17 ` Burton, Ross @ 2016-12-12 15:59 ` David Vincent 2016-12-20 9:51 ` [PATCH v5] " David Vincent 1 sibling, 1 reply; 19+ messages in thread From: David Vincent @ 2016-12-12 15:59 UTC (permalink / raw) To: openembedded-core, ross.burton, leonardo.sandoval.gonzalez, daniela.plascencia When using a custom RPM data directory instead of the default dir '/var/lib/rpm', the final image did not contain any of the database files in the expected location. This commit takes into account the 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. Signed-off-by: David Vincent <freesilicon@gmail.com> --- meta/lib/oe/package_manager.py | 23 +++++++++++++---------- meta/lib/oe/rootfs.py | 3 ++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index e5e3c3b679..e063eeeeee 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -352,7 +352,8 @@ class RpmPkgsList(PkgsList): super(RpmPkgsList, self).__init__(d, rootfs_dir) self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir', True) + self.image_rpmlib = os.path.join(self.rootfs_dir, self.rpm_libdir[1:]) self.ml_prefix_list, self.ml_os_list = \ RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var) @@ -412,7 +413,7 @@ class RpmPkgsList(PkgsList): def list_pkgs(self): cmd = [self.rpm_cmd, '--root', self.rootfs_dir] - cmd.extend(['-D', '_dbpath /var/lib/rpm']) + cmd.extend(['-D', '_dbpath', self.rpm_libdir]) cmd.extend(['-qa', '--qf', '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]']) try: @@ -679,7 +680,8 @@ class RpmPM(PackageManager): self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % self.task_name) self.saved_rpmlib = self.d.expand('${T}/saved/%s' % self.task_name) - self.image_rpmlib = os.path.join(self.target_rootfs, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir', True) + self.image_rpmlib = os.path.join(self.target_rootfs, self.rpm_libdir[1:]) if not os.path.exists(self.d.expand('${T}/saved')): bb.utils.mkdirhier(self.d.expand('${T}/saved')) @@ -950,7 +952,7 @@ class RpmPM(PackageManager): open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT) # Create database so that smart doesn't complain (lazy init) - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '-qa'] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '-qa'] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: @@ -959,20 +961,19 @@ class RpmPM(PackageManager): # Import GPG key to RPM database of the target system if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1': pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True) - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '--import', pubkey_path] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '--import', pubkey_path] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: bb.fatal("Import GPG key failed. Command '%s' " "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) - # Configure smart bb.note("configuring Smart settings") bb.utils.remove(os.path.join(self.target_rootfs, 'var/lib/smart'), True) self._invoke_smart(['config', '--set', 'rpm-root=%s' % self.target_rootfs]) - self._invoke_smart(['config', '--set', 'rpm-dbpath=/var/lib/rpm']) + self._invoke_smart(['config', '--set', 'rpm-dbpath=%s' % self.rpm_libdir]) self._invoke_smart(['config', '--set', 'rpm-extra-macros._var=%s' % self.d.getVar('localstatedir', True)]) cmd = ["config", "--set", "rpm-extra-macros._tmppath=/%s/tmp" % self.install_dir_name] @@ -1232,7 +1233,7 @@ class RpmPM(PackageManager): if not with_dependencies: cmd = [self.rpm_cmd] + ["-e", "--nodeps", "--root=%s" % - self.target_rootfs, "--dbpath=/var/lib/rpm", + self.target_rootfs, "--dbpath=%s" % self.rpm_libdir, "--define='_cross_scriptlet_wrapper %s'" % self.scriptlet_wrapper, "--define='_tmppath /%s/tmp'" % self.install_dir_name] + pkgs @@ -1380,7 +1381,8 @@ class RpmPM(PackageManager): saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') + new_pkg cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg + cmd += ' --dbpath=%s ' % self.rpm_libdir + cmd += new_pkg cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}"' cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir @@ -1412,7 +1414,8 @@ class RpmPM(PackageManager): ''' def unlock_rpm_db(self): # Remove rpm db lock files - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.target_rootfs) + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, + self.rpm_libdir)) for f in rpm_db_locks: bb.utils.remove(f, True) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index a348b975c2..7cf8ce84ca 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -426,6 +426,7 @@ class RpmRootfs(Rootfs): def _create(self): pkgs_to_install = self.manifest.parse_initial_manifest() + rpm_libdir = self.d.getVar('rpmlibdir', True) rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS', True) rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS', True) @@ -473,7 +474,7 @@ class RpmRootfs(Rootfs): if self.progress_reporter: self.progress_reporter.next_stage() - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) execute_pre_post_process(self.d, rpm_post_process_cmds) -- 2.11.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v5] rootfs: Modify RPM installation 2016-12-12 15:59 ` [PATCH v4] " David Vincent @ 2016-12-20 9:51 ` David Vincent 2016-12-20 17:44 ` Burton, Ross 2016-12-22 10:23 ` [PATCH v6] " David Vincent 0 siblings, 2 replies; 19+ messages in thread From: David Vincent @ 2016-12-20 9:51 UTC (permalink / raw) To: openembedded-core, ross.burton, leonardo.sandoval.gonzalez, daniela.plascencia When using a custom RPM data directory instead of the default dir '/var/lib/rpm', the final image did not contain any of the database files in the expected location. This commit takes into account the 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. Changes since v4: - Remove boolean in d.getVar() calls. Signed-off-by: David Vincent <freesilicon@gmail.com> --- meta/lib/oe/package_manager.py | 23 +++++++++++++---------- meta/lib/oe/rootfs.py | 3 ++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index e557473999..4299220eec 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -356,7 +356,8 @@ class RpmPkgsList(PkgsList): super(RpmPkgsList, self).__init__(d, rootfs_dir) self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir') + self.image_rpmlib = os.path.join(self.rootfs_dir, self.rpm_libdir[1:]) self.ml_prefix_list, self.ml_os_list = \ RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var) @@ -416,7 +417,7 @@ class RpmPkgsList(PkgsList): def list_pkgs(self): cmd = [self.rpm_cmd, '--root', self.rootfs_dir] - cmd.extend(['-D', '_dbpath /var/lib/rpm']) + cmd.extend(['-D', '_dbpath', self.rpm_libdir]) cmd.extend(['-qa', '--qf', '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]']) try: @@ -683,7 +684,8 @@ class RpmPM(PackageManager): self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % self.task_name) self.saved_rpmlib = self.d.expand('${T}/saved/%s' % self.task_name) - self.image_rpmlib = os.path.join(self.target_rootfs, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir') + self.image_rpmlib = os.path.join(self.target_rootfs, self.rpm_libdir[1:]) if not os.path.exists(self.d.expand('${T}/saved')): bb.utils.mkdirhier(self.d.expand('${T}/saved')) @@ -954,7 +956,7 @@ class RpmPM(PackageManager): open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT) # Create database so that smart doesn't complain (lazy init) - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '-qa'] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '-qa'] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: @@ -963,20 +965,19 @@ class RpmPM(PackageManager): # Import GPG key to RPM database of the target system if self.d.getVar('RPM_SIGN_PACKAGES') == '1': pubkey_path = self.d.getVar('RPM_GPG_PUBKEY') - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '--import', pubkey_path] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '--import', pubkey_path] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: bb.fatal("Import GPG key failed. Command '%s' " "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) - # Configure smart bb.note("configuring Smart settings") bb.utils.remove(os.path.join(self.target_rootfs, 'var/lib/smart'), True) self._invoke_smart(['config', '--set', 'rpm-root=%s' % self.target_rootfs]) - self._invoke_smart(['config', '--set', 'rpm-dbpath=/var/lib/rpm']) + self._invoke_smart(['config', '--set', 'rpm-dbpath=%s' % self.rpm_libdir]) self._invoke_smart(['config', '--set', 'rpm-extra-macros._var=%s' % self.d.getVar('localstatedir')]) cmd = ["config", "--set", "rpm-extra-macros._tmppath=/%s/tmp" % self.install_dir_name] @@ -1236,7 +1237,7 @@ class RpmPM(PackageManager): if not with_dependencies: cmd = [self.rpm_cmd] + ["-e", "--nodeps", "--root=%s" % - self.target_rootfs, "--dbpath=/var/lib/rpm", + self.target_rootfs, "--dbpath=%s" % self.rpm_libdir, "--define='_cross_scriptlet_wrapper %s'" % self.scriptlet_wrapper, "--define='_tmppath /%s/tmp'" % self.install_dir_name] + pkgs @@ -1384,7 +1385,8 @@ class RpmPM(PackageManager): saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') + new_pkg cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg + cmd += ' --dbpath=%s ' % self.rpm_libdir + cmd += new_pkg cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}"' cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir @@ -1416,7 +1418,8 @@ class RpmPM(PackageManager): ''' def unlock_rpm_db(self): # Remove rpm db lock files - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.target_rootfs) + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, + self.rpm_libdir)) for f in rpm_db_locks: bb.utils.remove(f, True) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index d9a473006a..8730025816 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -429,6 +429,7 @@ class RpmRootfs(Rootfs): def _create(self): pkgs_to_install = self.manifest.parse_initial_manifest() + rpm_libdir = self.d.getVar('rpmlibdir') rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS') rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS') @@ -476,7 +477,7 @@ class RpmRootfs(Rootfs): if self.progress_reporter: self.progress_reporter.next_stage() - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) execute_pre_post_process(self.d, rpm_post_process_cmds) -- 2.11.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v5] rootfs: Modify RPM installation 2016-12-20 9:51 ` [PATCH v5] " David Vincent @ 2016-12-20 17:44 ` Burton, Ross 2016-12-22 8:22 ` David Vincent 2016-12-22 10:23 ` [PATCH v6] " David Vincent 1 sibling, 1 reply; 19+ messages in thread From: Burton, Ross @ 2016-12-20 17:44 UTC (permalink / raw) To: David Vincent; +Cc: Plascencia, Daniela, OE-core [-- Attachment #1: Type: text/plain, Size: 7184 bytes --] This breaks list_pkgs() for the RPM backend. Instead of returning a list of packages, rpm just says "%dbpath is not defined" (or words to that effect, as the log disappeared in 100 pages of errors). Ross On 20 December 2016 at 09:51, David Vincent <freesilicon@gmail.com> wrote: > When using a custom RPM data directory instead of the default dir > '/var/lib/rpm', the final image did not contain any of the database > files in the expected location. This commit takes into account the > 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. > > Changes since v4: > - Remove boolean in d.getVar() calls. > > Signed-off-by: David Vincent <freesilicon@gmail.com> > --- > meta/lib/oe/package_manager.py | 23 +++++++++++++---------- > meta/lib/oe/rootfs.py | 3 ++- > 2 files changed, 15 insertions(+), 11 deletions(-) > > diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager. > py > index e557473999..4299220eec 100644 > --- a/meta/lib/oe/package_manager.py > +++ b/meta/lib/oe/package_manager.py > @@ -356,7 +356,8 @@ class RpmPkgsList(PkgsList): > super(RpmPkgsList, self).__init__(d, rootfs_dir) > > self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") > - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') > + self.rpm_libdir = self.d.getVar('rpmlibdir') > + self.image_rpmlib = os.path.join(self.rootfs_dir, > self.rpm_libdir[1:]) > > self.ml_prefix_list, self.ml_os_list = \ > RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, > os_var) > @@ -416,7 +417,7 @@ class RpmPkgsList(PkgsList): > > def list_pkgs(self): > cmd = [self.rpm_cmd, '--root', self.rootfs_dir] > - cmd.extend(['-D', '_dbpath /var/lib/rpm']) > + cmd.extend(['-D', '_dbpath', self.rpm_libdir]) > cmd.extend(['-qa', '--qf', '[%{NAME} %{ARCH} %{VERSION} > %{PACKAGEORIGIN}\n]']) > > try: > @@ -683,7 +684,8 @@ class RpmPM(PackageManager): > self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % > self.task_name) > self.saved_rpmlib = self.d.expand('${T}/saved/%s' % > self.task_name) > - self.image_rpmlib = os.path.join(self.target_rootfs, > 'var/lib/rpm') > + self.rpm_libdir = self.d.getVar('rpmlibdir') > + self.image_rpmlib = os.path.join(self.target_rootfs, > self.rpm_libdir[1:]) > > if not os.path.exists(self.d.expand('${T}/saved')): > bb.utils.mkdirhier(self.d.expand('${T}/saved')) > @@ -954,7 +956,7 @@ class RpmPM(PackageManager): > open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT) > > # Create database so that smart doesn't complain (lazy init) > - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', > '/var/lib/rpm', '-qa'] > + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', > self.rpm_libdir, '-qa'] > try: > subprocess.check_output(cmd, stderr=subprocess.STDOUT) > except subprocess.CalledProcessError as e: > @@ -963,20 +965,19 @@ class RpmPM(PackageManager): > # Import GPG key to RPM database of the target system > if self.d.getVar('RPM_SIGN_PACKAGES') == '1': > pubkey_path = self.d.getVar('RPM_GPG_PUBKEY') > - cmd = [self.rpm_cmd, '--root', self.target_rootfs, > '--dbpath', '/var/lib/rpm', '--import', pubkey_path] > + cmd = [self.rpm_cmd, '--root', self.target_rootfs, > '--dbpath', self.rpm_libdir, '--import', pubkey_path] > try: > subprocess.check_output(cmd, stderr=subprocess.STDOUT) > except subprocess.CalledProcessError as e: > bb.fatal("Import GPG key failed. Command '%s' " > "returned %d:\n%s" % (' '.join(cmd), > e.returncode, e.output.decode("utf-8"))) > > - > # Configure smart > bb.note("configuring Smart settings") > bb.utils.remove(os.path.join(self.target_rootfs, > 'var/lib/smart'), > True) > self._invoke_smart(['config', '--set', 'rpm-root=%s' % > self.target_rootfs]) > - self._invoke_smart(['config', '--set', 'rpm-dbpath=/var/lib/rpm']) > + self._invoke_smart(['config', '--set', 'rpm-dbpath=%s' % > self.rpm_libdir]) > self._invoke_smart(['config', '--set', 'rpm-extra-macros._var=%s' > % > self.d.getVar('localstatedir')]) > cmd = ["config", "--set", "rpm-extra-macros._tmppath=/%s/tmp" % > self.install_dir_name] > @@ -1236,7 +1237,7 @@ class RpmPM(PackageManager): > > if not with_dependencies: > cmd = [self.rpm_cmd] + ["-e", "--nodeps", "--root=%s" % > - self.target_rootfs, "--dbpath=/var/lib/rpm", > + self.target_rootfs, "--dbpath=%s" % self.rpm_libdir, > "--define='_cross_scriptlet_wrapper %s'" % > self.scriptlet_wrapper, > "--define='_tmppath /%s/tmp'" % > self.install_dir_name] + pkgs > @@ -1384,7 +1385,8 @@ class RpmPM(PackageManager): > saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') > + new_pkg > > cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs > - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg > + cmd += ' --dbpath=%s ' % self.rpm_libdir > + cmd += new_pkg > cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* > scriptlet (using .*):$/ {/.*/p}"' > cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' > cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir > @@ -1416,7 +1418,8 @@ class RpmPM(PackageManager): > ''' > def unlock_rpm_db(self): > # Remove rpm db lock files > - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % > self.target_rootfs) > + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, > + self.rpm_libdir)) > for f in rpm_db_locks: > bb.utils.remove(f, True) > > diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py > index d9a473006a..8730025816 100644 > --- a/meta/lib/oe/rootfs.py > +++ b/meta/lib/oe/rootfs.py > @@ -429,6 +429,7 @@ class RpmRootfs(Rootfs): > > def _create(self): > pkgs_to_install = self.manifest.parse_initial_manifest() > + rpm_libdir = self.d.getVar('rpmlibdir') > rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS') > rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS') > > @@ -476,7 +477,7 @@ class RpmRootfs(Rootfs): > if self.progress_reporter: > self.progress_reporter.next_stage() > > - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', > '/var/lib/smart']) > + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, > '/var/lib/smart']) > > execute_pre_post_process(self.d, rpm_post_process_cmds) > > -- > 2.11.0 > > [-- Attachment #2: Type: text/html, Size: 9548 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v5] rootfs: Modify RPM installation 2016-12-20 17:44 ` Burton, Ross @ 2016-12-22 8:22 ` David Vincent 0 siblings, 0 replies; 19+ messages in thread From: David Vincent @ 2016-12-22 8:22 UTC (permalink / raw) To: Burton, Ross; +Cc: Plascencia, Daniela, OE-core On mardi 20 décembre 2016 17:44:54 CET Burton, Ross wrote: > This breaks list_pkgs() for the RPM backend. Instead of returning a list of > packages, rpm just says "%dbpath is not defined" (or words to that effect, > as the log disappeared in 100 pages of errors). > > Ross > OK, I found the bug. I also modified the rpm recipe in another layer using a bbappend, but now I must include these changes in this patch. I'll resend this ASAP with the change. Sorry for the inconvenience, David ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v6] rootfs: Modify RPM installation 2016-12-20 9:51 ` [PATCH v5] " David Vincent 2016-12-20 17:44 ` Burton, Ross @ 2016-12-22 10:23 ` David Vincent 2016-12-22 14:09 ` Burton, Ross 2017-01-12 9:08 ` [PATCH v7] " David Vincent 1 sibling, 2 replies; 19+ messages in thread From: David Vincent @ 2016-12-22 10:23 UTC (permalink / raw) To: openembedded-core, ross.burton, leonardo.sandoval.gonzalez, daniela.plascencia When using a custom RPM data directory instead of the default dir '/var/lib/rpm', the final image did not contain any of the database files in the expected location. This commit takes into account the 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. Changes since v4: - Remove boolean in d.getVar() calls. Changes since v5: - Also modify rpm recipe to build the database in the correct location and avoid errors during rootfs creation. Signed-off-by: David Vincent <freesilicon@gmail.com> --- meta/lib/oe/package_manager.py | 23 +++++++++++++---------- meta/lib/oe/rootfs.py | 3 ++- meta/recipes-devtools/rpm/rpm_5.4.16.bb | 2 ++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index e557473999..3f2878c394 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -356,7 +356,8 @@ class RpmPkgsList(PkgsList): super(RpmPkgsList, self).__init__(d, rootfs_dir) self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir') + self.image_rpmlib = os.path.join(self.rootfs_dir, self.rpm_libdir[1:]) self.ml_prefix_list, self.ml_os_list = \ RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var) @@ -416,7 +417,7 @@ class RpmPkgsList(PkgsList): def list_pkgs(self): cmd = [self.rpm_cmd, '--root', self.rootfs_dir] - cmd.extend(['-D', '_dbpath /var/lib/rpm']) + cmd.extend(['-D', '_dbpath', self.rpm_libdir]) cmd.extend(['-qa', '--qf', '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]']) try: @@ -683,7 +684,8 @@ class RpmPM(PackageManager): self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % self.task_name) self.saved_rpmlib = self.d.expand('${T}/saved/%s' % self.task_name) - self.image_rpmlib = os.path.join(self.target_rootfs, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir') + self.image_rpmlib = os.path.join(self.target_rootfs, self.rpm_libdir[1:]) if not os.path.exists(self.d.expand('${T}/saved')): bb.utils.mkdirhier(self.d.expand('${T}/saved')) @@ -954,7 +956,7 @@ class RpmPM(PackageManager): open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT) # Create database so that smart doesn't complain (lazy init) - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '-qa'] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '-qa'] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: @@ -963,20 +965,19 @@ class RpmPM(PackageManager): # Import GPG key to RPM database of the target system if self.d.getVar('RPM_SIGN_PACKAGES') == '1': pubkey_path = self.d.getVar('RPM_GPG_PUBKEY') - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '--import', pubkey_path] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '--import', pubkey_path] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: bb.fatal("Import GPG key failed. Command '%s' " "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) - # Configure smart bb.note("configuring Smart settings") bb.utils.remove(os.path.join(self.target_rootfs, 'var/lib/smart'), True) self._invoke_smart(['config', '--set', 'rpm-root=%s' % self.target_rootfs]) - self._invoke_smart(['config', '--set', 'rpm-dbpath=/var/lib/rpm']) + self._invoke_smart(['config', '--set', 'rpm-dbpath=%s' % self.rpm_libdir]) self._invoke_smart(['config', '--set', 'rpm-extra-macros._var=%s' % self.d.getVar('localstatedir')]) cmd = ["config", "--set", "rpm-extra-macros._tmppath=/%s/tmp" % self.install_dir_name] @@ -1236,7 +1237,7 @@ class RpmPM(PackageManager): if not with_dependencies: cmd = [self.rpm_cmd] + ["-e", "--nodeps", "--root=%s" % - self.target_rootfs, "--dbpath=/var/lib/rpm", + self.target_rootfs, "--dbpath=%s" % self.rpm_libdir, "--define='_cross_scriptlet_wrapper %s'" % self.scriptlet_wrapper, "--define='_tmppath /%s/tmp'" % self.install_dir_name] + pkgs @@ -1384,7 +1385,8 @@ class RpmPM(PackageManager): saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') + new_pkg cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg + cmd += ' --dbpath=%s ' % self.rpm_libdir + cmd += new_pkg cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}"' cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir @@ -1416,7 +1418,8 @@ class RpmPM(PackageManager): ''' def unlock_rpm_db(self): # Remove rpm db lock files - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.target_rootfs) + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, + self.rpm_libdir)) for f in rpm_db_locks: bb.utils.remove(f, True) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index d9a473006a..6eb05feb6c 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -429,6 +429,7 @@ class RpmRootfs(Rootfs): def _create(self): pkgs_to_install = self.manifest.parse_initial_manifest() + rpm_libdir = self.d.getVar('rpmlibdir') rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS') rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS') @@ -476,7 +477,7 @@ class RpmRootfs(Rootfs): if self.progress_reporter: self.progress_reporter.next_stage() - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) execute_pre_post_process(self.d, rpm_post_process_cmds) diff --git a/meta/recipes-devtools/rpm/rpm_5.4.16.bb b/meta/recipes-devtools/rpm/rpm_5.4.16.bb index 3df4d1ff1d..12181d89b1 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.16.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.16.bb @@ -342,6 +342,7 @@ EXTRA_OECONF += "--verbose \ --enable-build-warnings \ --enable-build-debug \ --enable-maintainer-mode \ + --with-path-database=${rpmlibdir} \ --with-path-macros=${rpm_macros} \ --with-path-lib=${libdir}/rpm \ --with-bugreport=http://bugzilla.yoctoproject.org \ @@ -384,6 +385,7 @@ FILES_${PN} = "${bindir}/rpm \ ${localstatedir}/lib/wdj \ ${bindir}/rpm.real \ ${bindir}/rpmconstant.real \ + ${rpmlibdir} \ " FILES_${PN}-common = "${bindir}/rpm2cpio \ -- 2.11.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v6] rootfs: Modify RPM installation 2016-12-22 10:23 ` [PATCH v6] " David Vincent @ 2016-12-22 14:09 ` Burton, Ross 2016-12-22 14:45 ` David Vincent 2017-01-12 9:08 ` [PATCH v7] " David Vincent 1 sibling, 1 reply; 19+ messages in thread From: Burton, Ross @ 2016-12-22 14:09 UTC (permalink / raw) To: David Vincent; +Cc: Plascencia, Daniela, OE-core [-- Attachment #1: Type: text/plain, Size: 8568 bytes --] Small problem: we always build rpm-native as we need it for some tools, but rpmlibdir is only defined in package_rpm.bbclass which doesn't have to be inherited. This leads to just --with-path-database= being passed to configure. What's the behaviour of RPM when this happens? What does it default to? If it's going to be safe (ie a sane default is used), please update the commit message to explain this. Ross On 22 December 2016 at 10:23, David Vincent <freesilicon@gmail.com> wrote: > When using a custom RPM data directory instead of the default dir > '/var/lib/rpm', the final image did not contain any of the database > files in the expected location. This commit takes into account the > 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. > > Changes since v4: > - Remove boolean in d.getVar() calls. > > Changes since v5: > - Also modify rpm recipe to build the database in the correct > location and avoid errors during rootfs creation. > > Signed-off-by: David Vincent <freesilicon@gmail.com> > --- > meta/lib/oe/package_manager.py | 23 +++++++++++++---------- > meta/lib/oe/rootfs.py | 3 ++- > meta/recipes-devtools/rpm/rpm_5.4.16.bb | 2 ++ > 3 files changed, 17 insertions(+), 11 deletions(-) > > diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager. > py > index e557473999..3f2878c394 100644 > --- a/meta/lib/oe/package_manager.py > +++ b/meta/lib/oe/package_manager.py > @@ -356,7 +356,8 @@ class RpmPkgsList(PkgsList): > super(RpmPkgsList, self).__init__(d, rootfs_dir) > > self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") > - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') > + self.rpm_libdir = self.d.getVar('rpmlibdir') > + self.image_rpmlib = os.path.join(self.rootfs_dir, > self.rpm_libdir[1:]) > > self.ml_prefix_list, self.ml_os_list = \ > RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, > os_var) > @@ -416,7 +417,7 @@ class RpmPkgsList(PkgsList): > > def list_pkgs(self): > cmd = [self.rpm_cmd, '--root', self.rootfs_dir] > - cmd.extend(['-D', '_dbpath /var/lib/rpm']) > + cmd.extend(['-D', '_dbpath', self.rpm_libdir]) > cmd.extend(['-qa', '--qf', '[%{NAME} %{ARCH} %{VERSION} > %{PACKAGEORIGIN}\n]']) > > try: > @@ -683,7 +684,8 @@ class RpmPM(PackageManager): > self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % > self.task_name) > self.saved_rpmlib = self.d.expand('${T}/saved/%s' % > self.task_name) > - self.image_rpmlib = os.path.join(self.target_rootfs, > 'var/lib/rpm') > + self.rpm_libdir = self.d.getVar('rpmlibdir') > + self.image_rpmlib = os.path.join(self.target_rootfs, > self.rpm_libdir[1:]) > > if not os.path.exists(self.d.expand('${T}/saved')): > bb.utils.mkdirhier(self.d.expand('${T}/saved')) > @@ -954,7 +956,7 @@ class RpmPM(PackageManager): > open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT) > > # Create database so that smart doesn't complain (lazy init) > - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', > '/var/lib/rpm', '-qa'] > + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', > self.rpm_libdir, '-qa'] > try: > subprocess.check_output(cmd, stderr=subprocess.STDOUT) > except subprocess.CalledProcessError as e: > @@ -963,20 +965,19 @@ class RpmPM(PackageManager): > # Import GPG key to RPM database of the target system > if self.d.getVar('RPM_SIGN_PACKAGES') == '1': > pubkey_path = self.d.getVar('RPM_GPG_PUBKEY') > - cmd = [self.rpm_cmd, '--root', self.target_rootfs, > '--dbpath', '/var/lib/rpm', '--import', pubkey_path] > + cmd = [self.rpm_cmd, '--root', self.target_rootfs, > '--dbpath', self.rpm_libdir, '--import', pubkey_path] > try: > subprocess.check_output(cmd, stderr=subprocess.STDOUT) > except subprocess.CalledProcessError as e: > bb.fatal("Import GPG key failed. Command '%s' " > "returned %d:\n%s" % (' '.join(cmd), > e.returncode, e.output.decode("utf-8"))) > > - > # Configure smart > bb.note("configuring Smart settings") > bb.utils.remove(os.path.join(self.target_rootfs, > 'var/lib/smart'), > True) > self._invoke_smart(['config', '--set', 'rpm-root=%s' % > self.target_rootfs]) > - self._invoke_smart(['config', '--set', 'rpm-dbpath=/var/lib/rpm']) > + self._invoke_smart(['config', '--set', 'rpm-dbpath=%s' % > self.rpm_libdir]) > self._invoke_smart(['config', '--set', 'rpm-extra-macros._var=%s' > % > self.d.getVar('localstatedir')]) > cmd = ["config", "--set", "rpm-extra-macros._tmppath=/%s/tmp" % > self.install_dir_name] > @@ -1236,7 +1237,7 @@ class RpmPM(PackageManager): > > if not with_dependencies: > cmd = [self.rpm_cmd] + ["-e", "--nodeps", "--root=%s" % > - self.target_rootfs, "--dbpath=/var/lib/rpm", > + self.target_rootfs, "--dbpath=%s" % self.rpm_libdir, > "--define='_cross_scriptlet_wrapper %s'" % > self.scriptlet_wrapper, > "--define='_tmppath /%s/tmp'" % > self.install_dir_name] + pkgs > @@ -1384,7 +1385,8 @@ class RpmPM(PackageManager): > saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') > + new_pkg > > cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs > - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg > + cmd += ' --dbpath=%s ' % self.rpm_libdir > + cmd += new_pkg > cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* > scriptlet (using .*):$/ {/.*/p}"' > cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' > cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir > @@ -1416,7 +1418,8 @@ class RpmPM(PackageManager): > ''' > def unlock_rpm_db(self): > # Remove rpm db lock files > - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % > self.target_rootfs) > + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, > + self.rpm_libdir)) > for f in rpm_db_locks: > bb.utils.remove(f, True) > > diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py > index d9a473006a..6eb05feb6c 100644 > --- a/meta/lib/oe/rootfs.py > +++ b/meta/lib/oe/rootfs.py > @@ -429,6 +429,7 @@ class RpmRootfs(Rootfs): > > def _create(self): > pkgs_to_install = self.manifest.parse_initial_manifest() > + rpm_libdir = self.d.getVar('rpmlibdir') > rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS') > rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS') > > @@ -476,7 +477,7 @@ class RpmRootfs(Rootfs): > if self.progress_reporter: > self.progress_reporter.next_stage() > > - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', > '/var/lib/smart']) > + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, > '/var/lib/smart']) > > execute_pre_post_process(self.d, rpm_post_process_cmds) > > diff --git a/meta/recipes-devtools/rpm/rpm_5.4.16.bb > b/meta/recipes-devtools/rpm/rpm_5.4.16.bb > index 3df4d1ff1d..12181d89b1 100644 > --- a/meta/recipes-devtools/rpm/rpm_5.4.16.bb > +++ b/meta/recipes-devtools/rpm/rpm_5.4.16.bb > @@ -342,6 +342,7 @@ EXTRA_OECONF += "--verbose \ > --enable-build-warnings \ > --enable-build-debug \ > --enable-maintainer-mode \ > + --with-path-database=${rpmlibdir} \ > --with-path-macros=${rpm_macros} \ > --with-path-lib=${libdir}/rpm \ > --with-bugreport=http://bugzilla.yoctoproject.org \ > @@ -384,6 +385,7 @@ FILES_${PN} = "${bindir}/rpm \ > ${localstatedir}/lib/wdj \ > ${bindir}/rpm.real \ > ${bindir}/rpmconstant.real \ > + ${rpmlibdir} \ > " > > FILES_${PN}-common = "${bindir}/rpm2cpio \ > -- > 2.11.0 > > [-- Attachment #2: Type: text/html, Size: 11378 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v6] rootfs: Modify RPM installation 2016-12-22 14:09 ` Burton, Ross @ 2016-12-22 14:45 ` David Vincent 2017-01-06 11:37 ` David Vincent 2017-01-06 14:46 ` Burton, Ross 0 siblings, 2 replies; 19+ messages in thread From: David Vincent @ 2016-12-22 14:45 UTC (permalink / raw) To: Burton, Ross; +Cc: Plascencia, Daniela, OE-core On jeudi 22 décembre 2016 14:09:32 CET Burton, Ross wrote: > Small problem: we always build rpm-native as we need it for some tools, but > rpmlibdir is only defined in package_rpm.bbclass which doesn't have to be > inherited. I didn't know that rpm-native was built in any case, rpm being selected as package manager or not. > This leads to just --with-path-database= being passed to configure. What's > the behaviour of RPM when this happens? What does it default to? If it's > going to be safe (ie a sane default is used), please update the commit > message to explain this. Indeed, this can lead to undefined behavior. I can propose some solutions but which one would you find better : - Setting a weak assignment for rpmlibdir inside rpm recipe - Setting a default assignment for rpmlibdir_class-native inside rpm recipe - Another option I didn't think of > Ross > David ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v6] rootfs: Modify RPM installation 2016-12-22 14:45 ` David Vincent @ 2017-01-06 11:37 ` David Vincent 2017-01-06 14:46 ` Burton, Ross 1 sibling, 0 replies; 19+ messages in thread From: David Vincent @ 2017-01-06 11:37 UTC (permalink / raw) To: Burton, Ross; +Cc: Plascencia, Daniela, OE-core On jeudi 22 décembre 2016 15:45:34 CET David Vincent wrote: > On jeudi 22 décembre 2016 14:09:32 CET Burton, Ross wrote: > > Small problem: we always build rpm-native as we need it for some tools, > > but > > rpmlibdir is only defined in package_rpm.bbclass which doesn't have to be > > inherited. > > I didn't know that rpm-native was built in any case, rpm being selected as > package manager or not. > > > This leads to just --with-path-database= being passed to configure. > > What's > > the behaviour of RPM when this happens? What does it default to? If it's > > going to be safe (ie a sane default is used), please update the commit > > message to explain this. > > Indeed, this can lead to undefined behavior. I can propose some solutions > but which one would you find better : > - Setting a weak assignment for rpmlibdir inside rpm recipe > - Setting a default assignment for rpmlibdir_class-native inside rpm recipe > - Another option I didn't think of Any news on that ? > > > Ross > David ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v6] rootfs: Modify RPM installation 2016-12-22 14:45 ` David Vincent 2017-01-06 11:37 ` David Vincent @ 2017-01-06 14:46 ` Burton, Ross 1 sibling, 0 replies; 19+ messages in thread From: Burton, Ross @ 2017-01-06 14:46 UTC (permalink / raw) To: David Vincent; +Cc: Plascencia, Daniela, OE-core [-- Attachment #1: Type: text/plain, Size: 404 bytes --] On 22 December 2016 at 14:45, David Vincent <freesilicon@gmail.com> wrote: > - Another option I didn't think of > One other option would be to only pass --with-path-database in target builds, as the default is fine (read: will never be used) for native. I just looked at the configure.ac and it appears that for native builds with this patch the database path is "yes". :) Ross [-- Attachment #2: Type: text/html, Size: 925 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v7] rootfs: Modify RPM installation 2016-12-22 10:23 ` [PATCH v6] " David Vincent 2016-12-22 14:09 ` Burton, Ross @ 2017-01-12 9:08 ` David Vincent 2017-01-16 17:39 ` Burton, Ross 1 sibling, 1 reply; 19+ messages in thread From: David Vincent @ 2017-01-12 9:08 UTC (permalink / raw) To: openembedded-core, ross.burton, leonardo.sandoval.gonzalez, daniela.plascencia When using a custom RPM data directory instead of the default dir '/var/lib/rpm', the final image did not contain any of the database files in the expected location. This commit takes into account the 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. Changes since v4: - Remove boolean in d.getVar() calls. Changes since v5: - Also modify rpm recipe to build the database in the correct location and avoid errors during rootfs creation. Changes since v6: - Activate database path only for target builds to avoid host build errors (Thanks to Ross Burton) Signed-off-by: David Vincent <freesilicon@gmail.com> --- meta/lib/oe/package_manager.py | 23 +++++++++++++---------- meta/lib/oe/rootfs.py | 3 ++- meta/recipes-devtools/rpm/rpm_5.4.16.bb | 2 ++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index a8644cc1c0..cfca178095 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -354,7 +354,8 @@ class RpmPkgsList(PkgsList): super(RpmPkgsList, self).__init__(d, rootfs_dir) self.rpm_cmd = bb.utils.which(os.getenv('PATH'), "rpm") - self.image_rpmlib = os.path.join(self.rootfs_dir, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir') + self.image_rpmlib = os.path.join(self.rootfs_dir, self.rpm_libdir[1:]) self.ml_prefix_list, self.ml_os_list = \ RpmIndexer(d, rootfs_dir).get_ml_prefix_and_os_list(arch_var, os_var) @@ -414,7 +415,7 @@ class RpmPkgsList(PkgsList): def list_pkgs(self): cmd = [self.rpm_cmd, '--root', self.rootfs_dir] - cmd.extend(['-D', '_dbpath /var/lib/rpm']) + cmd.extend(['-D', '_dbpath', self.rpm_libdir]) cmd.extend(['-qa', '--qf', '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]']) try: @@ -681,7 +682,8 @@ class RpmPM(PackageManager): self.solution_manifest = self.d.expand('${T}/saved/%s_solution' % self.task_name) self.saved_rpmlib = self.d.expand('${T}/saved/%s' % self.task_name) - self.image_rpmlib = os.path.join(self.target_rootfs, 'var/lib/rpm') + self.rpm_libdir = self.d.getVar('rpmlibdir') + self.image_rpmlib = os.path.join(self.target_rootfs, self.rpm_libdir[1:]) if not os.path.exists(self.d.expand('${T}/saved')): bb.utils.mkdirhier(self.d.expand('${T}/saved')) @@ -952,7 +954,7 @@ class RpmPM(PackageManager): open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT) # Create database so that smart doesn't complain (lazy init) - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '-qa'] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '-qa'] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: @@ -961,20 +963,19 @@ class RpmPM(PackageManager): # Import GPG key to RPM database of the target system if self.d.getVar('RPM_SIGN_PACKAGES') == '1': pubkey_path = self.d.getVar('RPM_GPG_PUBKEY') - cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', '/var/lib/rpm', '--import', pubkey_path] + cmd = [self.rpm_cmd, '--root', self.target_rootfs, '--dbpath', self.rpm_libdir, '--import', pubkey_path] try: subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: bb.fatal("Import GPG key failed. Command '%s' " "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8"))) - # Configure smart bb.note("configuring Smart settings") bb.utils.remove(os.path.join(self.target_rootfs, 'var/lib/smart'), True) self._invoke_smart(['config', '--set', 'rpm-root=%s' % self.target_rootfs]) - self._invoke_smart(['config', '--set', 'rpm-dbpath=/var/lib/rpm']) + self._invoke_smart(['config', '--set', 'rpm-dbpath=%s' % self.rpm_libdir]) self._invoke_smart(['config', '--set', 'rpm-extra-macros._var=%s' % self.d.getVar('localstatedir')]) cmd = ["config", "--set", "rpm-extra-macros._tmppath=/%s/tmp" % self.install_dir_name] @@ -1234,7 +1235,7 @@ class RpmPM(PackageManager): if not with_dependencies: cmd = [self.rpm_cmd] + ["-e", "--nodeps", "--root=%s" % - self.target_rootfs, "--dbpath=/var/lib/rpm", + self.target_rootfs, "--dbpath=%s" % self.rpm_libdir, "--define='_cross_scriptlet_wrapper %s'" % self.scriptlet_wrapper, "--define='_tmppath /%s/tmp'" % self.install_dir_name] + pkgs @@ -1382,7 +1383,8 @@ class RpmPM(PackageManager): saved_dir = self.target_rootfs + self.d.expand('${sysconfdir}/rpm-postinsts/') + new_pkg cmd = self.rpm_cmd + ' -q --scripts --root ' + self.target_rootfs - cmd += ' --dbpath=/var/lib/rpm ' + new_pkg + cmd += ' --dbpath=%s ' % self.rpm_libdir + cmd += new_pkg cmd += ' | sed -n -e "/^postinstall scriptlet (using .*):$/,/^.* scriptlet (using .*):$/ {/.*/p}"' cmd += ' | sed -e "/postinstall scriptlet (using \(.*\)):$/d"' cmd += ' -e "/^.* scriptlet (using .*):$/d" > %s' % saved_dir @@ -1414,7 +1416,8 @@ class RpmPM(PackageManager): ''' def unlock_rpm_db(self): # Remove rpm db lock files - rpm_db_locks = glob.glob('%s/var/lib/rpm/__db.*' % self.target_rootfs) + rpm_db_locks = glob.glob('%s%s/__db.*' % (self.target_rootfs, + self.rpm_libdir)) for f in rpm_db_locks: bb.utils.remove(f, True) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index d9a473006a..6eb05feb6c 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -429,6 +429,7 @@ class RpmRootfs(Rootfs): def _create(self): pkgs_to_install = self.manifest.parse_initial_manifest() + rpm_libdir = self.d.getVar('rpmlibdir') rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS') rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS') @@ -476,7 +477,7 @@ class RpmRootfs(Rootfs): if self.progress_reporter: self.progress_reporter.next_stage() - self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) + self._setup_dbg_rootfs(['/etc/rpm', rpm_libdir, '/var/lib/smart']) execute_pre_post_process(self.d, rpm_post_process_cmds) diff --git a/meta/recipes-devtools/rpm/rpm_5.4.16.bb b/meta/recipes-devtools/rpm/rpm_5.4.16.bb index 3df4d1ff1d..23e598dec9 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.16.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.16.bb @@ -306,6 +306,7 @@ PACKAGECONFIG[tcl] = "--with-tcl,--without-tcl,tcl," PACKAGECONFIG[augeas] = "--with-augeas,--without-augeas,augeas," +EXTRA_OECONF_append_class-target = "--with-path-database=${rpmlibdir}" EXTRA_OECONF += "--verbose \ --sysconfdir=${sysconfdir} \ --with-file \ @@ -385,6 +386,7 @@ FILES_${PN} = "${bindir}/rpm \ ${bindir}/rpm.real \ ${bindir}/rpmconstant.real \ " +FILES_${PN}_append_class-target = "${rpmlibdir}" FILES_${PN}-common = "${bindir}/rpm2cpio \ ${bindir}/rpm2cpio.real \ -- 2.11.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v7] rootfs: Modify RPM installation 2017-01-12 9:08 ` [PATCH v7] " David Vincent @ 2017-01-16 17:39 ` Burton, Ross 2017-01-17 9:00 ` David Vincent 0 siblings, 1 reply; 19+ messages in thread From: Burton, Ross @ 2017-01-16 17:39 UTC (permalink / raw) To: David Vincent; +Cc: Plascencia, Daniela, OE-core [-- Attachment #1: Type: text/plain, Size: 1627 bytes --] On 12 January 2017 at 09:08, David Vincent <freesilicon@gmail.com> wrote: > When using a custom RPM data directory instead of the default dir > '/var/lib/rpm', the final image did not contain any of the database > files in the expected location. This commit takes into account the > 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. > Something changed and this is now breaking rootfs generation for me: File: 'exec_python_func() autogenerated', lineno: 2, function: <module> 0001: *** 0002:license_create_manifest(d) 0003: File: '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-x86-64/build/meta/classes/license.bbclass', lineno: 48, function: license_create_manifest 0044: pkg_dic = {} 0045: for pkg in sorted(image_list_installed_packages(d)): 0046: pkg_info = os.path.join(d.getVar('PKGDATA_DIR'), 0047: 'runtime-reverse', pkg) *** 0048: pkg_name = os.path.basename(os.readlink(pkg_info)) 0049: 0050: pkg_dic[pkg_name] = oe.packagedata.read_pkgdatafile(pkg_info) 0051: if not "LICENSE" in pkg_dic[pkg_name].keys(): 0052: pkg_lic_name = "LICENSE_" + pkg_name Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-x86-64/build/build/tmp/sysroots/qemux86-64/pkgdata/runtime-reverse/error:' Note how pkg is set to "error:". Clearly the error handling in image_list_installed_packages() needs work, but I can make this problem appear/disappear by adding/removing this patch. Ross [-- Attachment #2: Type: text/html, Size: 2298 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v7] rootfs: Modify RPM installation 2017-01-16 17:39 ` Burton, Ross @ 2017-01-17 9:00 ` David Vincent 0 siblings, 0 replies; 19+ messages in thread From: David Vincent @ 2017-01-17 9:00 UTC (permalink / raw) To: Burton, Ross; +Cc: Plascencia, Daniela, OE-core On lundi 16 janvier 2017 17:39:45 CET Burton, Ross wrote: > On 12 January 2017 at 09:08, David Vincent <freesilicon@gmail.com> wrote: > > When using a custom RPM data directory instead of the default dir > > '/var/lib/rpm', the final image did not contain any of the database > > files in the expected location. This commit takes into account the > > 'rpmlibdir' variable set into 'rootfs_rpm.bbclass'. > > Something changed and this is now breaking rootfs generation for me: It becomes weirder and weirder... > > File: 'exec_python_func() autogenerated', lineno: 2, function: <module> > 0001: > *** 0002:license_create_manifest(d) > 0003: > File: > '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-x86-64/build/meta/cl > asses/license.bbclass', lineno: 48, function: license_create_manifest > 0044: pkg_dic = {} > 0045: for pkg in sorted(image_list_installed_packages(d)): > 0046: pkg_info = os.path.join(d.getVar('PKGDATA_DIR'), > 0047: 'runtime-reverse', pkg) > *** 0048: pkg_name = os.path.basename(os.readlink(pkg_info)) > 0049: > 0050: pkg_dic[pkg_name] = > oe.packagedata.read_pkgdatafile(pkg_info) > 0051: if not "LICENSE" in pkg_dic[pkg_name].keys(): > 0052: pkg_lic_name = "LICENSE_" + pkg_name > Exception: FileNotFoundError: [Errno 2] No such file or directory: > '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-x86-64/build/build/t > mp/sysroots/qemux86-64/pkgdata/runtime-reverse/error:' > > Note how pkg is set to "error:". I found that the RpmPkgsList is also using 'rpmlibdir'. Could it be possible that it must be defined for class-native and class-target ? Therefore, maybe setting a default value in each case could solve the problem ? I'm using this patch on a daily basis and I don't have problems but, in my case, I set a default value for rpmlibdir at the distro level which I override for class-target in some of my BSP layers. I can fall back to v6 and set a default value using a weak assignment for rpmlibdir. > > Clearly the error handling in image_list_installed_packages() needs work, > but I can make this problem appear/disappear by adding/removing this patch. > > Ross David ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2017-01-17 9:00 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-07-08 7:57 [PATCH][jethro] rootfs: Modify RPM installation David Vincent 2016-07-21 19:50 ` Burton, Ross 2016-09-30 20:03 ` Leonardo Sandoval 2016-11-24 10:49 ` [PATCH v3] " David Vincent 2016-11-25 18:17 ` Burton, Ross 2016-11-25 19:09 ` Mark Hatle 2016-11-28 10:59 ` David Vincent 2016-12-12 15:59 ` [PATCH v4] " David Vincent 2016-12-20 9:51 ` [PATCH v5] " David Vincent 2016-12-20 17:44 ` Burton, Ross 2016-12-22 8:22 ` David Vincent 2016-12-22 10:23 ` [PATCH v6] " David Vincent 2016-12-22 14:09 ` Burton, Ross 2016-12-22 14:45 ` David Vincent 2017-01-06 11:37 ` David Vincent 2017-01-06 14:46 ` Burton, Ross 2017-01-12 9:08 ` [PATCH v7] " David Vincent 2017-01-16 17:39 ` Burton, Ross 2017-01-17 9:00 ` David Vincent
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.