From 810ffce466f75533bd6f8d9c9f718aff2ac03756 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Wed, 2 Mar 2022 16:15:56 +0000
Subject: [PATCH] do_release: Add '--checkout' option. Checks out a new working
 copy suitable for releases.

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5343 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/ChangeLog  |  5 +++++
 smartmontools/do_release | 39 +++++++++++++++++++++++++++++++++++----
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index 78cd76426..85af1cc93 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -1,5 +1,10 @@
 $Id$
 
+2022-03-02  Christian Franke  <franke@computer.org>
+
+	do_release: Add '--checkout' option.
+	Checks out a new working copy suitable for releases.
+
 2022-03-01  Christian Franke  <franke@computer.org>
 
 	do_release: Comment out release timestamp in configure.ac
diff --git a/smartmontools/do_release b/smartmontools/do_release
index d25482305..8126183b3 100755
--- a/smartmontools/do_release
+++ b/smartmontools/do_release
@@ -6,9 +6,9 @@
 # $Id$
 
 # Notes on generating releases:
-# (1) update NEWS
-# (2) update ChangeLog -- put in release number
-# (3) update release number in configure.ac
+# (1) run with '--checkout' and then 'cd DESTDIR/trunk/smartmontools'
+# (2) update NEWS -- put in release date
+# (3) update ChangeLog -- put in release date and number
 # (4) to test, run without '--commit'
 # (5) when satisfied, add option '--commit'
 
@@ -18,6 +18,37 @@ set -e
 # <smartmontools-support@listi.jpberlin.de>
 KEYID=0xFF3AEFF5
 
+myname=$0
+
+usage()
+{
+  cat <<EOF
+Usage: $myname --checkout[=URL] DESTDIR
+       $myname [--commit] RC[1-9]|FINAL
+EOF
+  exit 1
+}
+
+# Checkout ?
+checkout_url=
+case "$1" in
+  --checkout) checkout_url="https://svn.code.sf.net/p/smartmontools/code"; shift ;;
+  --checkout=?*) checkout_url=${1#*=}; shift ;;
+esac
+if [ -n "$checkout_url" ]; then
+  case "$#:$1" in
+    1:-*) usage ;; 1:*) ;; *) usage ;;
+  esac
+  if [ -e "$1" ]; then
+    echo "$1: already exists"; exit 1
+  fi
+  opt="--config-option config:miscellany:use-commit-times=yes"
+  svn checkout $opt --depth immediates "$checkout_url" "$1"
+  svn update $opt --parents "$1/trunk/smartmontools"
+  exit 0
+fi
+
+# Release ...
 COMMIT=
 RC=
 
@@ -28,7 +59,7 @@ esac
 case "$*" in
   RC[1-9]) RC="$1" ;;
   FINAL) ;;
-  *) echo "Usage: $0 [--commit] RC[1-9]|FINAL"; exit 1 ;;
+  *) usage ;;
 esac
 
 # Check workdir
-- 
GitLab