An even easier solution would be to use oe.path.join, which solely exists to join paths without the "interesting" absolute path quirk of os.path.join.
Ross On 8 December 2017 at 10:48, André Draszik <[email protected]> wrote: > On Thu, 2017-12-07 at 16:16 -0500, Gaël PORTAY wrote: > > The opkg custom config feature has moved to the package_manager python > > module. This feature is broken since commit 19c538f57c. > > > > The python function os.path.join joins path components. If a component > > is an absolute path, all previous components are thrown away. > > > > The sysconfdir variable is an absolute path component. It causes the > > leading target rootfs component to be removed. As a result, the > > package-manager module tries to write in the real root filesystem > > instead of the temporary work directory for the rootfs image. > > > > This fixes the issue by prepending the target rootfs component using the > > string concatenation operator when the file is opened (without using > > os.path module). > > > > Cc: Ash Charles <[email protected]> > > Signed-off-by: Gaël PORTAY <[email protected]> > > --- > > meta/lib/oe/package_manager.py | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/meta/lib/oe/package_manager.py > > b/meta/lib/oe/package_manager.py > > index 6cbb61fd84..ac29593f88 100644 > > --- a/meta/lib/oe/package_manager.py > > +++ b/meta/lib/oe/package_manager.py > > @@ -953,12 +953,11 @@ class OpkgPM(OpkgDpkgPM): > > """ > > if (self.d.getVar('FEED_DEPLOYDIR_BASE_URI') or "") != "": > > for arch in self.pkg_archs.split(): > > - cfg_file_name = os.path.join(self.target_rootfs, > > - > self.d.getVar("sysconfdi > > r"), > > + cfg_file_name = > > os.path.join(self.d.getVar("sysconfdir", True), > > The 'True' argument has been removed from all getVar() calls, please don't > re-introduce it. > > > > "opkg", > > "local-%s-feed.conf" % > > arch) > > > > - with open(cfg_file_name, "w+") as cfg_file: > > + with open(self.target_rootfs + cfg_file_name, "w+") > > as cfg_file: > > cfg_file.write("src/gz local-%s %s/%s" % > > (arch, > > self.d.getVar('FEED_DEPLOYDIR_ > BAS > > E_URI'), > > -- > > 2.15.0 > > > > Also, a simpler solution would be to simply strip the leading '/' from > sysconfdir: > > cfg_file_name = os.path.join(self.target_rootfs, > - > self.d.getVar("sysconfdir"), > + > self.d.getVar("sysconfdir").lstrip("/"), > "opkg", > "local-%s-feed.conf" % > arch) > > would be the only change needed. > > > Cheers, > Andre' > > -- > _______________________________________________ > Openembedded-core mailing list > [email protected] > http://lists.openembedded.org/mailman/listinfo/openembedded-core >
-- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
