commit efe53381fb6bab906694d81e2578d6479a7f3c27
Author: kura <[email protected]>
Date:   Wed Dec 15 07:41:27 1999 +0000

    version 0.8
    - added formating descriptions
    - fixed deleting space in first line
    
    Changed files:
        adapter.awk -> 1.10

 adapter.awk | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
---
diff --git a/adapter.awk b/adapter.awk
index 39cb6aa..a0cf90a 100644
--- a/adapter.awk
+++ b/adapter.awk
@@ -1,16 +1,19 @@
 #!/bin/awk -f
 #
-# This is adapter v0.7. Adapter adapts .spec files for PLD.
+# This is adapter v0.8. Adapter adapts .spec files for PLD.
 # Copyright (C) 1999 Micha� Kuratczyk <[email protected]>
 
 BEGIN {
        preamble = 1;
        bof = 1;        # Beggining of file
        boc = 2;        # Beggining of %changelog
+       bod = 0;        # Beggining of %description
+       tw = 77;        # Descriptions width    
 }
 
 # There should be a comment with CVS keywords on the first line of file.
 bof == 1 {
+       preamble = 0;
        if (!/# \$Revision:/)
                 print "# $" "Revision:$, " "$" "Date:$";
        bof = 0;
@@ -19,6 +22,9 @@ bof == 1 {
 # descriptions:
 /%description/, (/^%[a-z]+/ && !/%description/) {
        preamble = 0;
+
+       if (/^%description/)
+               bod++;
        
        # Define _prefix and _mandir if it is X11 application
        if (/^%description$/ && x11 == 1) {
@@ -26,6 +32,39 @@ bof == 1 {
                print "%define\t\t_mandir\t\t%{_prefix}/man\n";
                x11 == 2;
        }
+
+        # Collect whole text of description
+       if (description == 1 && !/^%[a-z]+/ && !/%description/) {
+               description_text = description_text $0 " ";
+               next;
+       }
+ 
+       # Formt description to the length of tw (default == 77)
+       if (/^%[a-z]+/ && (!/%description/ || bod == 2)) {
+               n = split(description_text, dt, / /);
+               for (i = 1; i <= n; i++) {
+                       if (length(line) + length(dt[i]) + 1 < tw)
+                               line = line dt[i] " ";
+                       else {
+                               print line;
+                               line = "";
+                               i--;
+                       }
+               }
+
+               print line "\n";
+               line = "";
+               delete dt;
+               description_text = "";
+               if (bod == 2) {
+                       bod = 1;
+                       description = 1;
+               } else {
+                       bod = 0;
+                       description = 0;
+               }
+       } else
+               description = 1;
 }
 
 # %prep section:
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/adapter.git/commitdiff/6ca0126d4d0c8c79feb7db10b0a0fade0f3b8885

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to