# Copyright (C) 2006 OpenedHand LTD def patch_init(d): import os, sys class NotFoundError(Exception): def __init__(self, path): self.path = path def __str__(self): return "Error: %s not found." % self.path def md5sum(fname): import md5, sys try: f = file(fname, 'rb') except IOError: raise NotFoundError(fname) m = md5.new() while True: d = f.read(8096) if not d: break m.update(d) f.close() return m.hexdigest() class CmdError(Exception): def __init__(self, exitstatus, output): self.status = exitstatus self.output = output def __str__(self): return "Command Error: exit status: %d Output:\n%s" % (self.status, self.output) def runcmd(args, dir = None): import commands if dir: olddir = os.path.abspath(os.curdir) if not os.path.exists(dir): raise NotFoundError(dir) os.chdir(dir) # print("cwd: %s -> %s" % (olddir, dir)) try: args = [ commands.mkarg(str(arg)) for arg in args ] cmd = " ".join(args) # print("cmd: %s" % cmd) (exitstatus, output) = commands.getstatusoutput(cmd) if exitstatus != 0: raise CmdError(exitstatus >> 8, output) return output finally: if dir: os.chdir(olddir) class PatchError(Exception): def __init__(self, msg): self.msg = msg def __str__(self): return "Patch Error: %s" % self.msg import bb, bb.data, bb.fetch class PatchSet(object): defaults = { "strippath": 1 } def __init__(self, dir, d): self.dir = dir self.d = d self.patches = [] self._current = None def current(self): return self._current def Clean(self): """ Clean out the patch set. Generally includes unapplying all patches and wiping out all associated metadata. """ raise NotImplementedError() def Import(self, patch, force): if not patch.get("file"): if not patch.get("remote"): raise PatchError("Patch file must be specified in patch import.") else: patch["file"] = bb.fetch.localpath(patch["remote"], self.d) for param in PatchSet.defaults: if not patch.get(param): patch[param] = PatchSet.defaults[param] if patch.get("remote"): patch["file"] = bb.data.expand(bb.fetch.localpath(patch["remote"], self.d), self.d) patch["filemd5"] = md5sum(patch["file"]) def Push(self, force): raise NotImplementedError() def Pop(self, force): raise NotImplementedError() def Refresh(self, remote = None, all = None): raise NotImplementedError() class PatchTree(PatchSet): def __init__(self, dir, d): PatchSet.__init__(self, dir, d) def Import(self, patch, force = None): """""" PatchSet.Import(self, patch, force) if self._current is not None: i = self._current + 1 else: i = 0 self.patches.insert(i, patch) def _applypatch(self, patch, force = False, reverse = False, run = True): shellcmd = ["cat", patch['file'], "|", "patch", "-p", patch['strippath']] if reverse: shellcmd.append('-R') if not run: return "sh" + "-c" + " ".join(shellcmd) if not force: shellcmd.append('--dry-run') output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) if force: return shellcmd.pop(len(shellcmd) - 1) output = runcmd(["sh", "-c", " ".join(shellcmd)], self.dir) return output def Push(self, force = False, all = False, run = True): bb.note("self._current is %s" % self._current) bb.note("patches is %s" % self.patches) if all: for i in self.patches: if self._current is not None: self._current = self._current + 1 else: self._current = 0 bb.note("applying patch %s" % i) self._applypatch(i, force) else: if self._current is not None: self._current = self._current + 1 else: self._current = 0 bb.note("applying patch %s" % self.patches[self._current]) return self._applypatch(self.patches[self._current], force) def Pop(self, force = None, all = None): if all: for i in self.patches: self._applypatch(i, force, True) else: self._applypatch(self.patches[self._current], force, True) def Clean(self): """""" class QuiltTree(PatchSet): def _runcmd(self, args, run = True): if not run: return ["quilt"] + args runcmd(["quilt"] + args, self.dir) def _quiltpatchpath(self, file): return os.path.join(self.dir, "patches", os.path.basename(file)) def __init__(self, dir, d): PatchSet.__init__(self, dir, d) self.initialized = False p = os.path.join(self.dir, 'patches') if not os.path.exists(p): os.makedirs(p) def Clean(self): try: self._runcmd(["pop", "-a", "-f"]) except Exception: pass self.initialized = True def InitFromDir(self): # read series -> self.patches seriespath = os.path.join(self.dir, 'patches', 'series') if not os.path.exists(self.dir): raise Exception("Error: %s does not exist." % self.dir) if os.path.exists(seriespath): series = file(seriespath, 'r') for line in series.readlines(): patch = {} parts = line.strip().split() patch["quiltfile"] = self._quiltpatchpath(parts[0]) patch["quiltfilemd5"] = md5sum(patch["quiltfile"]) if len(parts) > 1: patch["strippath"] = parts[1][2:] self.patches.append(patch) series.close() # determine which patches are applied -> self._current try: output = runcmd(["quilt", "applied"], self.dir) except CmdError: if sys.exc_value.output.strip() == "No patches applied": return else: raise sys.exc_value output = [val for val in output.split('\n') if not val.startswith('#')] for patch in self.patches: if os.path.basename(patch["quiltfile"]) == output[-1]: self._current = self.patches.index(patch) self.initialized = True def Import(self, patch, force = None): if not self.initialized: self.InitFromDir() PatchSet.Import(self, patch, force) args = ["import", "-p", patch["strippath"]] if force: args.append("-f") args.append("-dn") args.append(patch["file"]) self._runcmd(args) patch["quiltfile"] = self._quiltpatchpath(patch["file"]) patch["quiltfilemd5"] = md5sum(patch["quiltfile"]) # TODO: determine if the file being imported: # 1) is already imported, and is the same # 2) is already imported, but differs self.patches.insert(self._current or 0, patch) def Push(self, force = False, all = False, run = True): # quilt push [-f] args = ["push"] if force: args.append("-f") if all: args.append("-a") if not run: return self._runcmd(args, run) self._runcmd(args) if self._current is not None: self._current = self._current + 1 else: self._current = 0 def Pop(self, force = None, all = None): # quilt pop [-f] args = ["pop"] if force: args.append("-f") if all: args.append("-a") self._runcmd(args) if self._current == 0: self._current = None if self._current is not None: self._current = self._current - 1 def Refresh(self, **kwargs): if kwargs.get("remote"): patch = self.patches[kwargs["patch"]] if not patch: raise PatchError("No patch found at index %s in patchset." % kwargs["patch"]) (type, host, path, user, pswd, parm) = bb.decodeurl(patch["remote"]) if type == "file": import shutil if not patch.get("file") and patch.get("remote"): patch["file"] = bb.fetch.localpath(patch["remote"], self.d) shutil.copyfile(patch["quiltfile"], patch["file"]) else: raise PatchError("Unable to do a remote refresh of %s, unsupported remote url scheme %s." % (os.path.basename(patch["quiltfile"]), type)) else: # quilt refresh args = ["refresh"] if kwargs.get("quiltfile"): args.append(os.path.basename(kwargs["quiltfile"])) elif kwargs.get("patch"): args.append(os.path.basename(self.patches[kwargs["patch"]]["quiltfile"])) self._runcmd(args) class Resolver(object): def __init__(self, patchset): raise NotImplementedError() def Resolve(self): raise NotImplementedError() def Revert(self): raise NotImplementedError() def Finalize(self): raise NotImplementedError() class NOOPResolver(Resolver): def __init__(self, patchset): self.patchset = patchset def Resolve(self): olddir = os.path.abspath(os.curdir) os.chdir(self.patchset.dir) try: self.patchset.Push() except Exception: os.chdir(olddir) raise sys.exc_value # Patch resolver which relies on the user doing all the work involved in the # resolution, with the exception of refreshing the remote copy of the patch # files (the urls). class UserResolver(Resolver): def __init__(self, patchset): self.patchset = patchset # Force a push in the patchset, then drop to a shell for the user to # resolve any rejected hunks def Resolve(self): olddir = os.path.abspath(os.curdir) os.chdir(self.patchset.dir) try: self.patchset.Push(False) except CmdError, v: # Patch application failed patchcmd = self.patchset.Push(True, False, False) t = bb.data.getVar('T', d, 1) if not t: bb.msg.fatal(bb.msg.domain.Build, "T not set") bb.mkdirhier(t) import random rcfile = "%s/bashrc.%s.%s" % (t, str(os.getpid()), random.random()) f = open(rcfile, "w") f.write("echo '*** Manual patch resolution mode ***'\n") f.write("echo 'Dropping to a shell, so patch rejects can be fixed manually.'\n") f.write("echo 'Run \"quilt refresh\" when patch is corrected, press CTRL+D to exit.'\n") f.write("echo ''\n") f.write(" ".join(patchcmd) + "\n") f.write("#" + bb.data.getVar('TERMCMDRUN', d, 1)) f.close() os.chmod(rcfile, 0775) os.environ['TERMWINDOWTITLE'] = "Bitbake: Please fix patch rejects manually" os.environ['TERMRCFILE'] = rcfile rc = os.system(bb.data.getVar('TERMCMDRUN', d, 1)) if os.WIFEXITED(rc) and os.WEXITSTATUS(rc) != 0: bb.msg.fatal(bb.msg.domain.Build, ("Cannot proceed with manual patch resolution - '%s' not found. " \ + "Check TERMCMDRUN variable.") % bb.data.getVar('TERMCMDRUN', d, 1)) # Construct a new PatchSet after the user's changes, compare the # sets, checking patches for modifications, and doing a remote # refresh on each. oldpatchset = self.patchset self.patchset = oldpatchset.__class__(self.patchset.dir, self.patchset.d) for patch in self.patchset.patches: oldpatch = None for opatch in oldpatchset.patches: if opatch["quiltfile"] == patch["quiltfile"]: oldpatch = opatch if oldpatch: patch["remote"] = oldpatch["remote"] if patch["quiltfile"] == oldpatch["quiltfile"]: if patch["quiltfilemd5"] != oldpatch["quiltfilemd5"]: bb.note("Patch %s has changed, updating remote url %s" % (os.path.basename(patch["quiltfile"]), patch["remote"])) # user change? remote refresh self.patchset.Refresh(remote=True, patch=self.patchset.patches.index(patch)) else: # User did not fix the problem. Abort. raise PatchError("Patch application failed, and user did not fix and refresh the patch.") except Exception: os.chdir(olddir) raise os.chdir(olddir) g = globals() g["PatchSet"] = PatchSet g["PatchTree"] = PatchTree g["QuiltTree"] = QuiltTree g["Resolver"] = Resolver g["UserResolver"] = UserResolver g["NOOPResolver"] = NOOPResolver g["NotFoundError"] = NotFoundError g["CmdError"] = CmdError addtask patch after do_unpack do_patch[dirs] = "${WORKDIR}" python () { import bb # do_patch tasks require PATCHTOOL-native to have staged patchdeps = bb.data.getVar("PATCHTOOL", d, True) if patchdeps: patchdeps = "%s-native" % patchdeps if not patchdeps in bb.data.getVar("PROVIDES", d, True): bb.data.setVarFlag('do_patch', 'depends', patchdeps + ":do_populate_staging", d) } python patch_do_patch() { import re import bb.fetch patch_init(d) src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() if not src_uri: return patchsetmap = { "patch": PatchTree, "quilt": QuiltTree, } cls = patchsetmap[bb.data.getVar('PATCHTOOL', d, 1) or 'quilt'] resolvermap = { "noop": NOOPResolver, "user": UserResolver, } rcls = resolvermap[bb.data.getVar('PATCHRESOLVE', d, 1) or 'user'] s = bb.data.getVar('S', d, 1) path = os.getenv('PATH') os.putenv('PATH', bb.data.getVar('PATH', d, 1)) patchset = cls(s, d) patchset.Clean() resolver = rcls(patchset) workdir = bb.data.getVar('WORKDIR', d, 1) for url in src_uri: (type, host, path, user, pswd, parm) = bb.decodeurl(url) if not "patch" in parm: continue bb.fetch.init([url],d) url = bb.encodeurl((type, host, path, user, pswd, [])) local = os.path.join('/', bb.fetch.localpath(url, d)) # did it need to be unpacked? dots = os.path.basename(local).split(".") if dots[-1] in ['gz', 'bz2', 'Z']: unpacked = os.path.join(bb.data.getVar('WORKDIR', d),'.'.join(dots[0:-1])) else: unpacked = local unpacked = bb.data.expand(unpacked, d) if "pnum" in parm: pnum = parm["pnum"] else: pnum = "1" if "pname" in parm: pname = parm["pname"] else: pname = os.path.basename(unpacked) if "mindate" in parm: mindate = parm["mindate"] else: mindate = 0 if "maxdate" in parm: maxdate = parm["maxdate"] else: maxdate = "20711226" pn = bb.data.getVar('PN', d, 1) srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1) if not srcdate: srcdate = bb.data.getVar('SRCDATE', d, 1) if srcdate == "now": srcdate = bb.data.getVar('DATE', d, 1) if (maxdate < srcdate) or (mindate > srcdate): if (maxdate < srcdate): bb.note("Patch '%s' is outdated" % pname) if (mindate > srcdate): bb.note("Patch '%s' is predated" % pname) continue bb.note("Applying patch '%s'" % pname) try: patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True) except: import sys raise bb.build.FuncFailed(str(sys.exc_value)) resolver.Resolve() } EXPORT_FUNCTIONS do_patch rw-r--r--recipes/apache2/apache2-2.2.14/apr.h.in.patch13
-rw-r--r--recipes/apache2/apache2-2.2.14/configure-patch71
-rw-r--r--recipes/apache2/apache2-2.2.14/configure.in.patch27
-rw-r--r--recipes/apache2/apache2-2.2.14/dftables-makefile-patch10
-rw-r--r--recipes/apache2/apache2-2.2.14/server-makefile-patch11
-rw-r--r--recipes/apache2/apache2-native_2.2.14.bb39
-rw-r--r--recipes/apache2/apache2_2.2.14.bb114
-rw-r--r--recipes/asciidoc/asciidoc_8.5.1.bb20
-rw-r--r--recipes/asio/asio.inc14
-rw-r--r--recipes/asio/asio_1.1.1.bb15
-rw-r--r--recipes/asio/asio_1.4.1.bb3
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91cap9adk/defconfig110
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91sam9260ek/defconfig110
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91sam9261ek/defconfig110
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91sam9263ek/defconfig113
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91sam9g20ek/defconfig110
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91sam9g45ek/defconfig110
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91sam9rlek/defconfig110
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/at91sam9xeek/defconfig110
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/mtcdp-embedded/defconfig91
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/mtcdp-embedded/memory_bus_1.8v.patch22
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/mtcdp/defconfig91
-rw-r--r--recipes/at91bootstrap/at91bootstrap-2.13/mtcdp/sdram_slow_slew_rate.patch15
-rw-r--r--recipes/at91bootstrap/at91bootstrap.inc1
-rw-r--r--recipes/at91bootstrap/at91bootstrap_2.13.bb15
-rw-r--r--recipes/aufs/aufs_cvs.bb8
-rw-r--r--recipes/autofs/autofs.inc19
-rw-r--r--recipes/autofs/autofs_3.1.7.bb20
-rw-r--r--recipes/autofs/autofs_4.0.0.bb17
-rw-r--r--recipes/autofs/autofs_4.1.4.bb19
-rw-r--r--recipes/automake/automake-native_1.11.1.bb5
-rw-r--r--recipes/automake/automake_1.11.1.bb4
-rw-r--r--recipes/avahi/avahi-python_0.6.25.bb19
-rw-r--r--recipes/avahi/avahi-ui_0.6.25.bb20
-rw-r--r--recipes/avahi/avahi_0.6.25.bb7
-rw-r--r--recipes/balsa/balsa-2.4.2/libbalsa-gpe-corruption.patch14
-rw-r--r--recipes/balsa/balsa_2.4.1.bb83
-rw-r--r--recipes/balsa/balsa_2.4.2.bb93
-rw-r--r--recipes/base-files/base-files/corecdp/issue8
-rw-r--r--recipes/base-files/base-files/corecdp/issue.net8
-rw-r--r--recipes/base-files/base-files/corecdp/profile34
-rwxr-xr-x[-rw-r--r--]recipes/base-files/base-files/jornada6xx/fstab6
-rwxr-xr-xrecipes/base-files/base-files/jornada6xx/issue2
-rwxr-xr-xrecipes/base-files/base-files/jornada6xx/issue.net2
-rwxr-xr-xrecipes/base-files/base-files/jornada6xx/profile34
-rw-r--r--recipes/base-files/base-files/mtcdp-embedded/fstab12
-rw-r--r--recipes/base-files/base-files/mtcdp-embedded/profile34
-rw-r--r--recipes/base-files/base-files/mtcdp/fstab12
-rw-r--r--recipes/base-files/base-files/mtcdp/profile34
-rw-r--r--recipes/base-files/base-files/omap3-pandora/fstab13
-rw-r--r--recipes/base-files/base-files/omap3-pandora/profile34
-rw-r--r--recipes/base-files/base-files_3.0.14.bb17
-rw-r--r--recipes/binutils/binutils-2.18/binutils-powerpc-ld-segfault.patch13
-rw-r--r--recipes/binutils/binutils-2.20/binutils-2.16.91.0.6-objcopy-rename-errorcode.patch39
-rw-r--r--recipes/binutils/binutils-2.20/binutils-arm-non-empty-know.patch18
-rw-r--r--recipes/binutils/binutils-2.20/binutils-arm-pr7093.patch19
-rw-r--r--recipes/binutils/binutils-2.20/binutils-powerpc-pr11088.patch275
-rw-r--r--recipes/binutils/binutils-2.20/binutils_unexport_LD_LIBRARY_PATH_for_CC_FOR_BUILD.patch95
-rw-r--r--recipes/binutils/binutils-2.20/uclibc-segfault.patch23
-rw-r--r--recipes/binutils/binutils_2.18.bb7
-rw-r--r--recipes/binutils/binutils_2.20.bb11
-rw-r--r--recipes/bison/bison_2.3.bb10
-rw-r--r--recipes/blackbox/blackbox_0.70.1.bb3
-rw-r--r--recipes/blipomoko/blipomoko_git.bb17
-rw-r--r--recipes/blktool/blktool_4.bb5
-rw-r--r--recipes/blueman/blueman_1.10.bb27
-rw-r--r--recipes/blueman/blueman_1.21.bb31
-rw-r--r--recipes/bluez/bluez4.inc11
-rw-r--r--recipes/bluez/bluez4_4.35.bb2
-rw-r--r--recipes/bluez/bluez4_4.37.bb3
-rw-r--r--recipes/bluez/bluez4_4.53.bb14
-rw-r--r--recipes/bluez/bluez4_4.56.bb16
-rw-r--r--recipes/bluez/bluez4_4.59.bb16
-rw-r--r--recipes/bluez/obexd_0.19.bb10
-rw-r--r--recipes/bluez/obexd_0.21.bb10
-rw-r--r--recipes/boost/boost-14x.inc84
-rw-r--r--recipes/boost/boost-36.inc2
-rw-r--r--recipes/boost/boost_1.36.0.bb8
-rw-r--r--recipes/boost/boost_1.40.0.bb10
-rw-r--r--recipes/boost/boost_1.41.0.bb16
-rw-r--r--recipes/boost/files/01-no-serialization-test.patch12
-rw-r--r--recipes/boost/files/02-atomic-count-pthreads-on-arm.patch17
-rw-r--r--recipes/boost/files/03-exception-clone-destructor-fix.patch12
-rw-r--r--recipes/boost/files/1.41.0_uclibc.patch13
-rw-r--r--recipes/boost/files/arm-intrinsics.patch6
-rw-r--r--recipes/boost/files/gcc-44.diff304
-rw-r--r--recipes/boost/files/sscanf.patch13
-rw-r--r--recipes/boost/files/uclibc.patch13
-rw-r--r--recipes/bootchart-lite/bootchart-lite_svn.bb4
-rw-r--r--recipes/bt-configure/bt-configure_git.bb19
-rw-r--r--recipes/bt-gps/bt-gps.bb27
-rw-r--r--recipes/busybox/busybox-1.11.3/iptunnel.patch11
-rw-r--r--recipes/busybox/busybox-1.13.2/corecdp/defconfig873
-rw-r--r--recipes/busybox/busybox-1.13.2/corecdp/syslog.conf9
-rw-r--r--recipes/busybox/busybox-1.15.3/B921600.patch13
-rw-r--r--recipes/busybox/busybox-1.15.3/angstrom/defconfig873
-rw-r--r--recipes/busybox/busybox-1.15.3/defconfig873
-rw-r--r--recipes/busybox/busybox-1.15.3/fdisk_lineedit_segfault.patch12
-rw-r--r--recipes/busybox/busybox-1.15.3/fix31
-rw-r--r--recipes/busybox/busybox-1.15.3/get_header_tar.patch11
-rw-r--r--recipes/busybox/busybox-1.15.3/kaeilos/defconfig855
-rw-r--r--recipes/busybox/busybox-1.15.3/micro/defconfig869
-rw-r--r--recipes/busybox/busybox-1.15.3/r24785.patch14
-rw-r--r--recipes/busybox/busybox-1.15.3/slugos/defconfig869
-rw-r--r--recipes/busybox/busybox-1.15.3/udhcpc-fix-nfsroot.patch47
-rw-r--r--recipes/busybox/busybox-1.15.3/udhcpscript.patch13
-rw-r--r--recipes/busybox/busybox-1.15.3/xargs-double-size.patch13
-rw-r--r--recipes/busybox/busybox.inc8
-rw-r--r--recipes/busybox/busybox_1.11.3.bb1
-rw-r--r--recipes/busybox/busybox_1.14.3.bb5
-rw-r--r--