Skip to contentSkip to conversation

apt-native: fix the creation of apt.conf.sample

PATCH In review Hongxu Jia 2 participants 3 messages Jan 6, 2013 – Jan 7, 2013

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover apt-native: fix the creation of apt.conf.sample

The following changes since commit 09359e6ec00901abfe49157f1f9730117b4d284b:

freetype: update to 2.4.11 which includes fixes for CVE-2012-{5668, 5669, 5670} (2012-12-31 09:43:27 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/apt-native
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/apt-native

Hongxu Jia (1):
apt-native: fix the creation of apt.conf.sample

 meta/recipes-devtools/apt/apt-native.inc |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 1/1 apt-native: fix the creation of apt.conf.sample

The file of apt.conf.sample is kept in outdir, and outdir is assigned by "os.path.join" with the params of ${D}, ${sysconfdir} and "apt". But ${sysconfdir} is an absolute dir and that is not allowed by "os.path.join".

The following is the help on function os.path.join(a, *p):
Join two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded.

So remove "/" in ${sysconfdir} to create "apt.conf.sample" if it doesn't exist, not by the existance of prefix dir.

[YOCTO #3677]

---
 meta/recipes-devtools/apt/apt-native.inc |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
meta/recipes-devtools/apt/apt-native.inc +5 -2
index ab89f71..0de159a 100644
@@ -20,14 +20,17 @@ python do_install_config () {
 
     data = d.expand(data)
 
-    outdir = os.path.join(d.getVar('D', True), d.getVar('sysconfdir', True), 'apt')
+    # os.path.join does not allow sysconfdir to be a absolute dir
+    outdir = os.path.join(d.getVar('D', True), d.getVar('sysconfdir', True)[1:], 'apt')
     if not os.path.exists(outdir):
         os.makedirs(outdir)
-        outpath = os.path.join(outdir, 'apt.conf.sample')
 
+    outpath = os.path.join(outdir, 'apt.conf.sample')
+    if not os.path.exists(outpath):
         outfile = file(outpath, 'w')
         outfile.write(data)
         outfile.close()
+        bb.note("create %s" %outpath)
 }
 
 do_install_base () {
Signature · 1 line
1.7.10.4
#2 lore raw
Quoted 30 lines · Hongxu Jia

The file of apt.conf.sample is kept in outdir, and outdir is assigned by "os.path.join" with the params of ${D}, ${sysconfdir} and "apt". But ${sysconfdir} is an absolute dir and that is not allowed by "os.path.join".

The following is the help on function os.path.join(a, *p):
Join two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded.

So remove "/" in ${sysconfdir} to create "apt.conf.sample" if it doesn't exist, not by the existance of prefix dir.

[YOCTO #3677]

---
  meta/recipes-devtools/apt/apt-native.inc |    7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
meta/recipes-devtools/apt/apt-native.inc +2 -1
index ab89f71..0de159a 100644
@@ -20,14 +20,17 @@ python do_install_config () {
 
      data = d.expand(data)
 
-    outdir = os.path.join(d.getVar('D', True), d.getVar('sysconfdir', True), 'apt')
+    # os.path.join does not allow sysconfdir to be a absolute dir
+    outdir = os.path.join(d.getVar('D', True), d.getVar('sysconfdir', True)[1:], 'apt')

meta/recipes-devtools/apt/apt-native.inc python do_install_config () { · line 33

Quoted 10 lines
meta/recipes-devtools/apt/apt-native.inc +3 -1
      if not os.path.exists(outdir):
          os.makedirs(outdir)
-        outpath = os.path.join(outdir, 'apt.conf.sample')
 
+    outpath = os.path.join(outdir, 'apt.conf.sample')
+    if not os.path.exists(outpath):
          outfile = file(outpath, 'w')
          outfile.write(data)
          outfile.close()
+        bb.note("create %s" %outpath)

Do we need to keep this debug message around?

Sau!

Quoted 4 lines
meta/recipes-devtools/apt/apt-native.inc +0 -0
  }
 
  do_install_base () {