diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2010-08-30 16:44:31 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-02 10:01:22 +0100 |
commit | 84f7f70308eed0ac96abeb5a762e9b7765e5db91 (patch) | |
tree | d2461a37611b0e4381492423f06ea62f85b1e57c /meta/classes/package_rpm.bbclass | |
parent | 431c97533b913c671a2501a678397025849c222a (diff) | |
download | poky-84f7f70308eed0ac96abeb5a762e9b7765e5db91.tar.gz |
package_rpm: Enable per file dependencies
Switch the per file dependency handing to passing the information to
rpm via the standard 'external' dependency scripting. This ensures that
the dependencies found by RPM exactly match the ones presented by
package.bbclass.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r-- | meta/classes/package_rpm.bbclass | 81 |
1 files changed, 63 insertions, 18 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index ad5c6a13ad..36eb8e308b 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
@@ -187,24 +187,6 @@ python write_specfile () { | |||
187 | splitsection = (bb.data.getVar('SECTION', localdata, True) or "") | 187 | splitsection = (bb.data.getVar('SECTION', localdata, True) or "") |
188 | splitdescription = (bb.data.getVar('DESCRIPTION', localdata, True) or "") | 188 | splitdescription = (bb.data.getVar('DESCRIPTION', localdata, True) or "") |
189 | 189 | ||
190 | # Roll up the per file dependencies into package level dependencies | ||
191 | def roll_filerdeps(varname, d): | ||
192 | depends = bb.utils.explode_dep_versions(bb.data.getVar(varname, d, True) or "") | ||
193 | dependsflist_key = 'FILE' + varname + 'FLIST' | ||
194 | dependsflist = (bb.data.getVar(dependsflist_key, d, True) or "") | ||
195 | for dfile in dependsflist.split(): | ||
196 | key = "FILE" + varname + "_" + dfile | ||
197 | filedepends = bb.utils.explode_dep_versions(bb.data.getVar(key, d, True) or "") | ||
198 | bb.utils.extend_deps(depends, filedepends) | ||
199 | bb.data.setVar(varname, bb.utils.join_deps(depends), d) | ||
200 | |||
201 | roll_filerdeps('RDEPENDS', localdata) | ||
202 | roll_filerdeps('RRECOMMENDS', localdata) | ||
203 | roll_filerdeps('RSUGGESTS', localdata) | ||
204 | roll_filerdeps('RPROVIDES', localdata) | ||
205 | roll_filerdeps('RREPLACES', localdata) | ||
206 | roll_filerdeps('RCONFLICTS', localdata) | ||
207 | |||
208 | translate_vers('RDEPENDS', localdata) | 190 | translate_vers('RDEPENDS', localdata) |
209 | translate_vers('RRECOMMENDS', localdata) | 191 | translate_vers('RRECOMMENDS', localdata) |
210 | translate_vers('RSUGGESTS', localdata) | 192 | translate_vers('RSUGGESTS', localdata) |
@@ -457,6 +439,66 @@ python do_package_rpm () { | |||
457 | bb.data.setVar('OUTSPECFILE', outspecfile, d) | 439 | bb.data.setVar('OUTSPECFILE', outspecfile, d) |
458 | bb.build.exec_func('write_specfile', d) | 440 | bb.build.exec_func('write_specfile', d) |
459 | 441 | ||
442 | # Construct per file dependencies file | ||
443 | def dump_filerdeps(varname, outfile, d): | ||
444 | outfile.write("#!/bin/sh\n") | ||
445 | outfile.write("\n# Dependency table\n") | ||
446 | for pkg in packages.split(): | ||
447 | dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg | ||
448 | dependsflist = (bb.data.getVar(dependsflist_key, d, True) or "") | ||
449 | for dfile in dependsflist.split(): | ||
450 | key = "FILE" + varname + "_" + dfile + "_" + pkg | ||
451 | depends_dict = bb.utils.explode_dep_versions(bb.data.getVar(key, d, True) or "") | ||
452 | file = dfile.replace("@underscore@", "_") | ||
453 | file = file.replace("@closebrace@", "]") | ||
454 | file = file.replace("@openbrace@", "[") | ||
455 | file = file.replace("@tab@", "\t") | ||
456 | file = file.replace("@space@", " ") | ||
457 | file = file.replace("@at@", "@") | ||
458 | outfile.write("#" + pkgd + file + "\t") | ||
459 | for dep in depends_dict: | ||
460 | ver = depends_dict[dep] | ||
461 | if dep and ver: | ||
462 | ver = ver.replace("(","") | ||
463 | ver = ver.replace(")","") | ||
464 | outfile.write(dep + " " + ver + " ") | ||
465 | else: | ||
466 | outfile.write(dep + " ") | ||
467 | outfile.write("\n") | ||
468 | outfile.write("\n\nwhile read file_name ; do\n") | ||
469 | outfile.write("\tlength=$(echo \"#${file_name}\t\" | wc -c )\n") | ||
470 | outfile.write("\tline=$(grep \"^#${file_name}\t\" $0 | cut -c ${length}- )\n") | ||
471 | outfile.write("\tprintf \"%s\\n\" ${line}\n") | ||
472 | outfile.write("done\n") | ||
473 | |||
474 | # Poky dependencies a.k.a. RPM requires | ||
475 | outdepends = workdir + "/" + srcname + ".requires" | ||
476 | |||
477 | try: | ||
478 | from __builtin__ import file | ||
479 | dependsfile = file(outdepends, 'w') | ||
480 | except OSError: | ||
481 | raise bb.build.FuncFailed("unable to open spec file for writing.") | ||
482 | |||
483 | dump_filerdeps('RDEPENDS', dependsfile, d) | ||
484 | |||
485 | dependsfile.close() | ||
486 | os.chmod(outdepends, 0755) | ||
487 | |||
488 | # Poky / RPM Provides | ||
489 | outprovides = workdir + "/" + srcname + ".requires" | ||
490 | |||
491 | try: | ||
492 | from __builtin__ import file | ||
493 | providesfile = file(outprovides, 'w') | ||
494 | except OSError: | ||
495 | raise bb.build.FuncFailed("unable to open spec file for writing.") | ||
496 | |||
497 | dump_filerdeps('RPROVIDES', providesfile, d) | ||
498 | |||
499 | providesfile.close() | ||
500 | os.chmod(outprovides, 0755) | ||
501 | |||
460 | # Setup the rpmbuild arguments... | 502 | # Setup the rpmbuild arguments... |
461 | rpmbuild = bb.data.getVar('RPMBUILD', d, True) | 503 | rpmbuild = bb.data.getVar('RPMBUILD', d, True) |
462 | targetsys = bb.data.getVar('TARGET_SYS', d, True) | 504 | targetsys = bb.data.getVar('TARGET_SYS', d, True) |
@@ -469,6 +511,9 @@ python do_package_rpm () { | |||
469 | cmd = cmd + " --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd | 511 | cmd = cmd + " --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd |
470 | cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'" | 512 | cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'" |
471 | cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'" | 513 | cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'" |
514 | cmd = cmd + " --define '_use_internal_dependency_generator 0'" | ||
515 | cmd = cmd + " --define '__find_requires " + outdepends + "'" | ||
516 | cmd = cmd + " --define '__find_provides " + outprovides + "'" | ||
472 | cmd = cmd + " -bb " + outspecfile | 517 | cmd = cmd + " -bb " + outspecfile |
473 | 518 | ||
474 | # Build the spec file! | 519 | # Build the spec file! |