gsrc-commit
[Top][All Lists]
Advanced

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

[Gsrc-commit] trunk r2636: add womb syncing script


From: Brandon Invergo
Subject: [Gsrc-commit] trunk r2636: add womb syncing script
Date: Tue, 05 Nov 2013 22:52:22 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 2636
revision-id: address@hidden
parent: address@hidden
committer: Brandon Invergo <address@hidden>
branch nick: trunk
timestamp: Tue 2013-11-05 23:52:11 +0100
message:
  add womb syncing script
added:
  util/sync-descriptions.sh      
syncdescriptions.sh-20131105225202-05ai899jsmvyloki-1
=== added file 'util/sync-descriptions.sh'
--- a/util/sync-descriptions.sh 1970-01-01 00:00:00 +0000
+++ b/util/sync-descriptions.sh 2013-11-05 22:52:11 +0000
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+# sync-descriptions.sh --- sync package descriptions with Womb
+
+# Copyright (C) 2013 Brandon Invergo <address@hidden>
+
+# Author: Brandon Invergo <address@hidden>
+
+# 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/>.
+
+GNUMAINT=$HOME/Projects/gnu/womb/gnumaint
+PKGS=$GNUMAINT/gnupackages.txt
+BLURBS=$GNUMAINT/pkgblurbs.txt
+GSRC=$HOME/Projects/gsrc/trunk
+
+get_pkg_info () {
+    sed -n "/^package: $1\$/,/^$/p" $2
+}
+
+get_desc () {
+    pkg_info=`get_pkg_info $1 $PKGS`
+    sed -n '/doc-summary/{s/doc-summary: \(.*\)/\1/;p}' <<EOF
+$pkg_info
+EOF
+}
+
+get_blurb () {
+    pkg_info=`get_pkg_info $1 $BLURBS`
+    sed '/^package: /d;s/blurb: //;s/^\+ //;/^$/d' <<EOF
+$pkg_info
+EOF
+}
+
+null_desc_p () {
+    grep -q '^null \(.*\)' <<EOF
+$1
+EOF
+}
+
+redirect_p () {
+    grep -q '^redirect \(.*\)' <<EOF
+$1
+EOF
+}
+
+for d in $GSRC/gnu/*; do
+    pkg=`basename "$d"`
+    mk="${d}/Makefile"
+    temp="${mk}.temp"
+    desc=`get_desc $pkg`
+    blurb=`get_blurb $pkg`
+    if [[ $desc != "" ]]; then
+        if ! grep -q "$desc" $mk; then
+            sed -i "s|DESCRIPTION = .*|DESCRIPTION = $desc|" $mk
+            echo "$pkg desc"
+        fi
+    fi
+    redirect_p "$blurb" && continue
+    null_desc_p "$blurb" && continue
+    if ! grep -q "$blurb" $mk; then
+        printf "`sed -n '1,/define BLURB/p' $mk`\n$blurb\n`sed -n '/endef/,$p' 
$mk`\n" >$temp
+        mv $temp $mk
+        echo "$pkg blurb"
+    fi
+done


reply via email to

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