summaryrefslogtreecommitdiff
path: root/publish
diff options
context:
space:
mode:
Diffstat (limited to 'publish')
-rwxr-xr-xpublish58
1 files changed, 46 insertions, 12 deletions
diff --git a/publish b/publish
index 1d218f5..1f3571e 100755
--- a/publish
+++ b/publish
@@ -5,9 +5,13 @@
# The distribution is taken from cppget.org/0/ and packages from
# cppget.org/repository/.
#
-# Usage: publish [<rsync-options>]
+# -d
+# Only publish the distribution.
#
-usage="$0 [<rsync-options>]"
+# -p
+# Only publish the packages.
+#
+usage="$0 [options] -- [<rsync-options>]"
owd=`pwd`
trap "{ cd $owd; exit 1; }" ERR
@@ -16,28 +20,58 @@ set -o errtrace # Trap in functions.
function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }
-v="$(sed -n -re 's/^version: ([^.]+\.[^.]+\.[^-]+(-[ab]\.[^.+]+)?).*$/\1/p' build2-toolchain/manifest)"
+pkg_only=
+dist_only=
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -d)
+ dist_only=true
+ shift
+ ;;
+ -p)
+ pkg_only=true
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ error "unexpected $1"
+ ;;
+ esac
+done
+
+if [ -z "$pkg_only" ]; then
+ v="$(sed -n -re 's/^version: ([^.]+\.[^.]+\.[^-]+(-[ab]\.[^.+]+)?).*$/\1/p' build2-toolchain/manifest)"
-if [ -z "$v" ]; then
- error "unable to extract version build2-toolchain/manifest"
+ if [ -z "$v" ]; then
+ error "unable to extract version build2-toolchain/manifest"
+ fi
fi
+
function sync ()
{
- info "build2.org:"
+ if [ -z "$pkg_only" ]; then
+ info "build2.org:"
- rsync -v -rlpt -c --copy-unsafe-links --prune-empty-dirs --delete-after \
+ rsync -v -rlpt -c --copy-unsafe-links --prune-empty-dirs --delete-after \
"${@}" "cppget.org/0/$v/" "build2.org:/var/www/download.build2.org/public/$v/"
- rsync -v -rlpt -c --copy-unsafe-links --prune-empty-dirs --delete-after \
+ rsync -v -rlpt -c --copy-unsafe-links --prune-empty-dirs --delete-after \
"${@}" "cppget.org/0/toolchain.sha256" "build2.org:/var/www/download.build2.org/public/"
+ fi
- info "cppget.org:"
- etc/rep-publish cppget.org/repository/1/ cppget.org:/var/bpkg/1/ "${@}"
+ if [ -z "$dist_only" ]; then
+ info "cppget.org:"
+ etc/rep-publish cppget.org/repository/1/ cppget.org:/var/bpkg/1/ "${@}"
- info "brep.cppget.org:"
- etc/rep-publish cppget.org/repository/1/ brep.cppget.org:/var/bpkg/1/ \
+ info "brep.cppget.org:"
+ etc/rep-publish cppget.org/repository/1/ brep.cppget.org:/var/bpkg/1/ \
"${@}"
+ fi
}
sync --dry-run "${@}"