commit-womb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-womb] gnumaint mkspotlight


From: Mike Gerwitz
Subject: [commit-womb] gnumaint mkspotlight
Date: Fri, 23 Feb 2018 22:28:12 -0500 (EST)

CVSROOT:        /sources/womb
Module name:    gnumaint
Changes by:     Mike Gerwitz <mikegerwitz>      18/02/23 22:28:12

Added files:
        .              : mkspotlight 

Log message:
        Summary: mkspotlight: New script

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/mkspotlight?cvsroot=womb&rev=1.1

Patches:
Index: mkspotlight
===================================================================
RCS file: mkspotlight
diff -N mkspotlight
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ mkspotlight 24 Feb 2018 03:28:12 -0000      1.1
@@ -0,0 +1,137 @@
+#!/bin/bash
+#
+# Spotlight generation script
+#
+#  Copyright (C) 2018 Mike Gerwitz
+#
+#  This program is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation, either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# This script just automates parts of what Brandon Invergo conveyed to me
+# (Mike Gerwitz) via e-mail.  It is glue code around the existing
+# process.  It may or may not evolve over time.
+##
+
+set -euo pipefail
+
+declare -r makefile=spotlight.mk
+declare -r tmp=spotlight-tmp
+declare -r releases_out="$tmp/releases-this-month.gnu"
+
+declare -r editor="${EDITOR:-editor}"
+
+cd "$(dirname $0)"
+
+
+fail()
+{
+  local -r msg="${1?Missing failure message}"
+
+  echo "error: $msg" >&2
+  exit 1
+}
+
+
+cleanup()
+{
+  read -p 'Remove old spotlight (y/n)? '
+  test "$REPLY" == y || return 0
+
+  echo "cleaning old $tmp..."
+  rm -fv "$tmp"/*
+}
+
+
+make-release-out()
+{
+  local -r last_date="${1?Missing last spotlight date}"
+
+  make -f "$makefile" END_DATE="$last_date"
+  test -f "$releases_out" || fail "didn't generate $releases_out!"
+
+  # prepend some useful text (from Brandon's original email); hopefully a
+  # lot of this will be automated as time goes on
+  cat - "$releases_out" > "$releases_out.tmp" <<EOF
+# From Brandon:
+# > Edit releases-this-month.gnu.  Normally this entails removing
+# > multiple releases of the same package (just keep the latest one),
+# > removing language packs (Icecat), dictionaries (aspell), patchsets
+# > (gnuhealth), and adding releases that weren't uploaded to the FTP
+# > server.  For that latter case, I don't methodically search for all
+# > packages; I just cross-check with the info-gnu release announcements
+# > and I double-check for the big ones: gnupg (normally announced on
+# > info-gnu) & gnutls (check the website).
+#
+# (All comments and empty lines will be removed.)
+
+EOF
+
+  # manually edit file
+  "$editor" "$releases_out.tmp"
+
+  # move into place without comments and remove temporary
+  # (*-ready is the ultimate destination)
+  sed '/^#/d;^$/d' "$releases_out.tmp" > "$releases_out-ready"
+  rm "$releases_out.tmp" "$releases_out"
+}
+
+
+make-markdown()
+{
+  make -f "$makefile" markdown
+
+  # locate the markdown file
+  local -r md=spotlight/spotlight-"$( date +%Y-%m-%d )".md
+
+  test -f "$md" || fail 'error: missing spotlight/*.md output'
+
+  # some common replacements, to be added to over time (maybe extract into
+  # its own file for maintenance)
+  sed -i 's#packages/gnurl#packages/gnunet#'
+
+  # manually edit final file
+  "$editor" "$md"
+
+  echo "send to address@hidden: $md"
+}
+
+
+usage()
+{
+  cat <<EOF
+Usage: $0 LAST_SPOTLIGHT_DATE
+
+Guide generation of GNU Spotlight since last date.
+LAST_SPOTLIGHT_DATE must be of the format YYYYMMDD.
+EOF
+
+  exit 64  # EX_USAGE
+}
+
+
+main()
+{
+  local -r last_date="${1?Missing end date}"
+
+  # sanity check, mostly, since we're about to issue `rm'
+  test -f "$makefile" || fail "missing $makefile"
+
+  cleanup
+  make-release-out "$last_date"
+  make-markdown
+}
+
+
+test $# -gt 0 || usage
+
+main "$@"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]