Skip to contentSkip to conversation

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

PATCH New Hongxu Jia 1 participant 2 messages Jan 10, 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 7e1f8faad0c4b6f490c26f87acc698dd6e002b15:

perl: Remove bashism from perl-tests.inc (2013-01-07 22:37:37 +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, 4 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.10.4
author
#1 lore raw

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

1.The file of "apt.conf.sample" is in the 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 let ${D} be discarded.

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.
Use oe.path.join instead which don't have this problem.

2. Create apt.conf.sample if it doesn't exist.

[YOCTO #3677]

---
 meta/recipes-devtools/apt/apt-native.inc |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/recipes-devtools/apt/apt-native.inc +4 -3
index ab89f71..c7e7e42 100644
@@ -14,17 +14,18 @@ python do_install () {
 
 python do_install_config () {
     indir = os.path.dirname(d.getVar('FILE',1))
-    infile = file(os.path.join(indir, 'files', 'apt.conf'), 'r')
+    infile = file(oe.path.join(indir, 'files', 'apt.conf'), 'r')
     data = infile.read()
     infile.close()
 
     data = d.expand(data)
 
-    outdir = os.path.join(d.getVar('D', True), d.getVar('sysconfdir', True), 'apt')
+    outdir = oe.path.join(d.getVar('D', True), d.getVar('sysconfdir', True), 'apt')
     if not os.path.exists(outdir):
         os.makedirs(outdir)
-        outpath = os.path.join(outdir, 'apt.conf.sample')
 
+    outpath = oe.path.join(outdir, 'apt.conf.sample')
+    if not os.path.exists(outpath):
         outfile = file(outpath, 'w')
         outfile.write(data)
         outfile.close()
Signature · 1 line
1.7.10.4