* Use http authentication to upload a release to the server. We
should also use https on catamaran for uploads, but I don't do that yet. * Better error checking. svn path=/nixpkgs/trunk/; revision=630
This commit is contained in:
parent
f2eab1a900
commit
19c6f730c3
@ -2,7 +2,13 @@
|
|||||||
|
|
||||||
url="https://svn.cs.uu.nl:12443/repos/trace/nix/trunk/"
|
url="https://svn.cs.uu.nl:12443/repos/trace/nix/trunk/"
|
||||||
|
|
||||||
curl="curl -f --silent -S"
|
curl="curl --fail --silent --show-error"
|
||||||
|
# auth-info file should have format `username:password'.
|
||||||
|
if ! auth_info=$(cat auth-info); then
|
||||||
|
echo "cannot get authentication info"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
curl_up="$curl --user $auth_info"
|
||||||
|
|
||||||
rev=$(svn log --quiet --non-interactive "$url" \
|
rev=$(svn log --quiet --non-interactive "$url" \
|
||||||
| grep '^r' \
|
| grep '^r' \
|
||||||
@ -15,9 +21,10 @@ fi
|
|||||||
|
|
||||||
echo "building revision $rev of $url"
|
echo "building revision $rev of $url"
|
||||||
|
|
||||||
|
# !!! race
|
||||||
echo $rev > head-revision.nix
|
echo $rev > head-revision.nix
|
||||||
|
|
||||||
if ! storeexprs=($(nix-instantiate -vvv do-it.nix)); then exit 1; fi
|
if ! storeexprs=($(nix-instantiate -vv do-it.nix)); then exit 1; fi
|
||||||
|
|
||||||
srcexpr=${storeexprs[0]}
|
srcexpr=${storeexprs[0]}
|
||||||
testexpr=${storeexprs[1]}
|
testexpr=${storeexprs[1]}
|
||||||
@ -32,36 +39,40 @@ relname=$((cd $outpath && echo nix-*.tar.bz2) | sed -e s/.tar.bz2//)
|
|||||||
echo "release is $relname"
|
echo "release is $relname"
|
||||||
|
|
||||||
# If it already exists on the server, quit.
|
# If it already exists on the server, quit.
|
||||||
exists=$($curl $uploader/exists/$relname)
|
if ! exists=$($curl_up $uploader/exists/$relname); then
|
||||||
|
echo "cannot check for existence of $relname on the server"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if test "$exists" = "yes"; then
|
if test "$exists" = "yes"; then
|
||||||
echo "server already has release $relname"
|
echo "server already has release $relname"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create an upload session on the server.
|
# Create an upload session on the server.
|
||||||
if ! sessionname=$($curl $uploader/create/$relname); then
|
if ! sessionname=$($curl_up $uploader/create/$relname); then
|
||||||
echo "cannot create upload session"
|
echo "cannot create upload session"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "session name is $sessionname"
|
echo "session name is $sessionname"
|
||||||
|
|
||||||
# Upload the source distribution and the manual.
|
# Upload the source distribution and the manual.
|
||||||
$curl -T "$outpath"/nix-*.tar.bz2 "$uploader/upload/$sessionname/" || exit 1
|
$curl_up -T "$outpath"/nix-*.tar.bz2 "$uploader/upload/$sessionname/" || exit 1
|
||||||
$curl -T "$outpath"/manual.tar.bz2 "$uploader/upload-tar/$sessionname" || exit 1
|
$curl_up -T "$outpath"/manual.tar.bz2 "$uploader/upload-tar/$sessionname" || exit 1
|
||||||
|
|
||||||
# Perform a test build.
|
# Perform a test build.
|
||||||
#if ! nix-store -vvvv -r "$testexpr" > /dev/null; then exit 1; fi
|
#if ! nix-store -vvvv -r "$testexpr" > /dev/null; then exit 1; fi
|
||||||
|
|
||||||
# Perform an RPM build, and upload the RPM to the server.
|
# Perform an RPM build, and upload the RPM to the server.
|
||||||
if ! rpmpath=$(nix-store -vvvv -qnf "$rpmexpr"); then exit 1; fi
|
if ! rpmpath=$(nix-store -vvvv -qnf "$rpmexpr"); then exit 1; fi
|
||||||
$curl -T "$rpmpath"/nix-*.rpm "$uploader/upload/$sessionname/" || exit 1
|
$curl_up -T "$rpmpath"/nix-*.rpm "$uploader/upload/$sessionname/" || exit 1
|
||||||
|
|
||||||
# Finish the upload session.
|
# Finish the upload session.
|
||||||
$curl "$uploader/finish/$sessionname" || exit 1
|
$curl_up "$uploader/finish/$sessionname" || exit 1
|
||||||
|
|
||||||
# Publish the release on the Wiki.
|
# Publish the release on the Wiki.
|
||||||
|
# !!! create /tmp file
|
||||||
echo -n $relname > relname
|
echo -n $relname > relname
|
||||||
$curl -T relname "$uploader/put/head-revision" || exit 1
|
$curl_up -T relname "$uploader/put/head-revision" || exit 1
|
||||||
rm -f $relname
|
rm -f $relname
|
||||||
|
|
||||||
# Force a refresh of the Wiki.
|
# Force a refresh of the Wiki.
|
||||||
|
Loading…
Reference in New Issue
Block a user