diff options
| author | Chris Larson <kergoth@openedhand.com> | 2006-09-19 09:04:09 +0000 |
|---|---|---|
| committer | Chris Larson <kergoth@openedhand.com> | 2006-09-19 09:04:09 +0000 |
| commit | 4fa2d11bb1fdb58ff426114169583672fc3d65b8 (patch) | |
| tree | 0bd4952bbe057c3dc219be7e371a6a9d496c6535 /meta/classes | |
| parent | 04f695333350e31fa87b7822c17a073af73fcd84 (diff) | |
| download | poky-4fa2d11bb1fdb58ff426114169583672fc3d65b8.tar.gz | |
Sync up.. all the deb/dpkg changes which I have locally are now in svn.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@728 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/image.bbclass (renamed from meta/classes/image_ipk.bbclass) | 26 | ||||
| -rw-r--r-- | meta/classes/multimachine.bbclass | 2 | ||||
| -rw-r--r-- | meta/classes/package_deb.bbclass | 236 | ||||
| -rw-r--r-- | meta/classes/package_ipk.bbclass | 6 | ||||
| -rw-r--r-- | meta/classes/package_rpm.bbclass | 1 | ||||
| -rw-r--r-- | meta/classes/package_tar.bbclass | 1 | ||||
| -rw-r--r-- | meta/classes/rootfs_deb.bbclass | 130 | ||||
| -rw-r--r-- | meta/classes/rootfs_ipk.bbclass | 7 |
8 files changed, 379 insertions, 30 deletions
diff --git a/meta/classes/image_ipk.bbclass b/meta/classes/image.bbclass index d5f21c5809..e995265244 100644 --- a/meta/classes/image_ipk.bbclass +++ b/meta/classes/image.bbclass | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | inherit rootfs_ipk | 1 | inherit rootfs_${IMAGE_PKGTYPE} |
| 2 | 2 | ||
| 3 | # We need to recursively follow RDEPENDS and RRECOMMENDS for images | 3 | # We need to recursively follow RDEPENDS and RRECOMMENDS for images |
| 4 | BUILD_ALL_DEPS = "1" | 4 | BUILD_ALL_DEPS = "1" |
| @@ -37,12 +37,8 @@ fakeroot do_rootfs () { | |||
| 37 | makedevs -r ${IMAGE_ROOTFS} -D ${IMAGE_DEVICE_TABLE} | 37 | makedevs -r ${IMAGE_ROOTFS} -D ${IMAGE_DEVICE_TABLE} |
| 38 | fi | 38 | fi |
| 39 | 39 | ||
| 40 | real_do_rootfs | 40 | rootfs_${IMAGE_PKGTYPE}_do_rootfs |
| 41 | 41 | ||
| 42 | insert_feed_uris | ||
| 43 | |||
| 44 | rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/oe | ||
| 45 | |||
| 46 | ${IMAGE_PREPROCESS_COMMAND} | 42 | ${IMAGE_PREPROCESS_COMMAND} |
| 47 | 43 | ||
| 48 | export TOPDIR=${TOPDIR} | 44 | export TOPDIR=${TOPDIR} |
| @@ -60,21 +56,3 @@ fakeroot do_rootfs () { | |||
| 60 | 56 | ||
| 61 | ${IMAGE_POSTPROCESS_COMMAND} | 57 | ${IMAGE_POSTPROCESS_COMMAND} |
| 62 | } | 58 | } |
| 63 | |||
| 64 | insert_feed_uris () { | ||
| 65 | |||
| 66 | echo "Building feeds for [${DISTRO}].." | ||
| 67 | |||
| 68 | for line in ${FEED_URIS} | ||
| 69 | do | ||
| 70 | # strip leading and trailing spaces/tabs, then split into name and uri | ||
| 71 | line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`" | ||
| 72 | feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`" | ||
| 73 | feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`" | ||
| 74 | |||
| 75 | echo "Added $feed_name feed with URL $feed_uri" | ||
| 76 | |||
| 77 | # insert new feed-sources | ||
| 78 | echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf | ||
| 79 | done | ||
| 80 | } | ||
diff --git a/meta/classes/multimachine.bbclass b/meta/classes/multimachine.bbclass index 01dec648c3..4359d6c669 100644 --- a/meta/classes/multimachine.bbclass +++ b/meta/classes/multimachine.bbclass | |||
| @@ -14,7 +14,7 @@ python __anonymous () { | |||
| 14 | 14 | ||
| 15 | # We could look for != PACKAGE_ARCH here but how to choose | 15 | # We could look for != PACKAGE_ARCH here but how to choose |
| 16 | # if multiple differences are present? | 16 | # if multiple differences are present? |
| 17 | # Look through IPKG_ARCHS for the priority order? | 17 | # Look through PACKAGE_ARCHS for the priority order? |
| 18 | if pkgarch and pkgarch == macharch: | 18 | if pkgarch and pkgarch == macharch: |
| 19 | multiarch = macharch | 19 | multiarch = macharch |
| 20 | 20 | ||
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass new file mode 100644 index 0000000000..4526ac156c --- /dev/null +++ b/meta/classes/package_deb.bbclass | |||
| @@ -0,0 +1,236 @@ | |||
| 1 | inherit package | ||
| 2 | DEPENDS_prepend="${@["dpkg-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" | ||
| 3 | BOOTSTRAP_EXTRA_RDEPENDS += "dpkg" | ||
| 4 | DISTRO_EXTRA_RDEPENDS += "dpkg" | ||
| 5 | PACKAGEFUNCS += "do_package_deb" | ||
| 6 | IMAGE_PKGTYPE ?= "deb" | ||
| 7 | |||
| 8 | python package_deb_fn () { | ||
| 9 | from bb import data | ||
| 10 | bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) | ||
| 11 | } | ||
| 12 | |||
| 13 | addtask package_deb_install | ||
| 14 | python do_package_deb_install () { | ||
| 15 | import os, sys | ||
| 16 | pkg = bb.data.getVar('PKG', d, 1) | ||
| 17 | pkgfn = bb.data.getVar('PKGFN', d, 1) | ||
| 18 | rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) | ||
| 19 | debdir = bb.data.getVar('DEPLOY_DIR_DEB', d, 1) | ||
| 20 | stagingdir = bb.data.getVar('STAGING_DIR', d, 1) | ||
| 21 | stagingbindir = bb.data.getVar('STAGING_BINDIR', d, 1) | ||
| 22 | tmpdir = bb.data.getVar('TMPDIR', d, 1) | ||
| 23 | |||
| 24 | if None in (pkg,pkgfn,rootfs): | ||
| 25 | raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGE_ROOTFS)") | ||
| 26 | try: | ||
| 27 | if not os.exists(rootfs): | ||
| 28 | os.makedirs(rootfs) | ||
| 29 | os.chdir(rootfs) | ||
| 30 | except OSError: | ||
| 31 | raise bb.build.FuncFailed(str(sys.exc_value)) | ||
| 32 | |||
| 33 | # update packages file | ||
| 34 | (exitstatus, output) = commands.getstatusoutput('dpkg-scanpackages %s > %s/Packages' % (debdir, debdir)) | ||
| 35 | if (exitstatus != 0 ): | ||
| 36 | raise bb.build.FuncFailed(output) | ||
| 37 | |||
| 38 | f = open(os.path.join(os.path.join(tmpdir, "stamps"), "do_packages"), "w") | ||
| 39 | f.close() | ||
| 40 | |||
| 41 | # NOTE: this env stuff is racy at best, we need something more capable | ||
| 42 | # than 'commands' for command execution, which includes manipulating the | ||
| 43 | # env of the fork+execve'd processs | ||
| 44 | |||
| 45 | # Set up environment | ||
| 46 | apt_config = os.getenv('APT_CONFIG') | ||
| 47 | os.putenv('APT_CONFIG', os.path.join(stagingdir, 'etc', 'apt', 'apt.conf')) | ||
| 48 | path = os.getenv('PATH') | ||
| 49 | os.putenv('PATH', '%s:%s' % (stagingbindir, os.getenv('PATH'))) | ||
| 50 | |||
| 51 | # install package | ||
| 52 | commands.getstatusoutput('apt-get update') | ||
| 53 | commands.getstatusoutput('apt-get install -y %s' % pkgfn) | ||
| 54 | |||
| 55 | # revert environment | ||
| 56 | os.putenv('APT_CONFIG', apt_config) | ||
| 57 | os.putenv('PATH', path) | ||
| 58 | } | ||
| 59 | |||
| 60 | python do_package_deb () { | ||
| 61 | import copy # to back up env data | ||
| 62 | import sys | ||
| 63 | import re | ||
| 64 | |||
| 65 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
| 66 | if not workdir: | ||
| 67 | bb.error("WORKDIR not defined, unable to package") | ||
| 68 | return | ||
| 69 | |||
| 70 | import os # path manipulations | ||
| 71 | outdir = bb.data.getVar('DEPLOY_DIR_DEB', d, 1) | ||
| 72 | if not outdir: | ||
| 73 | bb.error("DEPLOY_DIR_DEB not defined, unable to package") | ||
| 74 | return | ||
| 75 | |||
| 76 | dvar = bb.data.getVar('D', d, 1) | ||
| 77 | if not dvar: | ||
| 78 | bb.error("D not defined, unable to package") | ||
| 79 | return | ||
| 80 | bb.mkdirhier(dvar) | ||
| 81 | |||
| 82 | packages = bb.data.getVar('PACKAGES', d, 1) | ||
| 83 | if not packages: | ||
| 84 | bb.debug(1, "PACKAGES not defined, nothing to package") | ||
| 85 | return | ||
| 86 | |||
| 87 | tmpdir = bb.data.getVar('TMPDIR', d, 1) | ||
| 88 | # Invalidate the packages file | ||
| 89 | if os.access(os.path.join(os.path.join(tmpdir, "stamps"),"do_packages"),os.R_OK): | ||
| 90 | os.unlink(os.path.join(os.path.join(tmpdir, "stamps"),"do_packages")) | ||
| 91 | |||
| 92 | if packages == []: | ||
| 93 | bb.debug(1, "No packages; nothing to do") | ||
| 94 | return | ||
| 95 | |||
| 96 | for pkg in packages.split(): | ||
| 97 | localdata = bb.data.createCopy(d) | ||
| 98 | root = "%s/install/%s" % (workdir, pkg) | ||
| 99 | |||
| 100 | bb.data.setVar('ROOT', '', localdata) | ||
| 101 | bb.data.setVar('ROOT_%s' % pkg, root, localdata) | ||
| 102 | pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) | ||
| 103 | if not pkgname: | ||
| 104 | pkgname = pkg | ||
| 105 | bb.data.setVar('PKG', pkgname, localdata) | ||
| 106 | |||
| 107 | overrides = bb.data.getVar('OVERRIDES', localdata) | ||
| 108 | if not overrides: | ||
| 109 | raise bb.build.FuncFailed('OVERRIDES not defined') | ||
| 110 | overrides = bb.data.expand(overrides, localdata) | ||
| 111 | bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) | ||
| 112 | |||
| 113 | bb.data.update_data(localdata) | ||
| 114 | basedir = os.path.join(os.path.dirname(root)) | ||
| 115 | |||
| 116 | pkgoutdir = os.path.join(outdir, bb.data.getVar('PACKAGE_ARCH', localdata, 1)) | ||
| 117 | bb.mkdirhier(pkgoutdir) | ||
| 118 | |||
| 119 | os.chdir(root) | ||
| 120 | from glob import glob | ||
| 121 | g = glob('*') | ||
| 122 | try: | ||
| 123 | del g[g.index('DEBIAN')] | ||
| 124 | del g[g.index('./DEBIAN')] | ||
| 125 | except ValueError: | ||
| 126 | pass | ||
| 127 | if not g and not bb.data.getVar('ALLOW_EMPTY', localdata): | ||
| 128 | from bb import note | ||
| 129 | note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), bb.data.getVar('PR', localdata, 1))) | ||
| 130 | continue | ||
| 131 | controldir = os.path.join(root, 'DEBIAN') | ||
| 132 | bb.mkdirhier(controldir) | ||
| 133 | try: | ||
| 134 | ctrlfile = file(os.path.join(controldir, 'control'), 'wb') | ||
| 135 | # import codecs | ||
| 136 | # ctrlfile = codecs.open("someFile", "w", "utf-8") | ||
| 137 | except OSError: | ||
| 138 | raise bb.build.FuncFailed("unable to open control file for writing.") | ||
| 139 | |||
| 140 | fields = [] | ||
| 141 | fields.append(["Version: %s-%s\n", ['PV', 'PR']]) | ||
| 142 | fields.append(["Description: %s\n", ['DESCRIPTION']]) | ||
| 143 | fields.append(["Section: %s\n", ['SECTION']]) | ||
| 144 | fields.append(["Priority: %s\n", ['PRIORITY']]) | ||
| 145 | fields.append(["Maintainer: %s\n", ['MAINTAINER']]) | ||
| 146 | fields.append(["Architecture: %s\n", ['TARGET_ARCH']]) | ||
| 147 | fields.append(["OE: %s\n", ['P']]) | ||
| 148 | fields.append(["Homepage: %s\n", ['HOMEPAGE']]) | ||
| 149 | |||
| 150 | # Package, Version, Maintainer, Description - mandatory | ||
| 151 | # Section, Priority, Essential, Architecture, Source, Depends, Pre-Depends, Recommends, Suggests, Conflicts, Replaces, Provides - Optional | ||
| 152 | |||
| 153 | |||
| 154 | def pullData(l, d): | ||
| 155 | l2 = [] | ||
| 156 | for i in l: | ||
| 157 | l2.append(bb.data.getVar(i, d, 1)) | ||
| 158 | return l2 | ||
| 159 | |||
| 160 | ctrlfile.write("Package: %s\n" % pkgname) | ||
| 161 | # check for required fields | ||
| 162 | try: | ||
| 163 | for (c, fs) in fields: | ||
| 164 | for f in fs: | ||
| 165 | if bb.data.getVar(f, localdata) is None: | ||
| 166 | raise KeyError(f) | ||
| 167 | ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)))) | ||
| 168 | except KeyError: | ||
| 169 | (type, value, traceback) = sys.exc_info() | ||
| 170 | ctrlfile.close() | ||
| 171 | raise bb.build.FuncFailed("Missing field for deb generation: %s" % value) | ||
| 172 | # more fields | ||
| 173 | |||
| 174 | bb.build.exec_func("mapping_rename_hook", localdata) | ||
| 175 | |||
| 176 | rdepends = explode_deps(unicode(bb.data.getVar("RDEPENDS", localdata, 1) or "")) | ||
| 177 | rdepends = [dep for dep in rdepends if not '*' in dep] | ||
| 178 | rrecommends = explode_deps(unicode(bb.data.getVar("RRECOMMENDS", localdata, 1) or "")) | ||
| 179 | rrecommends = [rec for rec in rrecommends if not '*' in rec] | ||
| 180 | rsuggests = (unicode(bb.data.getVar("RSUGGESTS", localdata, 1) or "")).split() | ||
| 181 | rprovides = (unicode(bb.data.getVar("RPROVIDES", localdata, 1) or "")).split() | ||
| 182 | rreplaces = (unicode(bb.data.getVar("RREPLACES", localdata, 1) or "")).split() | ||
| 183 | rconflicts = (unicode(bb.data.getVar("RCONFLICTS", localdata, 1) or "")).split() | ||
| 184 | if rdepends: | ||
| 185 | ctrlfile.write(u"Depends: %s\n" % ", ".join(rdepends)) | ||
| 186 | if rsuggests: | ||
| 187 | ctrlfile.write(u"Suggests: %s\n" % ", ".join(rsuggests)) | ||
| 188 | if rrecommends: | ||
| 189 | ctrlfile.write(u"Recommends: %s\n" % ", ".join(rrecommends)) | ||
| 190 | if rprovides: | ||
| 191 | ctrlfile.write(u"Provides: %s\n" % ", ".join(rprovides)) | ||
| 192 | if rreplaces: | ||
| 193 | ctrlfile.write(u"Replaces: %s\n" % ", ".join(rreplaces)) | ||
| 194 | if rconflicts: | ||
| 195 | ctrlfile.write(u"Conflicts: %s\n" % ", ".join(rconflicts)) | ||
| 196 | ctrlfile.close() | ||
| 197 | |||
| 198 | for script in ["preinst", "postinst", "prerm", "postrm"]: | ||
| 199 | scriptvar = bb.data.getVar('pkg_%s' % script, localdata, 1) | ||
| 200 | if not scriptvar: | ||
| 201 | continue | ||
| 202 | try: | ||
| 203 | scriptfile = file(os.path.join(controldir, script), 'w') | ||
| 204 | except OSError: | ||
| 205 | raise bb.build.FuncFailed("unable to open %s script file for writing." % script) | ||
| 206 | scriptfile.write(scriptvar) | ||
| 207 | scriptfile.close() | ||
| 208 | os.chmod(os.path.join(controldir, script), 0755) | ||
| 209 | |||
| 210 | conffiles_str = bb.data.getVar("CONFFILES", localdata, 1) | ||
| 211 | if conffiles_str: | ||
| 212 | try: | ||
| 213 | conffiles = file(os.path.join(controldir, 'conffiles'), 'w') | ||
| 214 | except OSError: | ||
| 215 | raise bb.build.FuncFailed("unable to open conffiles for writing.") | ||
| 216 | for f in conffiles_str.split(): | ||
| 217 | conffiles.write('%s\n' % f) | ||
| 218 | conffiles.close() | ||
| 219 | |||
| 220 | os.chdir(basedir) | ||
| 221 | ret = os.system("PATH=\"%s\" dpkg-deb -b %s %s" % (bb.data.getVar("PATH", localdata, 1), root, pkgoutdir)) | ||
| 222 | if ret != 0: | ||
| 223 | raise bb.build.FuncFailed("dpkg-deb execution failed") | ||
| 224 | |||
| 225 | for script in ["preinst", "postinst", "prerm", "postrm", "control" ]: | ||
| 226 | scriptfile = os.path.join(controldir, script) | ||
| 227 | try: | ||
| 228 | os.remove(scriptfile) | ||
| 229 | except OSError: | ||
| 230 | pass | ||
| 231 | try: | ||
| 232 | os.rmdir(controldir) | ||
| 233 | except OSError: | ||
| 234 | pass | ||
| 235 | del localdata | ||
| 236 | } | ||
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 9ae526bb3b..2847cee6e0 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | inherit package | 1 | inherit package |
| 2 | DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" | 2 | DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" |
| 3 | BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg ipkg-link" | 3 | BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg ipkg-link" |
| 4 | DISTRO_EXTRA_RDEPENDS += "ipkg-collateral ipkg ipkg-link" | ||
| 4 | PACKAGEFUNCS += "do_package_ipk" | 5 | PACKAGEFUNCS += "do_package_ipk" |
| 6 | IMAGE_PKGTYPE ?= "ipk" | ||
| 5 | 7 | ||
| 6 | python package_ipk_fn () { | 8 | python package_ipk_fn () { |
| 7 | from bb import data | 9 | from bb import data |
| @@ -30,9 +32,9 @@ python package_ipk_install () { | |||
| 30 | # Generate ipk.conf if it or the stamp doesnt exist | 32 | # Generate ipk.conf if it or the stamp doesnt exist |
| 31 | conffile = os.path.join(stagingdir,"ipkg.conf") | 33 | conffile = os.path.join(stagingdir,"ipkg.conf") |
| 32 | if not os.access(conffile, os.R_OK): | 34 | if not os.access(conffile, os.R_OK): |
| 33 | ipkg_archs = bb.data.getVar('IPKG_ARCHS',d) | 35 | ipkg_archs = bb.data.getVar('PACKAGE_ARCHS',d) |
| 34 | if ipkg_archs is None: | 36 | if ipkg_archs is None: |
| 35 | bb.error("IPKG_ARCHS missing") | 37 | bb.error("PACKAGE_ARCHS missing") |
| 36 | raise FuncFailed | 38 | raise FuncFailed |
| 37 | ipkg_archs = ipkg_archs.split() | 39 | ipkg_archs = ipkg_archs.split() |
| 38 | arch_priority = 1 | 40 | arch_priority = 1 |
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index c29ab5f423..ee579bed55 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
| @@ -3,6 +3,7 @@ inherit rpm_core | |||
| 3 | 3 | ||
| 4 | RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}" | 4 | RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}" |
| 5 | PACKAGEFUNCS += "do_package_rpm" | 5 | PACKAGEFUNCS += "do_package_rpm" |
| 6 | IMAGE_PKGTYPE ?= "rpm" | ||
| 6 | 7 | ||
| 7 | python write_specfile() { | 8 | python write_specfile() { |
| 8 | from bb import data, build | 9 | from bb import data, build |
diff --git a/meta/classes/package_tar.bbclass b/meta/classes/package_tar.bbclass index 359e35f113..d8c7919c3a 100644 --- a/meta/classes/package_tar.bbclass +++ b/meta/classes/package_tar.bbclass | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | inherit package | 1 | inherit package |
| 2 | 2 | ||
| 3 | PACKAGEFUNCS += "do_package_tar" | 3 | PACKAGEFUNCS += "do_package_tar" |
| 4 | IMAGE_PKGTYPE ?= "tar" | ||
| 4 | 5 | ||
| 5 | python package_tar_fn () { | 6 | python package_tar_fn () { |
| 6 | import os | 7 | import os |
diff --git a/meta/classes/rootfs_deb.bbclass b/meta/classes/rootfs_deb.bbclass new file mode 100644 index 0000000000..7712911b02 --- /dev/null +++ b/meta/classes/rootfs_deb.bbclass | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | DEPENDS_prepend = "dpkg-native apt-native fakeroot-native " | ||
| 2 | DEPENDS_append = " ${EXTRA_IMAGEDEPENDS}" | ||
| 3 | |||
| 4 | PACKAGES = "" | ||
| 5 | |||
| 6 | do_rootfs[nostamp] = 1 | ||
| 7 | do_rootfs[dirs] = ${TOPDIR} | ||
| 8 | do_build[nostamp] = 1 | ||
| 9 | |||
| 10 | ROOTFS_POSTPROCESS_COMMAND ?= "" | ||
| 11 | |||
| 12 | PID = "${@os.getpid()}" | ||
| 13 | |||
| 14 | # some default locales | ||
| 15 | IMAGE_LINGUAS ?= "de-de fr-fr en-gb" | ||
| 16 | |||
| 17 | LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}" | ||
| 18 | |||
| 19 | fakeroot rootfs_deb_do_rootfs () { | ||
| 20 | set +e | ||
| 21 | mkdir -p ${IMAGE_ROOTFS}/var/dpkg/{info,updates} | ||
| 22 | |||
| 23 | rm -f ${STAGING_DIR}/etc/apt/sources.list | ||
| 24 | rm -f ${STAGING_DIR}/etc/apt/preferences | ||
| 25 | > ${IMAGE_ROOTFS}/var/dpkg/status | ||
| 26 | > ${IMAGE_ROOTFS}/var/dpkg/available | ||
| 27 | # > ${STAGING_DIR}/var/dpkg/status | ||
| 28 | |||
| 29 | priority=1 | ||
| 30 | for arch in ${PACKAGE_ARCHS}; do | ||
| 31 | if [ ! -d ${DEPLOY_DIR_DEB}/$arch ]; then | ||
| 32 | continue; | ||
| 33 | fi | ||
| 34 | cd ${DEPLOY_DIR_DEB}/$arch | ||
| 35 | # if [ -z "${DEPLOY_KEEP_PACKAGES}" ]; then | ||
| 36 | rm -f Packages.gz Packages Packages.bz2 | ||
| 37 | # fi | ||
| 38 | apt-ftparchive packages . | bzip2 > Packages.bz2 | ||
| 39 | |||
| 40 | echo "deb file:${DEPLOY_DIR_DEB}/$arch/ ./" >> ${STAGING_DIR}/etc/apt/sources.list | ||
| 41 | (echo "Package: *" | ||
| 42 | echo "Pin origin ${DEPLOY_DIR_DEB}/$arch" | ||
| 43 | echo "Pin-Priority: $((800 + $priority))") >> ${STAGING_DIR}/etc/apt/preferences | ||
| 44 | priority=$(expr $priority + 5) | ||
| 45 | done | ||
| 46 | |||
| 47 | export APT_CONFIG="${STAGING_DIR}/etc/apt/apt.conf" | ||
| 48 | export D=${IMAGE_ROOTFS} | ||
| 49 | export OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
| 50 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
| 51 | |||
| 52 | apt-get update | ||
| 53 | |||
| 54 | _flag () { | ||
| 55 | sed -i -e "/^Package: $2\$/{n; s/Status: install ok .*/Status: install ok $1/;}" ${IMAGE_ROOTFS}/var/dpkg/status | ||
| 56 | } | ||
| 57 | _getflag () { | ||
| 58 | cat ${IMAGE_ROOTFS}/var/dpkg/status | sed -n -e "/^Package: $2\$/{n; s/Status: install ok .*/$1/; p}" | ||
| 59 | } | ||
| 60 | |||
| 61 | if [ ! -z "${LINGUAS_INSTALL}" ]; then | ||
| 62 | apt-get install glibc-localedata-i18n | ||
| 63 | if [ $? -eq 1 ]; then | ||
| 64 | exit 1 | ||
| 65 | fi | ||
| 66 | for i in ${LINGUAS_INSTALL}; do | ||
| 67 | apt-get install $i | ||
| 68 | if [ $? -eq 1 ]; then | ||
| 69 | exit 1 | ||
| 70 | fi | ||
| 71 | done | ||
| 72 | fi | ||
| 73 | |||
| 74 | if [ ! -z "${PACKAGE_INSTALL}" ]; then | ||
| 75 | for i in ${PACKAGE_INSTALL}; do | ||
| 76 | apt-get install $i | ||
| 77 | if [ $? -eq 1 ]; then | ||
| 78 | exit 1 | ||
| 79 | fi | ||
| 80 | find ${IMAGE_ROOTFS} -name \*.dpkg-new | for i in `cat`; do | ||
| 81 | mv $i `echo $i | sed -e's,\.dpkg-new$,,'` | ||
| 82 | done | ||
| 83 | done | ||
| 84 | fi | ||
| 85 | |||
| 86 | install -d ${IMAGE_ROOTFS}/${sysconfdir} | ||
| 87 | echo ${BUILDNAME} > ${IMAGE_ROOTFS}/${sysconfdir}/version | ||
| 88 | |||
| 89 | for i in ${IMAGE_ROOTFS}/var/dpkg/info/*.preinst; do | ||
| 90 | if [ -f $i ] && ! sh $i; then | ||
| 91 | _flag unpacked `basename $i .preinst` | ||
| 92 | fi | ||
| 93 | done | ||
| 94 | |||
| 95 | for i in ${IMAGE_ROOTFS}/var/dpkg/info/*.postinst; do | ||
| 96 | if [ -f $i ] && ! sh $i configure; then | ||
| 97 | _flag unpacked `basename $i .postinst` | ||
| 98 | fi | ||
| 99 | done | ||
| 100 | |||
| 101 | set -e | ||
| 102 | |||
| 103 | ${ROOTFS_POSTPROCESS_COMMAND} | ||
| 104 | } | ||
| 105 | |||
| 106 | # set '*' as the rootpassword so the images | ||
| 107 | # can decide if they want it or not | ||
| 108 | |||
| 109 | zap_root_password () { | ||
| 110 | sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new | ||
| 111 | mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd | ||
| 112 | } | ||
| 113 | |||
| 114 | create_etc_timestamp() { | ||
| 115 | date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp | ||
| 116 | } | ||
| 117 | |||
| 118 | # Turn any symbolic /sbin/init link into a file | ||
| 119 | remove_init_link () { | ||
| 120 | if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then | ||
| 121 | LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init` | ||
| 122 | rm ${IMAGE_ROOTFS}/sbin/init | ||
| 123 | cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init | ||
| 124 | fi | ||
| 125 | } | ||
| 126 | |||
| 127 | # export the zap_root_password, create_etc_timestamp and remote_init_link | ||
| 128 | EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs | ||
| 129 | |||
| 130 | addtask rootfs before do_build after do_install | ||
diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass index 8f9fddde14..e494666068 100644 --- a/meta/classes/rootfs_ipk.bbclass +++ b/meta/classes/rootfs_ipk.bbclass | |||
| @@ -36,7 +36,7 @@ real_do_rootfs () { | |||
| 36 | fi | 36 | fi |
| 37 | mkdir -p ${T} | 37 | mkdir -p ${T} |
| 38 | echo "src oe file:${DEPLOY_DIR_IPK}" > ${T}/ipkg.conf | 38 | echo "src oe file:${DEPLOY_DIR_IPK}" > ${T}/ipkg.conf |
| 39 | ipkgarchs="${IPKG_ARCHS}" | 39 | ipkgarchs="${PACKAGE_ARCHS}" |
| 40 | priority=1 | 40 | priority=1 |
| 41 | for arch in $ipkgarchs; do | 41 | for arch in $ipkgarchs; do |
| 42 | echo "arch $arch $priority" >> ${T}/ipkg.conf | 42 | echo "arch $arch $priority" >> ${T}/ipkg.conf |
| @@ -49,11 +49,12 @@ real_do_rootfs () { | |||
| 49 | ipkg-cl ${IPKG_ARGS} install $i | 49 | ipkg-cl ${IPKG_ARGS} install $i |
| 50 | done | 50 | done |
| 51 | fi | 51 | fi |
| 52 | if [ ! -z "${IPKG_INSTALL}" ]; then | 52 | if [ ! -z "${PACKAGE_INSTALL}" ]; then |
| 53 | ipkg-cl ${IPKG_ARGS} install ${IPKG_INSTALL} | 53 | ipkg-cl ${IPKG_ARGS} install ${PACKAGE_INSTALL} |
| 54 | fi | 54 | fi |
| 55 | 55 | ||
| 56 | export D=${IMAGE_ROOTFS} | 56 | export D=${IMAGE_ROOTFS} |
| 57 | export OFFLINE_ROOT=${IMAGE_ROOTFS} | ||
| 57 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} | 58 | export IPKG_OFFLINE_ROOT=${IMAGE_ROOTFS} |
| 58 | mkdir -p ${IMAGE_ROOTFS}/etc/ipkg/ | 59 | mkdir -p ${IMAGE_ROOTFS}/etc/ipkg/ |
| 59 | grep "^arch" ${T}/ipkg.conf >${IMAGE_ROOTFS}/etc/ipkg/arch.conf | 60 | grep "^arch" ${T}/ipkg.conf >${IMAGE_ROOTFS}/etc/ipkg/arch.conf |
