Skip to content

Instantly share code, notes, and snippets.

View kergoth's full-sized avatar

Christopher Larson kergoth

  • Siemens Digital Industries Software
  • X @kergoth
View GitHub Profile
@kergoth
kergoth / psmisc.inc
Created September 5, 2008 20:29
Musing on potential alternative bitbake file formats
LICENSE = "GPL"
DESCRIPTION = "procfs tools"
SECTION = "base"
PRIORITY = "required"
DEPENDS = "ncurses virtual/libintl"
SRC_URI = "${SOURCEFORGE_MIRROR}/psmisc/psmisc-${PV}.tar.gz \
file://libintl-link.patch;patch=1"
S = "${WORKDIR}/psmisc-${PV}"
@kergoth
kergoth / test.py
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
kergoth / stackiter.py
Created July 31, 2009 19:41
stackiter
#!/usr/bin/env python
from collections import deque
def stackiter(iterable):
iterator = iter(iterable)
stack = deque()
while True:
if stack:
val = stack.pop()
@kergoth
kergoth / staging-hacks.bbclass
Last active March 18, 2016 21:25
Obsolete, superceded by sstate
python () {
from bb.data 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
kergoth / missingdeps.bbclass
Last active September 3, 2015 18:06
Obsolete, there's an automatic check for this in oe-core's insane.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
kergoth / magic_rsync.sh
Created October 8, 2009 18:42
"Magic" rsync
#!/bin/bash
shopt -s compat31 2>/dev/null
usage () {
echo 'Usage: magic_rsync.sh [OPTION]... FROM TO'
echo 'Run rsync from one location to another, manually processing specific groups of files.'
echo
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
kergoth / README.txt
Created November 24, 2009 21:39
"origin" scripts for tracking git cherry picks.
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
kergoth / multiversion.bbclass
Created March 20, 2010 01:06
Experimentations with BBVERSIONS
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
kergoth / dedent.py
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):