commit-womb
[Top][All Lists]
Advanced

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

[commit-womb] gnumaint/rec gnupackages2txt.awk


From: Mike Gerwitz
Subject: [commit-womb] gnumaint/rec gnupackages2txt.awk
Date: Fri, 15 Jun 2018 00:05:40 -0400 (EDT)

CVSROOT:        /sources/womb
Module name:    gnumaint
Changes by:     Mike Gerwitz <mikegerwitz>      18/06/15 00:05:40

Added files:
        rec            : gnupackages2txt.awk 

Log message:
        Summary: rec/gnupackages2txt.awk: Initial concept
        
        This does the bulk of the work, but there are still some odd situations 
to
        deal with, like multiple releases (e.g. GCC).
        
        * rec/gnupackages2txt.awk: New file.

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

Patches:
Index: gnupackages2txt.awk
===================================================================
RCS file: gnupackages2txt.awk
diff -N gnupackages2txt.awk
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gnupackages2txt.awk 15 Jun 2018 04:05:40 -0000      1.1
@@ -0,0 +1,85 @@
+# $Id: gnupackages2txt.awk,v 1.1 2018/06/15 04:05:40 mikegerwitz Exp $
+# gnupackages.rec to old gnupackages.txt
+#
+#  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 converts the gnupackages.rec recfile into the old txt format
+# that used to be committed directly to the repository.
+#
+# THIS SCRIPT IS A WORK-IN-PROGRESS; DO NOT USE IT!
+
+BEGIN {
+    FS = OFS = ": "
+}
+
+# recfile headers (replace the first one with a warning)
+/^%rec:/ {
+    print "# THIS FILE IS NOW GENERATED FROM rec/gnupackages.rec;"
+    print "# DO NOT MODIFY DIRECTLY!"
+}
+/^%/ { next }
+
+$1 == "package" {
+    package = $1
+}
+$1 && $2 {
+    set_key( package, $1, $2 )
+}
+
+$1 ~ /^last_release/ { next }
+$1 == "activity_status" || $1 == "last_activity" { next }
+
+# end of package block
+!$1 && package {
+    print "activity-status", activity( package )
+
+    package = ""
+}
+
+{
+    # recfiles use snake case and gnupackages.txt uses dashes
+    gsub( /_/, "-", $1 )
+    print
+}
+
+
+# TODO: handle multiple versions (will need to track multiple 
last_release{,_date})
+function activity( pkgid,  status, last )
+{
+    status = get_key( pkgid, "activity_status" )
+    last   = get_key( pkgid, "last_activity" )
+
+    if ( status == "newcomaint" ) {
+        status = status "/" last
+    }
+
+    return status " " \
+        get_key( pkgid, "last_release_date" ) \
+        " (" get_key( pkgid, "last_release" ) ")"
+}
+
+
+# TODO: support multiple values for the same key (see above TODO)
+function set_key( pkgid, key, value )
+{
+    pkginfo[pkgid][key] = value
+}
+
+
+function get_key( pkgid, key )
+{
+    return pkginfo[pkgid][key]
+}



reply via email to

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