mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-29 17:05:00 +02:00
81adfd188d
There is no mipsel cross-compiler packaged for Debian, so building the firmware on arbitrary build machines is not possible. So let packagers build firmware when generating the source package. The built firmware is kept in the debian/ directory and then copied verbatim to <staging directory>/usr/share/xburst-tools at the appropriate time. The commands to prepare the firmware are in a script named debian/autogen.sh, which could be taught to do other things (such as generate a changelog) later. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
109 lines
1.8 KiB
Bash
109 lines
1.8 KiB
Bash
#!/bin/sh
|
|
# Clean up after a failed build.
|
|
#
|
|
# Requires access to .gitignore files excluding _all_ modified files.
|
|
#
|
|
# Requires a working /dev/fd (with more than just /dev/fd/0 and 1)
|
|
# or gawk.
|
|
|
|
set -e
|
|
|
|
splitgitignore='#!/usr/bin/awk
|
|
!/^#/ && !/^$/ {
|
|
glob = /[[*?]/;
|
|
directory = /\/$/;
|
|
sub(/\/$/, "");
|
|
anchored = /\//;
|
|
sub(/^\//, "");
|
|
|
|
output = "nonexistent/nonsense";
|
|
if (anchored) {
|
|
if (!directory && !glob)
|
|
output = "/dev/fd/1";
|
|
else if (directory && !glob)
|
|
output = "/dev/fd/3";
|
|
else if (!directory && glob)
|
|
output = "/dev/fd/4";
|
|
else if (directory && glob)
|
|
output = "/dev/fd/5";
|
|
} else {
|
|
if (!directory)
|
|
output = "/dev/fd/6";
|
|
else
|
|
output = "/dev/fd/7";
|
|
}
|
|
print >> output;
|
|
}
|
|
'
|
|
|
|
offlimits="-type d -name '.*' -prune -o -type d -name debian -prune"
|
|
|
|
remove_file_globs() {
|
|
while read glob
|
|
do
|
|
eval "rm -f $glob"
|
|
done
|
|
}
|
|
|
|
remove_directory_globs() {
|
|
while read glob
|
|
do
|
|
eval "rm -fr $glob"
|
|
done
|
|
}
|
|
|
|
remove_file_findpatterns() {
|
|
while read pat
|
|
do
|
|
find . $offlimits -o \
|
|
'(' -name "$pat" -execdir rm -f '{}' + ')'
|
|
done
|
|
}
|
|
|
|
remove_directory_findpatterns() {
|
|
while read pat
|
|
do
|
|
find . $offlimits -o \
|
|
'(' -type d -name "$pat" -execdir rm -fr '{}' + ')'
|
|
done
|
|
}
|
|
|
|
find . $offlimits -o '(' -name .gitignore -print ')' |
|
|
while read file
|
|
do
|
|
(
|
|
cd "$(dirname "$file")"
|
|
# Dispatch using pipes. Yuck.
|
|
{ { { { {
|
|
awk "$splitgitignore" |
|
|
{
|
|
# anchored files (globless)
|
|
xargs -d '\n' rm -f
|
|
}
|
|
} 3>&1 >&2 |
|
|
{
|
|
# anchored directories (globless)
|
|
xargs -d '\n' rm -fr
|
|
}
|
|
} 4>&1 >&2 |
|
|
{
|
|
# anchored files
|
|
remove_file_globs
|
|
}
|
|
} 5>&1 >&2 |
|
|
{
|
|
# anchored directories
|
|
remove_directory_globs
|
|
}
|
|
} 6>&1 >&2 |
|
|
{
|
|
# unanchored files
|
|
remove_file_findpatterns
|
|
}
|
|
} 7>&1 >&2 |
|
|
{
|
|
remove_directory_findpatterns
|
|
} >&2
|
|
) < "$file"
|
|
done
|