-
Notifications
You must be signed in to change notification settings - Fork 29
/
get_source.sh
executable file
·35 lines (24 loc) · 1 KB
/
get_source.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
DEB_VERSION=`(cd etherlabmaster && dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+(\+[0-9]*hg[0-9a-z]*)?).*$$/\1/p')`
DEB_ORIG="etherlabmaster_$DEB_VERSION.orig.tar.gz"
HG_REPOS="http://hg.code.sf.net/p/etherlabmaster/code"
HG_COMMIT=`(echo "$DEB_VERSION" | sed -rne 's/^[0-9.]+\+[0-9]*hg([0-9a-z]*)p([0-9a-z]*).*$$/\1/p')`
HG_DIR="etherlabmaster-hg"
PATCH_REPOS="http://hg.code.sf.net/u/uecasm/etherlab-patches"
PATCH_COMMIT=`(echo "$DEB_VERSION" | sed -rne 's/^[0-9.]+\+[0-9]*hg([0-9a-z]*)p([0-9a-z]*).*$$/\2/p')`
function cleanup {
rm -rf "$HG_DIR"
}
trap cleanup EXIT
set -e
echo "Cloning HG commit $HG_COMMIT..."
hg clone $HG_REPOS "$HG_DIR" -r $HG_COMMIT
echo "Cloning patchset commit $PATCH_COMMIT..."
hg clone $PATCH_REPOS "$HG_DIR/.hg/patches" -r $PATCH_COMMIT
echo "Apply patchset..."
(cd $HG_DIR && hg qpush -a)
echo "Create source archive..."
(cd $HG_DIR && hg archive "../$DEB_ORIG")
echo "Extracting source..."
(cd etherlabmaster && tar xfz "../$DEB_ORIG" --strip 1)
echo "DONE."