Skip to content

Instantly share code, notes, and snippets.


Christopher Larson kergoth

  • Siemens Digital Industries Software
  • Twitter @kergoth
View GitHub Profile
kergoth /
Created September 5, 2008 20:29
Musing on potential alternative bitbake file formats
DESCRIPTION = "procfs tools"
SECTION = "base"
PRIORITY = "required"
DEPENDS = "ncurses virtual/libintl"
SRC_URI = "${SOURCEFORGE_MIRROR}/psmisc/psmisc-${PV}.tar.gz \
S = "${WORKDIR}/psmisc-${PV}"
kergoth /
Created July 20, 2009 18:49
Incomplete, experimental bitbake recipe parsing with shlex
#!/usr/bin/env python
from shlex import shlex
import string
import os
class ParseError(Exception):
def __init__(self, lex, message):
self.lex = lex
self.lineno = lex.lineno
kergoth /
Created July 31, 2009 19:41
#!/usr/bin/env python
from collections import deque
def stackiter(iterable):
iterator = iter(iterable)
stack = deque()
while True:
if stack:
val = stack.pop()
kergoth / staging-hacks.bbclass
Last active March 18, 2016 21:25
Obsolete, superceded by sstate
View staging-hacks.bbclass
python () {
from import expand
# Compatibility
for k in d.keys():
if d.getVarFlag(k, "task"):
deps = expand(d.getVarFlag(k, "depends") or "", d)
if deps:
d.setVarFlag(k, "depends", deps.replace(":do_populate_staging", ":do_capture"))
kergoth / missingdeps.bbclass
Last active September 3, 2015 18:06
Obsolete, there's an automatic check for this in oe-core's insane.bbclass.
View missingdeps.bbclass
# missingdeps.bbclass: Check for missing recipe dependencies.
# The initial implementation leverages the automatic rdepends code from
# package.bbclass to determine if we actually depend upon the things we used.
# Available user configuration variables:
# MISSINGDEPS_ENABLE - Set to non-empty to enable, empty to disable. By
# default, it's enabled if you're linking with
# -Wl,--as-needed.
# MISSINGDEPS_ERROR - Fail the do_package task if non-empty, just show an
kergoth /
Created October 8, 2009 18:42
"Magic" rsync
shopt -s compat31 2>/dev/null
usage () {
echo 'Usage: [OPTION]... FROM TO'
echo 'Run rsync from one location to another, manually processing specific groups of files.'
echo ' -p PAT -c CMD For each file matching pattern PAT, run CMD against it.'
echo ' CMD is passed the filename relative to transfer root, FROM, and TO.'
kergoth / README.txt
Created November 24, 2009 21:39
"origin" scripts for tracking git cherry picks.
View README.txt
These scripts are intended to make it easier to keep track of cherry picks
between long lived branches/forks.
The available scripts:
git-origin - associates an origin for a commit.. where it was cherry picked from
git-origin-blacklist - blacklists a commit from the output of the tools,
useful for bits you know are local-only
git-origins-from-patchid - uses patchids (like git-cherry) to generate an
initial set of origin data
git-cherry-origins - command like git-cherry, but which obeys the stored
kergoth / multiversion.bbclass
Created March 20, 2010 01:06
Experimentations with BBVERSIONS
View multiversion.bbclass
python () {
# Allow version-specific checksums
flags = d.getVarFlags("SRC_URI_%s" % d.getVar("PV", True))
if flags:
for flag, value in flags.iteritems():
d.setVarFlag("SRC_URI", flag, value)
from pyparsing import *
from string import printable
data = "${foo} ${${bar}} whee ${ bar ${baz ${meh} moo}}"
datastore = {
"foo": "fooval",
"bar": "barval",
"barval": "barvalval",
"meh": "MEH",
"baz MEH moo": "heh.",
kergoth /
Created August 26, 2010 19:10
Remove a level of indentation from python code
from tokenize import generate_tokens, untokenize, INDENT, DEDENT
def dedent_python(codestr):
"""Remove the first level of indentation from a block of python code"""
indent = None
level = 0
tokens = []
lines = codestr.splitlines(True)
for toknum, tokval, _, _, _ in generate_tokens(iter(lines).next):