@ -1,74 +0,0 @@ | |||
#!/usr/bin/env ruby | |||
# | |||
# hal_device_tree.rb | |||
# | |||
# Print a tree from the output of hal-device | |||
# Useful to analyse bug reports | |||
# | |||
require 'getopts' | |||
require 'open-uri' | |||
def parse_file(path) | |||
io = path | |||
io = open(io) if io.class != IO | |||
list = Array.new | |||
current = nil | |||
io.each_line do |line| | |||
if line =~ /^\d/ | |||
list << current unless current.nil? | |||
current = Hash.new | |||
next | |||
end | |||
line.gsub!(/\(.*\)/, '') | |||
line.gsub!("'", '') | |||
k,v = line.split('=') | |||
next if k.strip.empty? | |||
current[k.strip] = v.strip | |||
end | |||
list | |||
end | |||
def print_node(node, pad = 0) | |||
print '|' | |||
pad.times { print "----" } | |||
print '-- ' | |||
print "#{node['info.category']} " if node['info.category'] | |||
print "#{node['info.product']} " if node['info.product'] | |||
print " -> #{node['info.udi']}" if $OPT_u | |||
puts | |||
end | |||
def collect_children(list, root) | |||
root['childs'] = Array.new | |||
children = list.select { |e| e['info.parent'] == root['info.udi'] } | |||
children.each do |child| | |||
root['childs'] << child | |||
collect_children(list, child) | |||
end | |||
end | |||
def print_children(root, pad = 1) | |||
root['childs'].each do |child| | |||
print_node(child, pad) | |||
if not child['childs'].empty? | |||
print_children(child, pad + 1) | |||
end | |||
end | |||
end | |||
raise ArgumentError if getopts('uf:').nil? | |||
list = parse_file($OPT_f || STDIN) | |||
roots = list.select { |e| e['info.parent'].match(/computer/) unless e['info.parent'].nil? } | |||
roots.each do |root| | |||
collect_children(list, root) | |||
print_node(root) | |||
print_children(root) | |||
puts '|' | |||
end |
@ -1,71 +0,0 @@ | |||
#!/bin/sh | |||
# | |||
# roll_release.sh | |||
# | |||
# Rolls a distribution tarball from the svn trunk | |||
# and performs basic QA checks. | |||
# | |||
TRUNK_PATH="../" | |||
clean_sources() | |||
{ | |||
cd $TRUNK_PATH | |||
make clean >> /dev/null || exit | |||
if [ "`svn st`" ] ; then | |||
echo "! Directory $TRUNK_PATH is not clean !" | |||
svn st | |||
exit | |||
fi | |||
cd - > /dev/null | |||
} | |||
create_release() | |||
{ | |||
BUILD_ENV=`mktemp -d /tmp/build.XXXXXX` | |||
SRC_PATH=${BUILD_ENV}/pam_usb-${1} | |||
TARBALL=pam_usb-${1}.tar.gz | |||
TAG_PATH=${TRUNK_PATH}/../../tags/${1} | |||
if [ -d $TAG_PATH -o -f $TARBALL ] ; then | |||
rm -rf $BUILD_ENV | |||
echo "! Release $1 already exists !" | |||
exit | |||
fi | |||
echo "* Rolling release $1 on $BUILD_ENV..." | |||
svn cp $TRUNK_PATH/../pam_usb $TAG_PATH | |||
svn export $TRUNK_PATH $SRC_PATH | |||
echo "* Cleaning up..." | |||
rm -rf $SRC_PATH/utils | |||
echo "* Tagging release \"$1\"" | |||
sed -ri "s/(PUSB_VERSION) \"[^\"]*\"/\1 \"${1}\"/" ${SRC_PATH}/src/version.h | |||
cp -f ${SRC_PATH}/src/version.h ${TAG_PATH}/src/version.h | |||
echo "* Creating tarball..." | |||
cd $BUILD_ENV | |||
tar -zcf $TARBALL pam_usb-${1} | |||
cd - > /dev/null | |||
cp ${BUILD_ENV}/${TARBALL} . | |||
rm -rf $BUILD_ENV | |||
echo "* Release $1 successfully rolled." | |||
echo "* Tarball stored on `pwd`/${TARBALL}" | |||
md5sum $TARBALL | |||
} | |||
if [ "x$1" = "x" ] ; then | |||
echo "Usage: roll_release.sh <version>" | |||
exit | |||
fi | |||
cd `dirname $0` | |||
clean_sources | |||
create_release "$1" |