a05d033226
Change I9dd8e4027be21363015cd8df9918610e206afce2 replaces colons with underscores in paths, to improve compatibility of paths. This breaks any attempt to interpret the timestamp part of the tree as a timestamp, so revert the change before doing so. Change-Id: I0e82e4045120700e9b4fcc8c6e54d761068eaea3 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: https://review.coreboot.org/13766 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
33 lines
642 B
Bash
Executable file
33 lines
642 B
Bash
Executable file
#!/bin/sh
|
|
# usage: $0 [weekly|monthly|quarterly] < filenames
|
|
# sorts files of the form VENDOR/BOARD/COMMIT/DATE/revision.txt
|
|
# into buckets of the given granularity
|
|
|
|
weekly() {
|
|
date --date="$1" +%GW%V
|
|
}
|
|
|
|
monthly() {
|
|
date --date="$1" +%Y-%m
|
|
}
|
|
|
|
quarterly() {
|
|
date --date="$1" "+%Y %m" | awk '{ q=int(($2-1)/3+1); print $1 "Q" q}'
|
|
}
|
|
|
|
# TODO: restrict $1 to allowed values
|
|
|
|
curr=""
|
|
sort -r -k4 -t/ | while read file; do
|
|
timestamp=`printf $file | cut -d/ -f4 | tr _ :`
|
|
new=`$1 $timestamp`
|
|
if [ "$new" != "$curr" ]; then
|
|
if [ "$curr" != "" ]; then
|
|
printf "\n"
|
|
fi
|
|
printf "$new:"
|
|
curr=$new
|
|
fi
|
|
printf "$file "
|
|
done
|
|
printf "\n"
|