summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Gordon <assafgordon@gmail.com>2014-10-19 20:32:52 (GMT)
committerA. Gordon <assafgordon@gmail.com>2014-10-19 20:32:52 (GMT)
commit3e7ceb84389ecd9ac5bb30ef0addd399cedb7f3d (patch)
tree8be2eb5ed76c03c4b9c44783e53bf3fb4088c45a
parenta27b2fdc8d8f8bcff604033d5e789439c640eb9d (diff)
downloadgnu-sv-gitweb-3e7ceb84389ecd9ac5bb30ef0addd399cedb7f3d.zip
gnu-sv-gitweb-3e7ceb84389ecd9ac5bb30ef0addd399cedb7f3d.tar.gz
gnu-sv-gitweb-3e7ceb84389ecd9ac5bb30ef0addd399cedb7f3d.tar.bz2
Savannah: add 'create-projects-list.sh' script
-rw-r--r--savannah/README-SV.md15
-rwxr-xr-xsavannah/create-projects-list.sh65
2 files changed, 80 insertions, 0 deletions
diff --git a/savannah/README-SV.md b/savannah/README-SV.md
index 7c84926..0b05b6f 100644
--- a/savannah/README-SV.md
+++ b/savannah/README-SV.md
@@ -54,3 +54,18 @@ the first part of the filename (up to the '@' character).
On the GitWeb Server, extract the tarball content into the `gitolite-admin`
directory, commit the changes and push.
+
+
+## create-projects-list.txt
+
+The script creates a text file containing the list of all public projects
+hosted on GNU Savannah, and their types: GNU, Non-GNU, Translation, WWW .
+
+This file should be copied to the Web server. The update scripts on the web
+server (which pull git changes to update the website) use this file to ensure
+only valid projects and updated, and are put in the correct place
+(gnu/non-gnu/translation/www use different directories).
+
+A possible improvement is to fetch this information automatically from the
+GitWeb server, avoiding the need to update a file on the Web server when
+a new project is added.
diff --git a/savannah/create-projects-list.sh b/savannah/create-projects-list.sh
new file mode 100755
index 0000000..a57fa55
--- /dev/null
+++ b/savannah/create-projects-list.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# Copyright (C) 2014 Assaf Gordon (assafgordon@gmail.com)
+#
+# 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/>.
+
+##
+## Creates a text file listing all projects, and their type.
+## Example:
+## texinfo gnu
+## coreutils gnu
+## lwip nongnu
+## www-es translation
+## www www
+
+die()
+{
+ BASE=$(basename "$0")
+ echo "$BASE: error: $@" >&2
+ exit 1
+}
+
+
+## MySQL Databasename
+DB=${1:-savane}
+
+## Test DB connection
+echo | mysql "$DB" \
+ || die "failed to connect to mysql database '$DB'. " \
+ "Optionally use a different DB name as first command-line argument. "
+
+SQL="
+SELECT
+ unix_group_name,
+ CASE WHEN unix_group_name = 'www' THEN 'www'
+ WHEN type=1 THEN 'gnu'
+ WHEN type=2 THEN 'nongnu'
+ WHEN type=6 THEN 'translation' END as type
+FROM
+ groups
+WHERE
+ is_public=1 AND status='A' AND
+ (type=1 OR type=2 OR type=6)
+ORDER by unix_group_name"
+
+mysql -e "$SQL" --batch "$DB" > gnu-sv-projects-list.txt \
+ || die "failed to create project list from MYSQL query"
+
+sed -i 1d gnu-sv-projects-list.txt \
+ || die "failed to remove first line in gnu-sv-projects-list.txt"
+
+## vim: set shiftwidth=4:
+## vim: set tabstop=4:
+## vim: set expandtab: