diff options
author | Richard Purdie <richard@openedhand.com> | 2008-05-18 21:24:41 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-05-18 21:24:41 +0000 |
commit | 7d4beb21d5a31d88f0302904016a6a012a2ceefc (patch) | |
tree | 53c22b03a313e891d0d9d33003570868c8574a12 /meta/classes | |
parent | aa3141e979326a9d931ff03bad75923faa1d9dc6 (diff) | |
download | poky-7d4beb21d5a31d88f0302904016a6a012a2ceefc.tar.gz |
packaged-staging.bbclass: Make the class compatible with opkg, ipkg and ipkg-sh and allow auto switching between whichever is available. Fix task dependencies in BB_STAMP_POLICY == whitelist case. Remove now unneeded basic dependencies.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4492 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/packaged-staging.bbclass | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/meta/classes/packaged-staging.bbclass b/meta/classes/packaged-staging.bbclass index 640d84fec5..c28d042af6 100644 --- a/meta/classes/packaged-staging.bbclass +++ b/meta/classes/packaged-staging.bbclass | |||
@@ -23,20 +23,7 @@ PSTAGE_PKG = "${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}" | |||
23 | MULTIMACH_ARCH ?= "${PACKAGE_ARCH}" | 23 | MULTIMACH_ARCH ?= "${PACKAGE_ARCH}" |
24 | 24 | ||
25 | PSTAGE_NATIVEDEPENDS = "\ | 25 | PSTAGE_NATIVEDEPENDS = "\ |
26 | pkgconfig-native \ | ||
27 | autoconf-native \ | ||
28 | automake-native \ | ||
29 | curl-native \ | ||
30 | zlib-native \ | ||
31 | libtool-native \ | ||
32 | gnu-config-native \ | ||
33 | shasum-native \ | 26 | shasum-native \ |
34 | libtool-native \ | ||
35 | automake-native \ | ||
36 | update-alternatives-cworth-native \ | ||
37 | opkg-native \ | ||
38 | m4-native \ | ||
39 | quilt-native \ | ||
40 | stagemanager-native \ | 27 | stagemanager-native \ |
41 | " | 28 | " |
42 | 29 | ||
@@ -68,27 +55,31 @@ python () { | |||
68 | # Add task dependencies if we're active, otherwise mark packaged staging | 55 | # Add task dependencies if we're active, otherwise mark packaged staging |
69 | # as inactive. | 56 | # as inactive. |
70 | if pstage_allowed: | 57 | if pstage_allowed: |
71 | deps = bb.data.getVarFlag('do_populate_staging', 'depends', d) or "" | ||
72 | deps += " stagemanager-native:do_populate_staging" | ||
73 | bb.data.setVarFlag('do_populate_staging', 'depends', deps, d) | ||
74 | |||
75 | deps = bb.data.getVarFlag('do_setscene', 'depends', d) or "" | 58 | deps = bb.data.getVarFlag('do_setscene', 'depends', d) or "" |
76 | deps += " opkg-native:do_populate_staging" | 59 | deps += " stagemanager-native:do_populate_staging" |
77 | bb.data.setVarFlag('do_setscene', 'depends', deps, d) | 60 | bb.data.setVarFlag('do_setscene', 'depends', deps, d) |
78 | 61 | ||
62 | policy = bb.data.getVar("BB_STAMP_POLICY", d, True) | ||
63 | if policy == "whitelist" or policy == "full": | ||
64 | deps = bb.data.getVarFlag('do_setscene', 'recrdeptask', d) or "" | ||
65 | deps += " do_setscene" | ||
66 | bb.data.setVarFlag('do_setscene', 'recrdeptask', deps, d) | ||
67 | |||
79 | bb.data.setVar("PSTAGING_ACTIVE", "1", d) | 68 | bb.data.setVar("PSTAGING_ACTIVE", "1", d) |
80 | else: | 69 | else: |
81 | bb.data.setVar("PSTAGING_ACTIVE", "0", d) | 70 | bb.data.setVar("PSTAGING_ACTIVE", "0", d) |
82 | } | 71 | } |
83 | 72 | ||
84 | DEPLOY_DIR_PSTAGE = "${DEPLOY_DIR}/pstage" | 73 | DEPLOY_DIR_PSTAGE = "${DEPLOY_DIR}/pstage" |
85 | PSTAGE_MACHCONFIG = "${DEPLOY_DIR_PSTAGE}/opkg.conf" | 74 | PSTAGE_MACHCONFIG = "${DEPLOY_DIR_PSTAGE}/opkg.conf" |
75 | |||
76 | PSTAGE_PKGMANAGER = "stage-manager-ipkg" | ||
86 | 77 | ||
87 | PSTAGE_BUILD_CMD = "stage-manager-ipkg-build -o 0 -g 0" | 78 | PSTAGE_BUILD_CMD = "stage-manager-ipkg-build -o 0 -g 0" |
88 | PSTAGE_INSTALL_CMD = "opkg-cl install -force-depends -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" | 79 | PSTAGE_INSTALL_CMD = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -force-depends -o ${TMPDIR} install" |
89 | PSTAGE_UPDATE_CMD = "opkg-cl update -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" | 80 | PSTAGE_UPDATE_CMD = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR} update" |
90 | PSTAGE_REMOVE_CMD = "opkg-cl remove -force-depends -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" | 81 | PSTAGE_REMOVE_CMD = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -force-depends -o ${TMPDIR} remove" |
91 | PSTAGE_LIST_CMD = "opkg-cl list_installed -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR}" | 82 | PSTAGE_LIST_CMD = "${PSTAGE_PKGMANAGER} -f ${PSTAGE_MACHCONFIG} -o ${TMPDIR} list_installed" |
92 | 83 | ||
93 | PSTAGE_TMPDIR_STAGE = "${WORKDIR}/staging-pkg" | 84 | PSTAGE_TMPDIR_STAGE = "${WORKDIR}/staging-pkg" |
94 | 85 | ||
@@ -104,10 +95,21 @@ def pstage_manualclean(srcname, destvarname, d): | |||
104 | bb.note("rm %s" % filepath) | 95 | bb.note("rm %s" % filepath) |
105 | os.system("rm %s" % filepath) | 96 | os.system("rm %s" % filepath) |
106 | 97 | ||
98 | def pstage_set_pkgmanager(d): | ||
99 | import bb | ||
100 | path = bb.data.getVar("PATH", d, 1) | ||
101 | pkgmanager = bb.which(path, 'opkg-cl') | ||
102 | if pkgmanager == "": | ||
103 | pkgmanager = bb.which(path, 'ipkg-cl') | ||
104 | if pkgmanager != "": | ||
105 | bb.data.setVar("PSTAGE_PKGMANAGER", pkgmanager, d) | ||
106 | |||
107 | |||
107 | def pstage_cleanpackage(pkgname, d): | 108 | def pstage_cleanpackage(pkgname, d): |
108 | import os, bb | 109 | import os, bb |
109 | 110 | ||
110 | path = bb.data.getVar("PATH", d, 1) | 111 | path = bb.data.getVar("PATH", d, 1) |
112 | pstage_set_pkgmanager(d) | ||
111 | list_cmd = bb.data.getVar("PSTAGE_LIST_CMD", d, True) | 113 | list_cmd = bb.data.getVar("PSTAGE_LIST_CMD", d, True) |
112 | 114 | ||
113 | bb.note("Checking if staging package installed") | 115 | bb.note("Checking if staging package installed") |
@@ -128,16 +130,16 @@ def pstage_cleanpackage(pkgname, d): | |||
128 | bb.utils.unlockfile(lf) | 130 | bb.utils.unlockfile(lf) |
129 | 131 | ||
130 | do_clean_prepend() { | 132 | do_clean_prepend() { |
131 | """ | 133 | """ |
132 | Clear the build and temp directories | 134 | Clear the build and temp directories |
133 | """ | 135 | """ |
134 | 136 | ||
135 | removepkg = bb.data.expand("${PSTAGE_PKGPN}", d) | 137 | removepkg = bb.data.expand("${PSTAGE_PKGPN}", d) |
136 | pstage_cleanpackage(removepkg, d) | 138 | pstage_cleanpackage(removepkg, d) |
137 | 139 | ||
138 | stagepkg = bb.data.expand("${PSTAGE_PKG}", d) | 140 | stagepkg = bb.data.expand("${PSTAGE_PKG}", d) |
139 | bb.note("Removing staging package %s" % stagepkg) | 141 | bb.note("Removing staging package %s" % stagepkg) |
140 | os.system('rm -rf ' + stagepkg) | 142 | os.system('rm -rf ' + stagepkg) |
141 | } | 143 | } |
142 | 144 | ||
143 | staging_helper () { | 145 | staging_helper () { |
@@ -151,8 +153,15 @@ staging_helper () { | |||
151 | echo "arch $arch $priority" >> $conffile | 153 | echo "arch $arch $priority" >> $conffile |
152 | priority=$(expr $priority + 5) | 154 | priority=$(expr $priority + 5) |
153 | done | 155 | done |
156 | echo "dest root /" >> $conffile | ||
157 | fi | ||
158 | if [ ! -e ${TMPDIR}${layout_libdir}/opkg/info/ ]; then | ||
159 | mkdir -p ${TMPDIR}${layout_libdir}/opkg/info/ | ||
160 | fi | ||
161 | if [ ! -e ${TMPDIR}${layout_libdir}/ipkg/ ]; then | ||
162 | cd ${TMPDIR}${layout_libdir}/ | ||
163 | ln -s opkg/ ipkg | ||
154 | fi | 164 | fi |
155 | echo "dest root /" >> $conffile | ||
156 | } | 165 | } |
157 | 166 | ||
158 | PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_locales compile sizecheck install deploy package populate_staging package_write_deb package_write_ipk package_write package_stage qa_staging" | 167 | PSTAGE_TASKS_COVERED = "fetch unpack munge patch configure qa_configure rig_locales compile sizecheck install deploy package populate_staging package_write_deb package_write_ipk package_write package_stage qa_staging" |
@@ -174,13 +183,14 @@ python packagestage_scenefunc () { | |||
174 | 183 | ||
175 | if os.path.exists(stagepkg): | 184 | if os.path.exists(stagepkg): |
176 | path = bb.data.getVar("PATH", d, 1) | 185 | path = bb.data.getVar("PATH", d, 1) |
186 | pstage_set_pkgmanager(d) | ||
177 | file = bb.data.getVar("FILE", d, True) | 187 | file = bb.data.getVar("FILE", d, True) |
178 | bb.debug(2, "Packaged staging active for %s\n" % file) | 188 | bb.debug(2, "Packaged staging active for %s\n" % file) |
179 | 189 | ||
180 | # | 190 | # |
181 | # Install the staging package somewhere temporarily so we can extract the stamp files | 191 | # Install the staging package somewhere temporarily so we can extract the stamp files |
182 | # | 192 | # |
183 | cmd = bb.data.expand("opkg-cl install -force-depends -f ${PSTAGE_MACHCONFIG} -o ${WORKDIR}/tstage", d) | 193 | cmd = bb.data.expand("${PSTAGE_PKGMANAGER} -force-depends -f ${PSTAGE_MACHCONFIG} -o ${WORKDIR}/tstage install", d) |
184 | ret = os.system("PATH=\"%s\" %s %s" % (path, cmd, stagepkg)) | 194 | ret = os.system("PATH=\"%s\" %s %s" % (path, cmd, stagepkg)) |
185 | if ret != 0: | 195 | if ret != 0: |
186 | bb.fatal("Couldn't install the staging package to a temp directory") | 196 | bb.fatal("Couldn't install the staging package to a temp directory") |
@@ -396,6 +406,7 @@ python do_package_stage () { | |||
396 | bb.build.make_stamp("do_package_stage", d) | 406 | bb.build.make_stamp("do_package_stage", d) |
397 | os.system("cp -dpR %s.do_* %s/" % (stampfn, destdir)) | 407 | os.system("cp -dpR %s.do_* %s/" % (stampfn, destdir)) |
398 | 408 | ||
409 | pstage_set_pkgmanager(d) | ||
399 | bb.build.exec_func("staging_helper", d) | 410 | bb.build.exec_func("staging_helper", d) |
400 | bb.build.exec_func("staging_packager", d) | 411 | bb.build.exec_func("staging_packager", d) |
401 | lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) | 412 | lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) |
@@ -413,8 +424,3 @@ do_package_stage_all () { | |||
413 | } | 424 | } |
414 | do_package_stage_all[recrdeptask] = "do_package_stage" | 425 | do_package_stage_all[recrdeptask] = "do_package_stage" |
415 | addtask package_stage_all after do_package_stage before do_build | 426 | addtask package_stage_all after do_package_stage before do_build |
416 | |||
417 | # FIXME - needed for BB_STAMP_POLICY = "whitelist" | ||
418 | #do_setscene[recrdeptask] = "do_setscene" | ||
419 | |||
420 | |||