diff options
| -rw-r--r-- | meta/classes/package.bbclass | 79 | ||||
| -rw-r--r-- | meta/classes/package_deb.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/package_ipk.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/package_rpm.bbclass | 2 |
4 files changed, 64 insertions, 21 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index f6c92cb620..9f64ed77e5 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
| @@ -239,6 +239,66 @@ python () { | |||
| 239 | d.appendVarFlag('do_package', 'deptask', " do_packagedata") | 239 | d.appendVarFlag('do_package', 'deptask', " do_packagedata") |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | # Get a list of files from file vars by searching files under current working directory | ||
| 243 | # The list contains symlinks, directories and normal files. | ||
| 244 | def files_from_filevars(filevars): | ||
| 245 | import os,glob | ||
| 246 | cpath = oe.cachedpath.CachedPath() | ||
| 247 | files = [] | ||
| 248 | for f in filevars: | ||
| 249 | if os.path.isabs(f): | ||
| 250 | f = '.' + f | ||
| 251 | if not f.startswith("./"): | ||
| 252 | f = './' + f | ||
| 253 | globbed = glob.glob(f) | ||
| 254 | if globbed: | ||
| 255 | if [ f ] != globbed: | ||
| 256 | files += globbed | ||
| 257 | continue | ||
| 258 | files.append(f) | ||
| 259 | |||
| 260 | for f in files: | ||
| 261 | if not cpath.islink(f): | ||
| 262 | if cpath.isdir(f): | ||
| 263 | newfiles = [ os.path.join(f,x) for x in os.listdir(f) ] | ||
| 264 | if newfiles: | ||
| 265 | files += newfiles | ||
| 266 | |||
| 267 | return files | ||
| 268 | |||
| 269 | # Called in package_<rpm,ipk,deb>.bbclass to get the correct list of configuration files | ||
| 270 | def get_conffiles(pkg, d): | ||
| 271 | pkgdest = d.getVar('PKGDEST', True) | ||
| 272 | root = os.path.join(pkgdest, pkg) | ||
| 273 | cwd = os.getcwd() | ||
| 274 | os.chdir(root) | ||
| 275 | |||
| 276 | conffiles = d.getVar('CONFFILES_%s' % pkg, True); | ||
| 277 | if conffiles == None: | ||
| 278 | conffiles = d.getVar('CONFFILES', True) | ||
| 279 | if conffiles == None: | ||
| 280 | conffiles = "" | ||
| 281 | conffiles = conffiles.split() | ||
| 282 | conf_orig_list = files_from_filevars(conffiles) | ||
| 283 | |||
| 284 | # Remove links and directories from conf_orig_list to get conf_list which only contains normal files | ||
| 285 | conf_list = [] | ||
| 286 | for f in conf_orig_list: | ||
| 287 | if os.path.isdir(f): | ||
| 288 | continue | ||
| 289 | if os.path.islink(f): | ||
| 290 | continue | ||
| 291 | if not os.path.exists(f): | ||
| 292 | continue | ||
| 293 | conf_list.append(f) | ||
| 294 | |||
| 295 | # Remove the leading './' | ||
| 296 | for i in range(0, len(conf_list)): | ||
| 297 | conf_list[i] = conf_list[i][1:] | ||
| 298 | |||
| 299 | os.chdir(cwd) | ||
| 300 | return conf_list | ||
| 301 | |||
| 242 | def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d): | 302 | def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d): |
| 243 | # Function to split a single file into two components, one is the stripped | 303 | # Function to split a single file into two components, one is the stripped |
| 244 | # target system binary, the other contains any debugging information. The | 304 | # target system binary, the other contains any debugging information. The |
| @@ -1009,26 +1069,9 @@ python populate_packages () { | |||
| 1009 | filesvar.replace("//", "/") | 1069 | filesvar.replace("//", "/") |
| 1010 | 1070 | ||
| 1011 | origfiles = filesvar.split() | 1071 | origfiles = filesvar.split() |
| 1012 | files = [] | 1072 | files = files_from_filevars(origfiles) |
| 1013 | for file in origfiles: | ||
| 1014 | if os.path.isabs(file): | ||
| 1015 | file = '.' + file | ||
| 1016 | if not file.startswith("./"): | ||
| 1017 | file = './' + file | ||
| 1018 | globbed = glob.glob(file) | ||
| 1019 | if globbed: | ||
| 1020 | if [ file ] != globbed: | ||
| 1021 | files += globbed | ||
| 1022 | continue | ||
| 1023 | files.append(file) | ||
| 1024 | 1073 | ||
| 1025 | for file in files: | 1074 | for file in files: |
| 1026 | if not cpath.islink(file): | ||
| 1027 | if cpath.isdir(file): | ||
| 1028 | newfiles = [ os.path.join(file,x) for x in os.listdir(file) ] | ||
| 1029 | if newfiles: | ||
| 1030 | files += newfiles | ||
| 1031 | continue | ||
| 1032 | if (not cpath.islink(file)) and (not cpath.exists(file)): | 1075 | if (not cpath.islink(file)) and (not cpath.exists(file)): |
| 1033 | continue | 1076 | continue |
| 1034 | if file in seen: | 1077 | if file in seen: |
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 5b5f7e2c9a..9d7c59ba53 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass | |||
| @@ -262,7 +262,7 @@ python do_package_deb () { | |||
| 262 | scriptfile.close() | 262 | scriptfile.close() |
| 263 | os.chmod(os.path.join(controldir, script), 0755) | 263 | os.chmod(os.path.join(controldir, script), 0755) |
| 264 | 264 | ||
| 265 | conffiles_str = localdata.getVar("CONFFILES", True) | 265 | conffiles_str = ' '.join(get_conffiles(pkg, d)) |
| 266 | if conffiles_str: | 266 | if conffiles_str: |
| 267 | try: | 267 | try: |
| 268 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') | 268 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') |
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 44fd3eb29c..dba68042ac 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass | |||
| @@ -226,7 +226,7 @@ python do_package_ipk () { | |||
| 226 | scriptfile.close() | 226 | scriptfile.close() |
| 227 | os.chmod(os.path.join(controldir, script), 0755) | 227 | os.chmod(os.path.join(controldir, script), 0755) |
| 228 | 228 | ||
| 229 | conffiles_str = localdata.getVar("CONFFILES", True) | 229 | conffiles_str = ' '.join(get_conffiles(pkg, d)) |
| 230 | if conffiles_str: | 230 | if conffiles_str: |
| 231 | try: | 231 | try: |
| 232 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') | 232 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') |
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 92ddf7a30f..b87e634f1b 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
| @@ -324,7 +324,7 @@ python write_specfile () { | |||
| 324 | 324 | ||
| 325 | bb.data.update_data(localdata) | 325 | bb.data.update_data(localdata) |
| 326 | 326 | ||
| 327 | conffiles = (localdata.getVar('CONFFILES', True) or "").split() | 327 | conffiles = get_conffiles(pkg, d) |
| 328 | dirfiles = localdata.getVar('DIRFILES', True) | 328 | dirfiles = localdata.getVar('DIRFILES', True) |
| 329 | if dirfiles is not None: | 329 | if dirfiles is not None: |
| 330 | dirfiles = dirfiles.split() | 330 | dirfiles = dirfiles.split() |
