wok rev 16778

Add tpp
author Paul Issott <paul@slitaz.org>
date Sun Jun 22 16:36:06 2014 +0100 (2014-06-22)
parents 8fcfcd2e1445
children 250bddc4f896
files tpp/receipt tpp/stuff/optional-x.patch tpp/stuff/ruby19.patch
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tpp/receipt	Sun Jun 22 16:36:06 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="tpp"
     1.7 +VERSION="1.3.1"
     1.8 +CATEGORY="utilities"
     1.9 +SHORT_DESC="Text presentation program."
    1.10 +MAINTAINER="paul@slitaz.org"
    1.11 +DEPENDS="ruby ruby-ncurses ncurses"
    1.12 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.13 +WEB_SITE="http://www.ngolde.de/tpp.html"
    1.14 +WGET_URL="http://www.ngolde.de/download/$TARBALL"
    1.15 +
    1.16 +# Rules to configure and make the package.
    1.17 +compile_rules()
    1.18 +{
    1.19 +	cd $src
    1.20 +	# use debian patches and fixes
    1.21 +	patch -i ../../stuff/ruby19.patch
    1.22 +	patch -i ../../stuff/optional-x.patch
    1.23 +	cd examples
    1.24 +	for tppfile in *.tpp; do 
    1.25 +  		iconv -f ISO-8859-1 -t UTF-8 -o $tppfile.new $tppfile && \
    1.26 +  		touch -r $tppfile $tppfile.new && \
    1.27 +  		mv $tppfile.new $tppfile
    1.28 +	done
    1.29 +	cd ..
    1.30 +	# make DESTDIR=$DESTDIR install
    1.31 +}
    1.32 +
    1.33 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.34 +genpkg_rules()
    1.35 +{
    1.36 +	mkdir -p $fs/usr/bin $fs/usr/share/doc/tpp/examples
    1.37 +	install $src/tpp.rb $fs/usr/bin/tpp
    1.38 +	install -m644 $src/examples/* $fs/usr/share/doc/tpp/examples
    1.39 +}
    1.40 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tpp/stuff/optional-x.patch	Sun Jun 22 16:36:06 2014 +0100
     2.3 @@ -0,0 +1,51 @@
     2.4 +Description: Don't execute commands with --exec by default
     2.5 +Author: Axel Beckert <abe@debian.org>
     2.6 +Debian-Bug: 706644
     2.7 +
     2.8 +Index: tpp/tpp.rb
     2.9 +===================================================================
    2.10 +--- tpp.orig/tpp.rb	2013-06-12 22:13:55.000000000 +0200
    2.11 ++++ tpp/tpp.rb	2013-06-12 22:15:08.000000000 +0200
    2.12 +@@ -725,9 +725,13 @@
    2.13 +   end
    2.14 + 
    2.15 +   def do_exec(cmdline)
    2.16 +-    rc = Kernel.system(cmdline)
    2.17 +-    if not rc then
    2.18 +-      # @todo: add error message
    2.19 ++    if $execok then
    2.20 ++      rc = Kernel.system(cmdline)
    2.21 ++      if not rc then
    2.22 ++        # @todo: add error message
    2.23 ++      end
    2.24 ++    else
    2.25 ++      @screen.addstr("--exec disabled by default for security reasons. Use option -x to enable it.")
    2.26 +     end
    2.27 +   end
    2.28 + 
    2.29 +@@ -1683,6 +1687,7 @@
    2.30 +   $stderr.puts "\t -t <type>\tset filetype <type> as output format"
    2.31 +   $stderr.puts "\t -o <file>\twrite output to file <file>"
    2.32 +   $stderr.puts "\t -s <seconds>\twait <seconds> seconds between slides (with -t autoplay)"
    2.33 ++  $stderr.puts "\t -x\t\tallow parsing of --exec in input files"
    2.34 +   $stderr.puts "\t --version\tprint the version"
    2.35 +   $stderr.puts "\t --help\t\tprint this help"
    2.36 +   $stderr.puts "\n\t currently available types: ncurses (default), autoplay, latex, txt"
    2.37 +@@ -1699,6 +1704,7 @@
    2.38 + output = nil
    2.39 + type = "ncurses"
    2.40 + time = 1
    2.41 ++$execok = nil
    2.42 + 
    2.43 + skip_next = false
    2.44 + 
    2.45 +@@ -1720,6 +1726,8 @@
    2.46 +     elsif ARGV[i] == "-s" then
    2.47 +       time = ARGV[i+1].to_i
    2.48 +       skip_next = true
    2.49 ++    elsif ARGV[i] == "-x" then
    2.50 ++      $execok = 1
    2.51 +     elsif input == nil then
    2.52 +       input = ARGV[i]
    2.53 +     end
    2.54 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tpp/stuff/ruby19.patch	Sun Jun 22 16:36:06 2014 +0100
     3.3 @@ -0,0 +1,294 @@
     3.4 +Description: make key events work on ruby 1.9 
     3.5 +Author: Chad Fowler <chad@chadfowler.com>
     3.6 +Debian-Bug: 671530
     3.7 +
     3.8 +Index: tpp/tpp.rb
     3.9 +===================================================================
    3.10 +--- tpp.orig/tpp.rb	2013-06-12 18:13:40.000000000 +0200
    3.11 ++++ tpp/tpp.rb	2013-06-12 21:05:55.000000000 +0200
    3.12 +@@ -44,7 +44,7 @@
    3.13 +                "blue" => 5,
    3.14 +                "cyan" => 6,
    3.15 +                "magenta" => 7,
    3.16 +-               "black" => 8, 
    3.17 ++               "black" => 8,
    3.18 +                "default" =>-1}
    3.19 +     colors[color]
    3.20 +   end
    3.21 +@@ -95,7 +95,7 @@
    3.22 + end # class FileParser
    3.23 + 
    3.24 + 
    3.25 +-# Represents a page (aka `slide') in TPP. A page consists of a title and one or 
    3.26 ++# Represents a page (aka `slide') in TPP. A page consists of a title and one or
    3.27 + # more lines.
    3.28 + class Page
    3.29 + 
    3.30 +@@ -145,8 +145,8 @@
    3.31 + 
    3.32 + 
    3.33 + 
    3.34 +-# Implements a generic visualizer from which all other visualizers need to be 
    3.35 +-# derived. If Ruby supported abstract methods, all the do_* methods would be 
    3.36 ++# Implements a generic visualizer from which all other visualizers need to be
    3.37 ++# derived. If Ruby supported abstract methods, all the do_* methods would be
    3.38 + # abstract.
    3.39 + class TppVisualizer
    3.40 + 
    3.41 +@@ -154,8 +154,8 @@
    3.42 +     # nothing
    3.43 +   end
    3.44 + 
    3.45 +-  # Splits a line into several lines, where each of the result lines is at most 
    3.46 +-  # _width_ characters long, caring about word boundaries, and returns an array 
    3.47 ++  # Splits a line into several lines, where each of the result lines is at most
    3.48 ++  # _width_ characters long, caring about word boundaries, and returns an array
    3.49 +   # of strings.
    3.50 +   def split_lines(text,width)
    3.51 +     lines = []
    3.52 +@@ -190,13 +190,13 @@
    3.53 +     $stderr.puts "Error: TppVisualizer#do_footer has been called directly."
    3.54 +     Kernel.exit(1)
    3.55 +   end
    3.56 +-  
    3.57 ++
    3.58 +   def do_header(header_text)
    3.59 +     $stderr.puts "Error: TppVisualizer#do_header has been called directly."
    3.60 +     Kernel.exit(1)
    3.61 +   end
    3.62 + 
    3.63 +-    
    3.64 ++
    3.65 +   def do_refresh
    3.66 +     $stderr.puts "Error: TppVisualizer#do_refresh has been called directly."
    3.67 +     Kernel.exit(1)
    3.68 +@@ -316,7 +316,7 @@
    3.69 +     $stderr.puts "Error: TppVisualizer#do_command_prompt has been called directly."
    3.70 +     Kernel.exit(1)
    3.71 +   end
    3.72 +-  
    3.73 ++
    3.74 +   def do_beginslideright
    3.75 +     $stderr.puts "Error: TppVisualizer#do_beginslideright has been called directly."
    3.76 +     Kernel.exit(1)
    3.77 +@@ -377,7 +377,7 @@
    3.78 +     Kernel.exit(1)
    3.79 +   end
    3.80 + 
    3.81 +-  # Receives a _line_, parses it if necessary, and dispatches it 
    3.82 ++  # Receives a _line_, parses it if necessary, and dispatches it
    3.83 +   # to the correct method which then does the correct processing.
    3.84 +   # It returns whether the controller shall wait for input.
    3.85 +   def visualize(line,eop)
    3.86 +@@ -446,10 +446,10 @@
    3.87 +         do_huge(figlet_text)
    3.88 +       when /^--footer /
    3.89 +         @footer_txt = line.sub(/^--footer /,"")
    3.90 +-        do_footer(@footer_txt) 
    3.91 ++        do_footer(@footer_txt)
    3.92 +       when /^--header /
    3.93 +         @header_txt = line.sub(/^--header /,"")
    3.94 +-        do_header(@header_txt) 
    3.95 ++        do_header(@header_txt)
    3.96 +       when /^--title /
    3.97 +         title = line.sub(/^--title /,"")
    3.98 +         do_title(title)
    3.99 +@@ -547,7 +547,7 @@
   3.100 +     @withborder = true
   3.101 +     draw_border
   3.102 +   end
   3.103 +-  
   3.104 ++
   3.105 +   def do_command_prompt()
   3.106 +     message = "Press any key to continue :)"
   3.107 +     cursor_pos = 0
   3.108 +@@ -614,11 +614,11 @@
   3.109 +     (@termwidth-2).times { @screen.addstr("-") }; @screen.addstr("'")
   3.110 +     1.upto(@termheight-3) do |y|
   3.111 +       @screen.move(y,0)
   3.112 +-      @screen.addstr("|") 
   3.113 ++      @screen.addstr("|")
   3.114 +     end
   3.115 +     1.upto(@termheight-3) do |y|
   3.116 +       @screen.move(y,@termwidth-1)
   3.117 +-      @screen.addstr("|") 
   3.118 ++      @screen.addstr("|")
   3.119 +     end
   3.120 +   end
   3.121 + 
   3.122 +@@ -700,7 +700,7 @@
   3.123 +   end
   3.124 + 
   3.125 +   def show_help_page
   3.126 +-    help_text = [ "tpp help", 
   3.127 ++    help_text = [ "tpp help",
   3.128 +                   "",
   3.129 +                   "space bar ............................... display next entry within page",
   3.130 +                   "space bar, cursor-down, cursor-right .... display next page",
   3.131 +@@ -775,7 +775,7 @@
   3.132 +     @screen.move(@termheight - 3, (@termwidth - footer_txt.length)/2)
   3.133 +     @screen.addstr(footer_txt)
   3.134 +   end
   3.135 +- 
   3.136 ++
   3.137 +  def do_header(header_txt)
   3.138 +     @screen.move(@termheight - @termheight+1, (@termwidth - header_txt.length)/2)
   3.139 +     @screen.addstr(header_txt)
   3.140 +@@ -918,7 +918,7 @@
   3.141 +         time_to_sleep = 1.to_f / 20
   3.142 +         Kernel.sleep(time_to_sleep)
   3.143 +         xcount -= 1
   3.144 +-      end  
   3.145 ++      end
   3.146 +     when "right"
   3.147 +       (@termwidth - @indent).times do |pos|
   3.148 +         @screen.move(@cur_line,@termwidth - pos - 1)
   3.149 +@@ -991,7 +991,7 @@
   3.150 +       @screen.move(line,col*15 + 2)
   3.151 +       if current_page == i then
   3.152 +         @screen.printw("%2d %s <=",i+1,pages[i].title[0..80])
   3.153 +-      else  
   3.154 ++      else
   3.155 +         @screen.printw("%2d %s",i+1,pages[i].title[0..80])
   3.156 +       end
   3.157 +       line += 1
   3.158 +@@ -1092,7 +1092,7 @@
   3.159 + 
   3.160 +   def do_footer(footer_text)
   3.161 +   end
   3.162 +-  
   3.163 ++
   3.164 +   def do_header(header_text)
   3.165 +   end
   3.166 + 
   3.167 +@@ -1166,7 +1166,7 @@
   3.168 + 
   3.169 +   def do_revon
   3.170 +   end
   3.171 +- 
   3.172 ++
   3.173 +   def do_command_prompt
   3.174 +   end
   3.175 +   def do_revoff
   3.176 +@@ -1183,7 +1183,7 @@
   3.177 + 
   3.178 +   def do_endslide
   3.179 +   end
   3.180 +-  
   3.181 ++
   3.182 +   def do_beginslideright
   3.183 +   end
   3.184 + 
   3.185 +@@ -1349,7 +1349,7 @@
   3.186 + 
   3.187 + end
   3.188 + 
   3.189 +-# Implements an interactive controller which feeds the visualizer until it is 
   3.190 ++# Implements an interactive controller which feeds the visualizer until it is
   3.191 + # told to stop, and then reads a key press and executes the appropiate action.
   3.192 + class InteractiveController < TppController
   3.193 + 
   3.194 +@@ -1396,17 +1396,17 @@
   3.195 +       loop do
   3.196 +         ch = @vis.get_key
   3.197 +         case ch
   3.198 +-          when 'q'[0], 'Q'[0] # 'Q'uit
   3.199 ++          when ?q.ord, ?Q.ord # 'Q'uit
   3.200 +             return
   3.201 +-          when 'r'[0], 'R'[0] # 'R'edraw slide
   3.202 ++          when ?r.ord, ?R.ord # 'R'edraw slide
   3.203 +             changed_page = true # @todo: actually implement redraw
   3.204 +-          when 'e'[0], 'E'[0]
   3.205 ++          when ?e.ord, ?E.ord
   3.206 +             @cur_page = @pages.size - 1
   3.207 +             break
   3.208 +-          when 's'[0], 'S'[0]
   3.209 ++          when ?s.ord, ?S.ord
   3.210 +             @cur_page = 0
   3.211 +             break
   3.212 +-          when 'j'[0], 'J'[0] # 'J'ump to slide
   3.213 ++          when ?j.ord, ?J.ord # 'J'ump to slide
   3.214 +             screen = @vis.store_screen
   3.215 +             p = @vis.read_newpage(@pages,@cur_page)
   3.216 +             if p >= 0 and p < @pages.size
   3.217 +@@ -1417,28 +1417,28 @@
   3.218 +               @vis.restore_screen(screen)
   3.219 +             end
   3.220 +             break
   3.221 +-          when 'l'[0], 'L'[0] # re'l'oad current file
   3.222 ++          when ?l.ord, ?L.ord # re'l'oad current file
   3.223 +             @reload_file = true
   3.224 +             return
   3.225 +-          when 'c'[0], 'C'[0] # command prompt
   3.226 ++          when ?c.ord, ?C.ord # command prompt
   3.227 +             screen = @vis.store_screen
   3.228 +             @vis.do_command_prompt
   3.229 +             @vis.clear
   3.230 +             @vis.restore_screen(screen)
   3.231 +-          when '?'[0], 'h'[0]
   3.232 ++          when ??.ord, ?h.ord
   3.233 +             screen = @vis.store_screen
   3.234 +             @vis.show_help_page
   3.235 +             ch = @vis.get_key
   3.236 +             @vis.clear
   3.237 +             @vis.restore_screen(screen)
   3.238 +-          when :keyright, :keydown, ' '[0]
   3.239 ++          when :keyright, :keydown, ' '.ord
   3.240 +             if @cur_page + 1 < @pages.size and eop then
   3.241 +               @cur_page += 1
   3.242 +               @pages[@cur_page].reset_eop
   3.243 +               @vis.new_page
   3.244 +             end
   3.245 +             break
   3.246 +-          when 'b'[0], 'B'[0], :keyleft, :keyup
   3.247 ++          when ?b.ord, ?B.ord, :keyleft, :keyup
   3.248 +             if @cur_page > 0 then
   3.249 +               @cur_page -= 1
   3.250 +               @pages[@cur_page].reset_eop
   3.251 +@@ -1455,7 +1455,7 @@
   3.252 + end
   3.253 + 
   3.254 + 
   3.255 +-# Implements a visualizer which converts TPP source to a nicely formatted text 
   3.256 ++# Implements a visualizer which converts TPP source to a nicely formatted text
   3.257 + # file which can e.g. be used as handout.
   3.258 + class TextVisualizer < TppVisualizer
   3.259 + 
   3.260 +@@ -1475,7 +1475,7 @@
   3.261 + 
   3.262 +   def do_footer(footer_text)
   3.263 +   end
   3.264 +-  
   3.265 ++
   3.266 +   def do_header(header_text)
   3.267 +   end
   3.268 + 
   3.269 +@@ -1539,7 +1539,7 @@
   3.270 + 
   3.271 +   def do_revon
   3.272 +   end
   3.273 +- 
   3.274 ++
   3.275 +   def do_command_prompt
   3.276 +   end
   3.277 +   def do_revoff
   3.278 +@@ -1556,7 +1556,7 @@
   3.279 + 
   3.280 +   def do_endslide
   3.281 +   end
   3.282 +-  
   3.283 ++
   3.284 +   def do_beginslideright
   3.285 +   end
   3.286 + 
   3.287 +@@ -1650,8 +1650,8 @@
   3.288 + 
   3.289 + end
   3.290 + 
   3.291 +-# Implements a non-interactive controller to control non-interactive 
   3.292 +-# visualizers (i.e. those that are used for converting TPP source code into 
   3.293 ++# Implements a non-interactive controller to control non-interactive
   3.294 ++# visualizers (i.e. those that are used for converting TPP source code into
   3.295 + # another format)
   3.296 + class ConversionController < TppController
   3.297 +