Author: sjg
Date: Mon Jan 21 20:01:42 2019
New Revision: 343277
URL: https://svnweb.freebsd.org/changeset/base/343277

Log:
  bearssl for importing BearSSL
  
  BearSSL is a tiny SSL lib for embedded systems.
  
  Reviewed by:  emaste

Added:
  vendor/bearssl/
  vendor/bearssl/import.sh   (contents, props changed)

Added: vendor/bearssl/import.sh
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/bearssl/import.sh    Mon Jan 21 20:01:42 2019        (r343277)
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+# Set SVN variables
+#  select the local subversion site
+SVN=${SVN:-/usr/local/bin/svn}
+GIT=${GIT:-/usr/local/bin/git}
+
+# For consistency...
+Error() {
+       echo ERROR: ${1+"$@"} >&2
+       exit 1
+}
+
+Cd() {
+       [ $# -eq 1 ] || Error "Cd() takes a single parameter."
+       cd $1 || Error "cannot \"cd $1\" from $PWD"
+}
+
+SKIP_PULL=
+
+# Call this function and then follow it by any specific import script additions
+option_parsing() {
+       local _shift=$#
+       # Parse command line options
+       while :
+       do
+               case "$1" in
+               *=*) eval "$1"; shift;;
+               --) shift; break;;
+               --skip-pull) SKIP_PULL=:; shift;;
+               --help|-h) cat <<EOU
+Usage:
+
+       $0 [options]
+
+Options:
+
+       --help                  usage
+       --skip-pull             ./BearSSL is up to date
+
+EOU
+                       exit 1
+                       ;;
+               *) break;;
+               esac
+       done
+       return $(($_shift - $#))
+}
+
+###
+
+option_parsing "$@"
+shift $?
+
+TF=/tmp/.$USER.$$
+Cd `dirname $0`
+here=`pwd`
+# this is already done
+[ -d dist ] || Error initialize $here/dist
+
+# thing should match what the TARBALL contains
+thing=`basename $here`
+
+if [ -d BearSSL ]; then
+        if [ -z "$SKIP_PULL" ]; then
+                (cd BearSSL && $GIT pull)
+       fi
+else
+        $GIT clone https://www.bearssl.org/git/BearSSL
+fi
+branch_v=`cd BearSSL && $GIT branch -v`
+VERSION=`echo "$branch_v" | sed -n '/master/s,.* master \([^[:space:]]*\) 
.*,\1,p'`
+
+if [ -d $VERSION ]; then
+        echo We already have $VERSION you see
+        exit 0
+fi
+
+echo Importing: $banch_v
+
+# the rest should be common
+('cd' dist && $SVN list -R) | grep -v '/$' | sort > $TF.old
+# use * rather than . to skip .git
+('cd' BearSSL && find * -type f ) | sort > $TF.new
+comm -23 $TF.old $TF.new > $TF.rmlist
+comm -13 $TF.old $TF.new > $TF.addlist
+[ -s $TF.rmlist ] && { echo rm:; cat $TF.rmlist; }
+[ -s $TF.addlist ] && { echo add:; cat $TF.addlist; }
+('cd' BearSSL && tar cf - * | tar xf - -C ../dist)
+('cd' dist
+test -s $TF.rmlist && xargs $SVN rm < $TF.rmlist
+test -s $TF.addlist && xargs $SVN --parents add < $TF.addlist
+)
+
+url=`$SVN info | sed -n '/^URL:/s,URL: ,,p'`
+echo "After committing dist... run; sh ./tag.sh"
+echo "$SVN cp -m 'tag $thing-$VERSION' $url/dist $url/$VERSION" > tag.sh
+
+rm -f $TF.*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to