diff options
| -rw-r--r-- | meta/classes/package.bbclass | 51 | ||||
| -rw-r--r-- | meta/classes/prserv.bbclass | 29 |
2 files changed, 65 insertions, 15 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 2c6d30ccd8..a1b948276f 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
| @@ -7,34 +7,37 @@ | |||
| 7 | # | 7 | # |
| 8 | # There are the following default steps but PACKAGEFUNCS can be extended: | 8 | # There are the following default steps but PACKAGEFUNCS can be extended: |
| 9 | # | 9 | # |
| 10 | # a) perform_packagecopy - Copy D into PKGD | 10 | # a) package_get_auto_pr - get PRAUTO from remote PR service |
| 11 | # | 11 | # |
| 12 | # b) package_do_split_locales - Split out the locale files, updates FILES and PACKAGES | 12 | # b) perform_packagecopy - Copy D into PKGD |
| 13 | # | 13 | # |
| 14 | # c) split_and_strip_files - split the files into runtime and debug and strip them. | 14 | # c) package_do_split_locales - Split out the locale files, updates FILES and PACKAGES |
| 15 | # | ||
| 16 | # d) split_and_strip_files - split the files into runtime and debug and strip them. | ||
| 15 | # Debug files include debug info split, and associated sources that end up in -dbg packages | 17 | # Debug files include debug info split, and associated sources that end up in -dbg packages |
| 16 | # | 18 | # |
| 17 | # d) populate_packages - Split the files in PKGD into separate packages in PKGDEST/<pkgname> | 19 | # e) populate_packages - Split the files in PKGD into separate packages in PKGDEST/<pkgname> |
| 18 | # Also triggers the binary stripping code to put files in -dbg packages. | 20 | # Also triggers the binary stripping code to put files in -dbg packages. |
| 19 | # | 21 | # |
| 20 | # e) package_do_filedeps - Collect perfile run-time dependency metadata | 22 | # f) package_do_filedeps - Collect perfile run-time dependency metadata |
| 21 | # The data is stores in FILER{PROVIDES,DEPENDS}_file_pkg variables with | 23 | # The data is stores in FILER{PROVIDES,DEPENDS}_file_pkg variables with |
| 22 | # a list of affected files in FILER{PROVIDES,DEPENDS}FLIST_pkg | 24 | # a list of affected files in FILER{PROVIDES,DEPENDS}FLIST_pkg |
| 23 | # | 25 | # |
| 24 | # f) package_do_shlibs - Look at the shared libraries generated and autotmatically add any | 26 | # g) package_do_shlibs - Look at the shared libraries generated and autotmatically add any |
| 25 | # depenedencies found. Also stores the package name so anyone else using this library | 27 | # depenedencies found. Also stores the package name so anyone else using this library |
| 26 | # knows which package to depend on. | 28 | # knows which package to depend on. |
| 27 | # | 29 | # |
| 28 | # g) package_do_pkgconfig - Keep track of which packages need and provide which .pc files | 30 | # h) package_do_pkgconfig - Keep track of which packages need and provide which .pc files |
| 29 | # | 31 | # |
| 30 | # h) read_shlibdeps - Reads the stored shlibs information into the metadata | 32 | # i) read_shlibdeps - Reads the stored shlibs information into the metadata |
| 31 | # | 33 | # |
| 32 | # i) package_depchains - Adds automatic dependencies to -dbg and -dev packages | 34 | # j) package_depchains - Adds automatic dependencies to -dbg and -dev packages |
| 33 | # | 35 | # |
| 34 | # j) emit_pkgdata - saves the packaging data into PKGDATA_DIR for use in later | 36 | # k) emit_pkgdata - saves the packaging data into PKGDATA_DIR for use in later |
| 35 | # packaging steps | 37 | # packaging steps |
| 36 | 38 | ||
| 37 | inherit packagedata | 39 | inherit packagedata |
| 40 | inherit prserv | ||
| 38 | 41 | ||
| 39 | PKGD = "${WORKDIR}/package" | 42 | PKGD = "${WORKDIR}/package" |
| 40 | PKGDEST = "${WORKDIR}/packages-split" | 43 | PKGDEST = "${WORKDIR}/packages-split" |
| @@ -326,6 +329,15 @@ def runtime_mapping_rename (varname, d): | |||
| 326 | # Package functions suitable for inclusion in PACKAGEFUNCS | 329 | # Package functions suitable for inclusion in PACKAGEFUNCS |
| 327 | # | 330 | # |
| 328 | 331 | ||
| 332 | python package_get_auto_pr() { | ||
| 333 | if d.getVar('USE_PR_SERV', True): | ||
| 334 | auto_pr=prserv_get_pr_auto(d) | ||
| 335 | if auto_pr is None: | ||
| 336 | bb.fatal("Can NOT get auto PR revision from remote PR service") | ||
| 337 | return | ||
| 338 | d.setVar('PRAUTO',str(auto_pr)) | ||
| 339 | } | ||
| 340 | |||
| 329 | python package_do_split_locales() { | 341 | python package_do_split_locales() { |
| 330 | if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): | 342 | if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): |
| 331 | bb.debug(1, "package requested not splitting locales") | 343 | bb.debug(1, "package requested not splitting locales") |
| @@ -773,6 +785,8 @@ python emit_pkgdata() { | |||
| 773 | write_if_exists(sf, pkg, 'PN') | 785 | write_if_exists(sf, pkg, 'PN') |
| 774 | write_if_exists(sf, pkg, 'PV') | 786 | write_if_exists(sf, pkg, 'PV') |
| 775 | write_if_exists(sf, pkg, 'PR') | 787 | write_if_exists(sf, pkg, 'PR') |
| 788 | write_if_exists(sf, pkg, 'PKGV') | ||
| 789 | write_if_exists(sf, pkg, 'PKGR') | ||
| 776 | write_if_exists(sf, pkg, 'DESCRIPTION') | 790 | write_if_exists(sf, pkg, 'DESCRIPTION') |
| 777 | write_if_exists(sf, pkg, 'SUMMARY') | 791 | write_if_exists(sf, pkg, 'SUMMARY') |
| 778 | write_if_exists(sf, pkg, 'RDEPENDS') | 792 | write_if_exists(sf, pkg, 'RDEPENDS') |
| @@ -911,9 +925,9 @@ python package_do_shlibs() { | |||
| 911 | 925 | ||
| 912 | workdir = bb.data.getVar('WORKDIR', d, True) | 926 | workdir = bb.data.getVar('WORKDIR', d, True) |
| 913 | 927 | ||
| 914 | ver = bb.data.getVar('PV', d, True) | 928 | ver = bb.data.getVar('PKGV', d, True) |
| 915 | if not ver: | 929 | if not ver: |
| 916 | bb.error("PV not defined") | 930 | bb.error("PKGV not defined") |
| 917 | return | 931 | return |
| 918 | 932 | ||
| 919 | pkgdest = bb.data.getVar('PKGDEST', d, True) | 933 | pkgdest = bb.data.getVar('PKGDEST', d, True) |
| @@ -1025,6 +1039,12 @@ python package_do_shlibs() { | |||
| 1025 | needs_ldconfig = False | 1039 | needs_ldconfig = False |
| 1026 | bb.debug(2, "calculating shlib provides for %s" % pkg) | 1040 | bb.debug(2, "calculating shlib provides for %s" % pkg) |
| 1027 | 1041 | ||
| 1042 | pkgver = bb.data.getVar('PKGV_' + pkg, d, True) | ||
| 1043 | if not pkgver: | ||
| 1044 | pkgver = bb.data.getVar('PV_' + pkg, d, True) | ||
| 1045 | if not pkgver: | ||
| 1046 | pkgver = ver | ||
| 1047 | |||
| 1028 | needed[pkg] = [] | 1048 | needed[pkg] = [] |
| 1029 | sonames = list() | 1049 | sonames = list() |
| 1030 | renames = list() | 1050 | renames = list() |
| @@ -1048,10 +1068,10 @@ python package_do_shlibs() { | |||
| 1048 | fd = open(shlibs_file, 'w') | 1068 | fd = open(shlibs_file, 'w') |
| 1049 | for s in sonames: | 1069 | for s in sonames: |
| 1050 | fd.write(s + '\n') | 1070 | fd.write(s + '\n') |
| 1051 | shlib_provider[s] = (pkg, ver) | 1071 | shlib_provider[s] = (pkg, pkgver) |
| 1052 | fd.close() | 1072 | fd.close() |
| 1053 | fd = open(shver_file, 'w') | 1073 | fd = open(shver_file, 'w') |
| 1054 | fd.write(ver + '\n') | 1074 | fd.write(pkgver + '\n') |
| 1055 | fd.close() | 1075 | fd.close() |
| 1056 | if needs_ldconfig and use_ldconfig: | 1076 | if needs_ldconfig and use_ldconfig: |
| 1057 | bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) | 1077 | bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) |
| @@ -1348,7 +1368,8 @@ python package_depchains() { | |||
| 1348 | } | 1368 | } |
| 1349 | 1369 | ||
| 1350 | PACKAGE_PREPROCESS_FUNCS ?= "" | 1370 | PACKAGE_PREPROCESS_FUNCS ?= "" |
| 1351 | PACKAGEFUNCS ?= "perform_packagecopy \ | 1371 | PACKAGEFUNCS ?= "package_get_auto_pr \ |
| 1372 | perform_packagecopy \ | ||
| 1352 | ${PACKAGE_PREPROCESS_FUNCS} \ | 1373 | ${PACKAGE_PREPROCESS_FUNCS} \ |
| 1353 | package_do_split_locales \ | 1374 | package_do_split_locales \ |
| 1354 | split_and_strip_files \ | 1375 | split_and_strip_files \ |
diff --git a/meta/classes/prserv.bbclass b/meta/classes/prserv.bbclass new file mode 100644 index 0000000000..de46ff6897 --- /dev/null +++ b/meta/classes/prserv.bbclass | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | def prserv_make_conn(d): | ||
| 2 | import prserv.serv | ||
| 3 | host=d.getVar("PRSERV_HOST",True) | ||
| 4 | port=d.getVar("PRSERV_PORT",True) | ||
| 5 | try: | ||
| 6 | conn=None | ||
| 7 | conn=prserv.serv.PRServerConnection(host,int(port)) | ||
| 8 | d.setVar("__PRSERV_CONN",conn) | ||
| 9 | except Exception, exc: | ||
| 10 | bb.fatal("Connecting to PR service %s:%s failed: %s" % (host, port, str(exc))) | ||
| 11 | |||
| 12 | return conn | ||
| 13 | |||
| 14 | def prserv_get_pr_auto(d): | ||
| 15 | if not d.getVar('USE_PR_SERV', True): | ||
| 16 | bb.warn("Not using network based PR service") | ||
| 17 | return None | ||
| 18 | |||
| 19 | conn=d.getVar("__PRSERV_CONN", True) | ||
| 20 | if conn is None: | ||
| 21 | conn=prserv_make_conn(d) | ||
| 22 | if conn is None: | ||
| 23 | return None | ||
| 24 | |||
| 25 | version=d.getVar("PF", True) | ||
| 26 | checksum=d.getVar("BB_TASKHASH", True) | ||
| 27 | auto_rev=conn.getPR(version,checksum) | ||
| 28 | bb.debug(1,"prserv_get_pr_auto: version: %s checksum: %s result %d" % (version, checksum, auto_rev)) | ||
| 29 | return auto_rev | ||
