From patchwork Sun Jan 6 08:43:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] apt-native: fix the creation of apt.conf.sample Date: Sun, 06 Jan 2013 08:43:34 -0000 From: Hongxu Jia X-Patchwork-Id: 42035 Message-Id: <3dad51b86a16d1bc44a8ac69c8a0efac870768e1.1357461730.git.hongxu.jia@windriver.com> To: 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] Signed-off-by: Hongxu Jia --- meta/recipes-devtools/apt/apt-native.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meta/recipes-devtools/apt/apt-native.inc b/meta/recipes-devtools/apt/apt-native.inc index ab89f71..0de159a 100644 --- a/meta/recipes-devtools/apt/apt-native.inc +++ b/meta/recipes-devtools/apt/apt-native.inc @@ -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 () {