Root/schhist/schhist-qi-update-all

1#!/bin/bash
2
3#
4# Only run one instance of this script.
5#
6
7if pidof -x $(basename $0) > /dev/null; then
8  for p in $(pidof -x $(basename $0)); do
9    if [ $p -ne $$ ]; then
10      echo "Script $0 is already running: exiting"
11      exit
12    fi
13  done
14fi
15
16[ ! -d git ] && mkdir git
17
18#
19# pull_all is set once a day in case we are missing a commit event
20#
21
22if [ -e git/pull_all ]; then
23 rm git/pull_all
24 pull_all=1
25else
26 pull_all=0
27fi
28
29# eeschema segfaults if DISPLAY is not set
30export DISPLAY=:0
31
32#
33# $1 url to git repo
34# $2 local directory name
35#
36
37function is_git_updated
38{
39 if [ ! -d git/$2 ]; then
40  rm -f git/$2.last git/$2.pull_needed
41  (cd git && git clone $1 $2)
42 elif [ $pull_all -gt 0 ] || [ -e git/$2.pull_needed ]; then
43  rm -f git/$2.pull_needed
44  (cd git/$2 && git pull)
45 fi
46 if [ -e git/$2.last ]; then
47  LAST_COMMIT=`cat git/$2.last`
48 fi
49 CURRENT_COMMIT=`cd git/$2 && git rev-parse @{0}`
50 if [ "$LAST_COMMIT" != "$CURRENT_COMMIT" ]; then
51  echo $CURRENT_COMMIT > git/$2.last
52  return 1
53 fi
54 return 0
55}
56
57#
58# run_schhist2web parameters
59# -n -f -S -c cache: will be passed to schhist2web
60# --order order: will become SCHHIST_ORDER
61# --title title: will become SCHHIST_TITLE
62# $1 local git directory
63# $2 root schematic
64# $3 output directory
65# $4 remote url home
66# $5 remote url commit template
67#
68
69function run_schhist2web
70{
71 unset SCHHIST_TITLE
72 unset SCHHIST_ORDER
73 while true; do
74 case "$1" in
75  -n | -f | -S) schhist2web_options="$schhist2web_options $1"
76      shift;;
77  -c) schhist2web_options="$schhist2web_options $1 $2"
78      shift 2;;
79  --order) export SCHHIST_ORDER=$2; shift 2;;
80  --title) export SCHHIST_TITLE=$2; shift 2;;
81  *) break;;
82 esac
83 done
84 export SCHHIST_HOME_URL=$4
85 export SCHHIST_COMMIT_TEMPLATE=$5
86 export SCHHIST_ADDLIBS=device
87 ./eda-tools/schhist/schhist2web $schhist2web_options git/$1 $2 $3
88}
89
90#
91# main
92#
93
94is_git_updated git://projects.qi-hardware.com/kicad-libs.git kicad-libs
95
96is_git_updated git://projects.qi-hardware.com/ben-wpan.git ben-wpan || (
97
98 run_schhist2web -S --title ben-wpan/atusb --order atusb:USB:RF \
99    ben-wpan atusb/atusb.sch output/atusb \
100    http://projects.qi-hardware.com/p/ben-wpan/ \
101    "http://projects.qi-hardware.com/p/ben-wpan/source/commit/{}/"
102
103 run_schhist2web -S --title ben-wpan/cntr \
104    ben-wpan cntr/cntr.sch output/cntr \
105    http://projects.qi-hardware.com/p/ben-wpan/ \
106    "http://projects.qi-hardware.com/p/ben-wpan/source/commit/{}/"
107
108 run_schhist2web -S --title ben-wpan/atben \
109    ben-wpan atben/atben.sch output/atben \
110    http://projects.qi-hardware.com/p/ben-wpan/ \
111    "http://projects.qi-hardware.com/p/ben-wpan/source/commit/{}/"
112)
113
114is_git_updated https://github.com/milkymist/board-m1.git board-m1 || (
115
116 run_schhist2web -S --title "Milkymist One" --order m1:POWER:FPGA_Dec:FPGA_BANK0:FPGA_BANK1:FPGA_BANK2:FPGA_BANK3:EXPANSION_RESET:DRAM:NOR_FLASH:AUDIO:DVI-I:VIDEO_IN:MISC_CONTROL:ETHERNET:USB_A-B:USB_C-D:USB_E-F:MISC \
117    board-m1 r4/m1.sch output/board-m1 \
118    https://github.com/milkymist/board-m1/ \
119    "https://github.com/milkymist/board-m1/commit/{}"
120)
121
122is_git_updated https://github.com/kristianpaul/m1-gps-expansion.git m1-gps-expansion || (
123
124 run_schhist2web -S --title "M1 GPS expansion board" \
125    m1-gps-expansion gps.sch output/m1-gps-expansion \
126    https://github.com/kristianpaul/m1-gps-expansion/ \
127    "https://github.com/kristianpaul/m1-gps-expansion/commit/{}"
128
129)
130
131is_git_updated git://projects.qi-hardware.com/m1.git m1 || (
132
133 run_schhist2web -S --title "Milkymist One JTAG-serial" \
134    m1 jtag-serial/usb_jtag.sch output/m1-jtag-serial \
135    http://projects.qi-hardware.com/p/m1/ \
136    "http://projects.qi-hardware.com/p/m1/source/commit/{}/"
137)
138
139is_git_updated git://projects.qi-hardware.com/ben-blinkenlights.git ben-blinkenlights || (
140
141 run_schhist2web -S --title "Ben Blinkenlights" \
142    ben-blinkenlights bbl.sch output/ben-blinkenlights \
143    http://projects.qi-hardware.com/p/ben-blinkenlights/ \
144    "http://projects.qi-hardware.com/p/ben-blinkenlights/source/commit/{}/"
145
146 run_schhist2web -S --title "UBB VGA (ben-blinkenlights)" \
147    ben-blinkenlights ubb-vga/ubb-vga.sch output/ubb-vga \
148    http://projects.qi-hardware.com/p/ben-blinkenlights/ \
149    "http://projects.qi-hardware.com/p/ben-blinkenlights/source/commit/{}/"
150)
151
152is_git_updated git://projects.qi-hardware.com/board-qi-avt2.git board-qi-avt2 || (
153
154 run_schhist2web -S --title AVT2 \
155    board-qi-avt2 main/Qi_AVT2.sch output/board-qi-avt2 \
156    http://projects.qi-hardware.com/p/board-qi-avt2/ \
157    "http://projects.qi-hardware.com/p/board-qi-avt2/source/commit/{}/"
158)
159
160is_git_updated git://projects.qi-hardware.com/f32xbase.git f32xbase || (
161
162 run_schhist2web -S --title c2ben \
163    f32xbase c2ben/c2ben.sch output/f32xbase_c2ben \
164    http://projects.qi-hardware.com/p/f32xbase/ \
165    "http://projects.qi-hardware.com/p/f32xbase/source/commit/{}/"
166)
167
168is_git_updated git://projects.qi-hardware.com/wernermisc.git wernermisc || (
169
170 run_schhist2web -S --title labsw \
171    wernermisc labsw/labsw.sch output/labsw \
172    http://projects.qi-hardware.com/p/wernermisc/ \
173    "http://projects.qi-hardware.com/p/wernermisc/source/commit/{}/"
174)
175

Archive Download this file

Branches:
master



interactive