diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2013-01-10 15:58:10 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-10 23:49:39 +0000 |
commit | 78e5426a762b6f9b1b3b66fd8a65c67d6b94763c (patch) | |
tree | cf3b9a8f5aebdd576920d7f4c9b9d0e8691493c3 /meta/recipes-devtools/apt/apt-native.inc | |
parent | 60de86fc55ac7c6727f13a97b8705f497ab0d541 (diff) | |
download | poky-78e5426a762b6f9b1b3b66fd8a65c67d6b94763c.tar.gz |
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]
(From OE-Core rev: 95a655a853b7cd43163362d72da0c134d4c0ec85)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/apt/apt-native.inc')
-rw-r--r-- | meta/recipes-devtools/apt/apt-native.inc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/meta/recipes-devtools/apt/apt-native.inc b/meta/recipes-devtools/apt/apt-native.inc index ab89f71c4b..c7e7e420ba 100644 --- a/meta/recipes-devtools/apt/apt-native.inc +++ b/meta/recipes-devtools/apt/apt-native.inc | |||
@@ -14,17 +14,18 @@ python do_install () { | |||
14 | 14 | ||
15 | python do_install_config () { | 15 | python do_install_config () { |
16 | indir = os.path.dirname(d.getVar('FILE',1)) | 16 | indir = os.path.dirname(d.getVar('FILE',1)) |
17 | infile = file(os.path.join(indir, 'files', 'apt.conf'), 'r') | 17 | infile = file(oe.path.join(indir, 'files', 'apt.conf'), 'r') |
18 | data = infile.read() | 18 | data = infile.read() |
19 | infile.close() | 19 | infile.close() |
20 | 20 | ||
21 | data = d.expand(data) | 21 | data = d.expand(data) |
22 | 22 | ||
23 | outdir = os.path.join(d.getVar('D', True), d.getVar('sysconfdir', True), 'apt') | 23 | outdir = oe.path.join(d.getVar('D', True), d.getVar('sysconfdir', True), 'apt') |
24 | if not os.path.exists(outdir): | 24 | if not os.path.exists(outdir): |
25 | os.makedirs(outdir) | 25 | os.makedirs(outdir) |
26 | outpath = os.path.join(outdir, 'apt.conf.sample') | ||
27 | 26 | ||
27 | outpath = oe.path.join(outdir, 'apt.conf.sample') | ||
28 | if not os.path.exists(outpath): | ||
28 | outfile = file(outpath, 'w') | 29 | outfile = file(outpath, 'w') |
29 | outfile.write(data) | 30 | outfile.write(data) |
30 | outfile.close() | 31 | outfile.close() |