From f8928d715fb6ab9d98b9e941a37c12379acd769d Mon Sep 17 00:00:00 2001 From: David Lindes Date: Sun, 6 Feb 2011 01:15:40 -0800 Subject: [PATCH] re-wrote exportit to use git --- NOEXPORT | 2 -- exportit | 42 ++++++++++++++------------------- exportit_cvs | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 27 deletions(-) delete mode 100644 NOEXPORT create mode 100755 exportit_cvs diff --git a/NOEXPORT b/NOEXPORT deleted file mode 100644 index 515e4a3..0000000 --- a/NOEXPORT +++ /dev/null @@ -1,2 +0,0 @@ -exportit -.cvsignore diff --git a/exportit b/exportit index 58858f4..b5961b3 100755 --- a/exportit +++ b/exportit @@ -1,15 +1,17 @@ #!/bin/ksh # exportit -- a simple little script to export something from a -# CVS repository and create a "release" tarbal of it, in mostly -# automated fasion. Could probably stand do more error -# checking, but if things are happy, it works. :-) Note that -# people getting this with ttyload will have no reason to use it -# in conjunction with ttyload. +# git repository and create a "release" tarbal of it, in mostly +# automated fasion. Re-written from an earlier CVS version. -# Copyright 2001 by David Lindes, All Rights Reserved. -# Distributed under the license described in the file LICENSE -# that comes with ttyload. +# Note that people getting this with ttyload will presumably have no +# reason to use it in conjunction with ttyload, unless they're forking +# their own version. I'd much prefer to get patches or pull requests +# (e.g. on GitHub, though from your own git repo is fine, too). + +# Copyright 2001-2011 by David Lindes, All Rights Reserved. +# Distributed under the license described in the file LICENSE that +# comes with ttyload. # if you're wanting to use this script for some other project, # and you want to call your release something other than the @@ -30,16 +32,12 @@ else fi # automagical settings for things: -path="`cat CVS/Repository`" -root="`cat CVS/Root`" -localroot="${root##*:}" -localpath="${path##${localroot}/}" -name="${name:-`basename "$path"`}" +name="${name:-ttyload}" # this used to be automatic, from CVS info. Skipping that now. version="`cat Version`" -cvsvers="${name}_`echo \"$version\" | sed -e 's/[ \.]/_/g'`" +tagname="${name}_`echo \"$version\" | sed -e 's/[ \.]/_/g'`" dirname="$name-$version" -for item in "$dirname" "$dirname.tar" "$dirname.tar.gz" +for item in "$dirname.tar" "$dirname.tar.gz" "$dirname.tar.bz2" do if [ -e "$item" ] then @@ -50,16 +48,10 @@ do done # let the user know what the settings came up with: -echo "Creating export of $name version $version (CVS: $cvsvers)" +echo "Creating export of $name version $version (tag: $tagname)" # export, and if that fails, bail. -cvs export -d "$dirname" -r "$cvsvers" $localpath || exit 1 +git archive --prefix=$dirname/ -o $dirname.tar $tagname || exit 1 -for file in `cat NOEXPORT` -do - (set -x; rm -rf "$dirname"/"$file") -done - -# then tar and gzip: -tar cvf "$dirname.tar" "$dirname" -gzip -9fv "$dirname.tar" +# then bzip: +bzip2 -9fv "$dirname.tar" diff --git a/exportit_cvs b/exportit_cvs new file mode 100755 index 0000000..58858f4 --- /dev/null +++ b/exportit_cvs @@ -0,0 +1,65 @@ +#!/bin/ksh + +# exportit -- a simple little script to export something from a +# CVS repository and create a "release" tarbal of it, in mostly +# automated fasion. Could probably stand do more error +# checking, but if things are happy, it works. :-) Note that +# people getting this with ttyload will have no reason to use it +# in conjunction with ttyload. + +# Copyright 2001 by David Lindes, All Rights Reserved. +# Distributed under the license described in the file LICENSE +# that comes with ttyload. + +# if you're wanting to use this script for some other project, +# and you want to call your release something other than the +# name of the directory above this one (.., but by name), change +# the "false" below to "true", and the "xyzprod" to whatever you +# want to call things. Note that your tagging will have to also +# be changed appropriately. + +if false +then + # override the name of what to call stuff: + name="xyzprod" +else + # make sure name is unset, so that the ${name:-blah} + # expansion below doesn't get stuff from your environment + # accidentally + unset name +fi + +# automagical settings for things: +path="`cat CVS/Repository`" +root="`cat CVS/Root`" +localroot="${root##*:}" +localpath="${path##${localroot}/}" +name="${name:-`basename "$path"`}" +version="`cat Version`" +cvsvers="${name}_`echo \"$version\" | sed -e 's/[ \.]/_/g'`" +dirname="$name-$version" + +for item in "$dirname" "$dirname.tar" "$dirname.tar.gz" +do + if [ -e "$item" ] + then + echo "Sorry, $item exists, and I need it not to." >&2 + echo "Please remove it or update your Version file to proceed." >&2 + exit 1 + fi +done + +# let the user know what the settings came up with: +echo "Creating export of $name version $version (CVS: $cvsvers)" + +# export, and if that fails, bail. +cvs export -d "$dirname" -r "$cvsvers" $localpath || exit 1 + +for file in `cat NOEXPORT` +do + (set -x; rm -rf "$dirname"/"$file") +done + +# then tar and gzip: +tar cvf "$dirname.tar" "$dirname" +gzip -9fv "$dirname.tar"