Skip to contentSkip to conversation

package_manager.py: fix opkg custom config path

GIT PULL In review Gaël PORTAY 2 participants 4 messages Dec 7, 2017 – Jan 12, 2018

lore
Share & tools
lore
#0 lore raw

Dear maintainers,

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).

No confidential information there.

The following changes since commit 4469acdf1d0338220f3fe2ecb5e079eea6fda375:

lib/oe/utils: remove param_bool() (2017-12-02 11:25:34 +0000)

are available in the Git repository at:

git://git.yoctoproject.org/poky-contrib gportay/fix-opkg-custom-config-path
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=gportay/fix-opkg-custom-config-path

Regards,
Gaël PORTAY (1):
package_manager.py: fix opkg custom config path

 meta/lib/oe/package_manager.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.15.0
#1 lore raw

PATCH 1/1 package_manager.py: fix opkg custom config path

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).

---
 meta/lib/oe/package_manager.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/lib/oe/package_manager.py +2 -3
index ef69b18b642..642d714b51e 100644
@@ -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("sysconfdir"),
+                    cfg_file_name = os.path.join(self.d.getVar("sysconfdir", True),
                                                  "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_BASE_URI'),
Signature · 1 line
2.15.0
#2 lore raw

Hi maintainers,

Quoted 43 lines · Gaël PORTAY

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).

---
 meta/lib/oe/package_manager.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/lib/oe/package_manager.py +2 -3
index ef69b18b642..642d714b51e 100644
@@ -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("sysconfdir"),
+                    cfg_file_name = os.path.join(self.d.getVar("sysconfdir", True),
                                                  "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_BASE_URI'),
Signature · 1 line
2.15.0

Does anybody has any comment about this patch?

Regards,
Gael

#3 lore raw
Quoted 1 line · Gaël PORTAY

Does anybody has any comment about this patch?

Please send this to oe-core list.

Alex