Hi! May be it would be useless? I wrote this when I download tce from other comp. (first I say - my english is not so greate ^:^))
#!/usr/local/bin/ruby
# tce.rb - script for find and get .tce* Tiny Core Linux file
# end of url-path
def short_name(line)
return line.to_s.split('/')[-1]
end
require 'open-uri'
$repository = 'http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/'
$tce_rep_prefix = '2.x/tce/'
$tce_html = 'tce_2x.html'
# just parse 'tce_2x.html' and puts all .tce* names to array (names $tce_base)
def build_base (repository, tce_html)
tce_base = []
html_list = open(repository + tce_html, 'User-Agent' => 'Ruby-Wget').read
arr = html_list.scan(%r{<td>\s*(.*)</td>})
for line in arr
if line.to_s.match(%r{(.+\.[tce|tcel|tcem])}) and not line.to_s.match(%r{\s})
tce_base.push(line)
end
end
return tce_base
end
$tce_base = build_base($repository, $tce_html)
# find matches of junked-name and .tce* files
def find_tce (junk_name)
result = []
for line in $tce_base
if line.to_s.scan(/#{junk_name}/i).length > 0
result.push($repository + $tce_rep_prefix + line.to_s)
end
end
return result
end
# look .dep files
def what_dep(junk_name)
for line in find_tce(junk_name)
begin
puts "\n--- #{short_name(line)} depends is : ---\n\n"
puts open(line.to_s + '.dep').read
rescue
puts "\n: No depends for #{short_name(line)} :)\n"
end
end
end
# look .info files
def info_tce(junk_name)
for line in find_tce(junk_name)
puts "\n--- #{short_name(line)} info ---\n\n"
puts open(line.to_s + '.info').read
end
end
# look .md5 files
def md5_tce(junk_name)
for line in find_tce(junk_name)
puts "\n--- #{short_name(line)} md5 sum : ---\n\n"
puts open(line.to_s + '.md5.txt').read
end
end
# download tce* files
def get_tce (junk_name)
for f in find_tce(junk_name)
open(f.to_s, 'rb') do |tce|
File.open(f.to_s.split('/')[-1], "wb") do |file|
file.write(tce.read)
end
end
end
end
# look server information about file
def get_meta (junk_name)
for f in find_tce(junk_name)
puts "\n--- Meta for #{short_name(f)} ---\n"
for tok in open(f.to_s).meta
puts tok
end
end
end
# simple usage :
case ARGV[0]
when '-find', '-f'
puts find_tce(ARGV[1])
when '-dep', '-d'
what_dep(ARGV[1])
when '-info', '-i'
info_tce(ARGV[1])
when '-md5'
md5_tce(ARGV[1])
when '-meta'
get_meta(ARGV[1])
when '-get', '-g'
puts get_tce(ARGV[1])
when '-help', '-h'
puts """
This is small tools which find, wget and view info about tce files - Tiny-Core-Linux extansion files.
Usage `./tcl.rb [options] [required-tce]' or `ruby tcl.rb [options] [required-tce]' if you'r ruby in a special place.
[required-tce] - is junked-string contain the name of extension, which you want.
[options] : -f, -find for find.
-d, -dep for see depends.
-i, -info for details information.
-md5 for look normall md5 summ
-meta for look server information about file - size, date, etc.
-g. -get ok, it's for wget-like.
-h, -help this message.
Example: gcc
first we find all gcc matching:
./tcl.rb -f gcc
then we can chose one and look depends and info:
./tcl.rb -i gcc.tcel
./tcl.rb -d gcc.tcel
and then reqursive process is starting - we must try it again for make, binutils, and other, while all depends not be installed. Then we can download all of it:
./tcl.rb -g gcc.tcel
./tcl.rb -g make
./tcl.rb -g m4.
...
Note: I think a .dep file must be more rightly! It would be can automating this process.
"""
end
so, it parsed main tce-html, it can w-get .dep, .info, .md5, and .tce*. What the main moral (and my [don't know word )) ] to developers) - build .dep file rightly - with truly enum dependes (oh...)
P.S. allso I prepare sbcl.tce for SBCL - binaries simply starting, but non-triviall compillation process also was success. I think SBCL work faster then other sistem.
(once more sory for en.)