blob: af3c7770554e5bb8dd6475f665cf80b36fa495f7 (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/bin/bash
# usage : packager VERSION [BRANCH]
# VERSION is the version number of the package to create, we expect
# there is a tag named mathcomp-$VERSION which archive we can
# download from github
# BRANCH is the name of a branch where we can find accurate local opam
# files. Actually, this may only matter for the Coq version dependencies
# located in the ssreflect package.
set -e
set -x
if [ -z $2 ]
then BRANCH="mathcomp-$1"
else BRANCH=$2
fi
# shows $BRANCH for debugging, fails if the branch does not exist
git show $BRANCH
# we build the url file content and the list of packages, and where to put them
if [ $1 == "dev" ]
then
# variables useful for package construction
URLLINE="git: \"https://github.com/math-comp/math-comp.git\""
PKGS=$(sed -r "s/.*mathcomp\.([^\.]*)*.*/\1/" $(git root)/mathcomp/all/all.v \
| paste -sd " " -)
PKGPREFIX="$(git root)/opam/extra-dev/packages"
else
ARCHIVE=$(mktemp)
wget -O $ARCHIVE "http://github.com/math-comp/math-comp/archive/mathcomp-$1.tar.gz"
SUM=$(md5sum $ARCHIVE | cut -d " " -f 1)
EXTRACTED=$(mktemp -d)
tar -C $EXTRACTED -zxvf $ARCHIVE
# variables useful for package construction
URLLINE="http: \"http://github.com/math-comp/math-comp/archive/mathcomp-$1.tar.gz\""
CHECKSUMLINE="checksum: \"$SUM\""
PKGS=$(ls -fs -d -1 $EXTRACTED/*/mathcomp/*/ \
| sed -r "s?.*mathcomp/([^/]+)/?\1?" \
| paste -sd " " -)
PKGPREFIX="$(git root)/opam/released/packages"
fi
# for each package, we pick the corresponding opam and descr file and
# rewrite them to adapt them to single package construction and
# version numbers
for pkg in $PKGS
do pkgdir="$PKGPREFIX/coq-mathcomp-$pkg/coq-mathcomp-$pkg.$1"
mkdir -p $pkgdir
if [ $1 == "dev" ]
then cp $(git root)/mathcomp/$pkg/opam $pkgdir/opam
cp $(git root)/mathcomp/$pkg/descr $pkgdir/descr
else git show "$BRANCH:mathcomp/$pkg/opam" > $pkgdir/opam
git show "$BRANCH:mathcomp/$pkg/descr" > $pkgdir/descr
sed -r "/^version/s?dev?$1?" -i $pkgdir/opam
sed -r "/^depends.*coq-mathcomp.*/s?dev?$1?" -i $pkgdir/opam
fi
sed -r "/^(build|install)/s?make?make \"-C\" \"mathcomp/$pkg\"?" -i $pkgdir/opam
echo $URLLINE > $pkgdir/url
if [ $1 != "dev" ]
then echo $CHECKSUMLINE >> $pkgdir/url
fi
done
|