summaryrefslogtreecommitdiffstats
path: root/contrib/release
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--contrib/release/copyright-lines.awk27
-rwxr-xr-xcontrib/release/do-release.sh67
-rwxr-xr-xcontrib/release/gen-copyright-years.sh164
-rwxr-xr-xcontrib/release/upload-release.sh67
4 files changed, 325 insertions, 0 deletions
diff --git a/contrib/release/copyright-lines.awk b/contrib/release/copyright-lines.awk
new file mode 100644
index 0000000..b031c50
--- /dev/null
+++ b/contrib/release/copyright-lines.awk
@@ -0,0 +1,27 @@
+BEGIN {
+ start=0
+}
+
+/Copyright \(C\).*[.]/ {
+ print
+ next
+}
+
+/Copyright \(C\)/ {
+ start=1
+ printf $0
+ next
+}
+
+/[.]/ {
+ if (start == 0)
+ next
+ print
+ start=0
+}
+
+// {
+ if (start == 0)
+ next
+ printf $0
+}
diff --git a/contrib/release/do-release.sh b/contrib/release/do-release.sh
new file mode 100755
index 0000000..1127293
--- /dev/null
+++ b/contrib/release/do-release.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+set -e
+
+do_minor=false
+do_major=false
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --minor)
+ do_minor=true
+ ;;
+ --major)
+ do_major=true
+ ;;
+ *)
+ echo "Unknown option: $1"
+ exit 1
+ esac
+ shift
+done
+
+if $do_minor && $do_major; then
+ echo "Can only bump minor or major, not both"
+ exit 1
+fi
+
+if ! $do_minor && ! $do_major; then
+ echo "Need to bump minor or major"
+ exit 1
+fi
+
+git checkout master
+
+version=$(cat VERSION)
+
+minor=$(echo $version \
+ | sed 's/.*\.//')
+major=$(echo $version \
+ | sed 's/\..*//')
+echo Current version: major: $major, minor: $minor
+
+if $do_minor; then
+ echo "Bumping minor version"
+ minor=$(($minor + 1))
+elif $do_major; then
+ echo "Bumping major version"
+ major=$(($major + 1))
+ minor=0
+fi
+echo Bumped version: major: $major, minor: $minor
+
+version=$major.$minor
+
+set +x
+
+echo $version > VERSION
+
+git add VERSION
+
+git commit -m "Bump version to $version"
+
+git push origin master:master
+
+git tag -s -m "dwz $version release" dwz-$version
+
+git push origin dwz-$version
diff --git a/contrib/release/gen-copyright-years.sh b/contrib/release/gen-copyright-years.sh
new file mode 100755
index 0000000..f97691a
--- /dev/null
+++ b/contrib/release/gen-copyright-years.sh
@@ -0,0 +1,164 @@
+#!/bin/bash
+
+this=$(basename $0)
+
+max ()
+{
+ local a
+ a=$1
+ local b
+ b=$2
+
+ if [ "$a" = "" ]; then
+ echo "$b"
+ return
+ elif [ "$b" = "" ]; then
+ echo "$a"
+ return
+ fi
+
+ if [ $a -gt $b ]; then
+ echo "$a"
+ else
+ echo "$b"
+ fi
+}
+
+min ()
+{
+ local a
+ a="$1"
+ local b
+ b="$2"
+
+ if [ "$a" = "" ]; then
+ echo "$b"
+ return
+ elif [ "$b" = "" ]; then
+ echo "$a"
+ return
+ fi
+
+ if [ $a -lt $b ]; then
+ echo "$a"
+ else
+ echo "$b"
+ fi
+}
+
+print_range () {
+ local a
+ a="$1"
+ local b
+ b="$2"
+
+ if [ "$a" = "$b" ]; then
+ echo "$a"
+ return
+ fi
+ echo "$a-$b"
+}
+
+process_line ()
+{
+ local line
+ line="$1"
+
+ fsf=false
+ rh=false
+ suse=false;
+
+ if echo "$line" \
+ | grep -q "Free Software Foundation, Inc\."; then
+ fsf=true
+ who=fsf
+ line=$(echo "$line" \
+ | sed 's/Free Software Foundation, Inc\.//')
+ elif echo "$line" \
+ | grep -q "Red Hat, Inc\."; then
+ rh=true
+ who=rh
+ line=$(echo "$line" \
+ | sed 's/Red Hat, Inc\.//')
+ elif echo "$line" \
+ | grep -q "SUSE LLC\."; then
+ suse=true
+ who=suse
+ line=$(echo "$line" \
+ | sed 's/SUSE LLC\.//')
+ else
+ echo "error: unknown copyright: $line"
+ exit 1
+ fi
+
+ line=$(echo "$line" \
+ | sed 's/[,-]/ /g')
+ max_year=$(echo "$line" \
+ | sed 's/ /\n/g' \
+ | grep -v '^$' \
+ | sort -n -r \
+ | head -n 1)
+ min_year=$(echo "$line" \
+ | sed 's/ /\n/g' \
+ | grep -v '^$' \
+ | sort -n \
+ | head -n 1)
+
+ if $fsf; then
+ fsf_max=$(max "$fsf_max" "$max_year")
+ fsf_min=$(min "$fsf_min" "$min_year")
+ elif $rh; then
+ rh_max=$(max "$rh_max" "$max_year")
+ rh_min=$(min "$rh_min" "$min_year")
+ elif $suse; then
+ suse_max=$(max "$suse_max" "$max_year")
+ suse_min=$(min "$suse_min" "$min_year")
+ fi
+}
+
+main ()
+{
+ if ! git status --ignored 2>&1 \
+ | grep -q "nothing to commit, working tree clean"; then
+ echo "Git tree not clean"
+ exit 1
+ fi
+
+ local tmp
+ tmp=$(mktemp)
+
+ for f in *.c *.h *.def; do
+ if test "$f" = "native.c"; then continue; fi
+
+ if ! grep -q "Copyright (C)" $f; then
+ echo "error: found file without copyright marker: $f"
+ exit 1
+ fi
+
+ echo processing file: $f
+
+ grep -v '"' $f \
+ | awk -f contrib/release/copyright-lines.awk \
+ > $tmp
+
+ while read line; do
+ line=$(echo "$line" \
+ | sed 's/ */ /g')
+ line=$(echo "$line" \
+ | sed 's/.*Copyright (C) *//')
+ echo "Processing line: $line"
+ process_line "$line"
+ done < $tmp
+ done
+
+ rm -f $tmp
+
+ echo "-DFSF_YEARS='\"$(print_range $fsf_min $fsf_max)\"'" \
+ > COPYRIGHT_YEARS
+ echo "-DRH_YEARS='\"$(print_range $rh_min $rh_max)\"'" \
+ >> COPYRIGHT_YEARS
+ echo "-DSUSE_YEARS='\"$(print_range $suse_min $suse_max)\"'" \
+ >> COPYRIGHT_YEARS
+}
+
+main "$@"
diff --git a/contrib/release/upload-release.sh b/contrib/release/upload-release.sh
new file mode 100755
index 0000000..3c2abdd
--- /dev/null
+++ b/contrib/release/upload-release.sh
@@ -0,0 +1,67 @@
+#!/bin/sh -x
+
+set -e
+
+pwd=$(pwd -P)
+
+version=$(cat VERSION)
+
+tag=dwz-$version
+rootdir=dwz
+tarfile=dwz-$version.tar
+server=sourceware.org
+ftpdir=/sourceware/ftp/pub/dwz/releases
+# The server itself seems to add a sha512.sum file, so lets not duplicate that
+# effort.
+#checksums="md5sum sha512sum"
+checksums="md5sum"
+
+repo="$pwd"
+
+dir=$(mktemp -d)
+
+cd $dir
+git clone \
+ $repo \
+ $rootdir
+
+cd $dir/$rootdir
+git ch $tag
+
+rm -Rf .git
+
+cd $dir
+tar cvf \
+ $tarfile \
+ $rootdir
+
+xz \
+ --best \
+ -k \
+ $tarfile
+
+gzip \
+ --best \
+ -k \
+ $tarfile
+
+files=$(echo $tarfile.*)
+
+[ "$files" != "" ]
+
+ssh $server \
+ "mkdir -p $ftpdir"
+
+scp \
+ $files \
+ "$server:$ftpdir"
+
+ssh $server \
+ "cd $ftpdir && chmod 644 $files"
+
+for checksum in $checksums; do
+ ssh $server \
+ "cd $ftpdir && touch $checksum && chmod 644 $checksum && ( $checksum $files >> $checksum )"
+done
+
+rm -Rf $dir