development/tclvfs: Added (virtial filesystem extension for Tcl)

Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
This commit is contained in:
Zbigniew Baniewski 2011-01-09 01:41:17 -02:00 committed by Robby Workman
parent 82ad914bfc
commit 8f2a74049e
10 changed files with 456 additions and 0 deletions

View file

@ -0,0 +1,2 @@
The TclVfs project aims to provide an extension to the Tcl language which
allows Virtual Filesystems to be built using Tcl scripts only.

View file

@ -0,0 +1,30 @@
All the patches are taken from Debian repo
--- tclvfs-1.3-20080503.orig/configure
+++ tclvfs-1.3-20080503/configure
@@ -7937,12 +7937,15 @@
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
+ # following line added by CW for Debian GNU/Hurd
+ TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\${TCL_LIB_FILE}.0"
+
SHLIB_LD="${CC} -shared"
- DL_OBJS=""
+ DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS="${CC_SEARCH_FLAGS}"
if test "`uname -m`" = "alpha" ; then
CFLAGS="$CFLAGS -mieee"
fi
@@ -9803,7 +9806,6 @@
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
s/^\([^=]*=[ ]*\):*/\1/;

View file

@ -0,0 +1,179 @@
Patch by Sergei Golovan (initially by Victor Wagner taken from
http://sourceforge.net/tracker/index.php?func=detail&aid=1011498&group_id=32692&atid=406308)
fixes -encoding and -eofchar of files opened on VFS.
Probably, the patch is incomplete for mk4fs with ::mk4vfs::zstreamed set to 1.
--- tclvfs-1.3-20080503.orig/library/ftpvfs.tcl
+++ tclvfs-1.3-20080503/library/ftpvfs.tcl
@@ -133,10 +133,13 @@
ftp::Get $fd $name -variable tmp
set filed [vfs::memchan]
+ set encoding [fconfigure $filed -encoding]
+ set eofchar [fconfigure $filed -eofchar]
+ set translation [fconfigure $filed -translation]
fconfigure $filed -translation binary
puts -nonewline $filed $tmp
- fconfigure $filed -translation auto
+ fconfigure $filed -translation $translation -encoding $encoding -eofchar $eofchar
seek $filed 0
return [list $filed]
}
--- tclvfs-1.3-20080503.orig/library/httpvfs.tcl
+++ tclvfs-1.3-20080503/library/httpvfs.tcl
@@ -357,11 +357,14 @@
"r" {
set token [geturl "$dirurl$urlname" -headers $headers]
set filed [vfs::memchan]
+ set encoding [fconfigure $filed -encoding]
+ set eofchar [fconfigure $filed -eofchar]
+ set translation [fconfigure $filed -translation]
fconfigure $filed -translation binary
puts -nonewline $filed [::http::data $token]
http::cleanup $token
- fconfigure $filed -translation auto
+ fconfigure $filed -translation $translation -encoding $encoding -eofchar $eofchar
seek $filed 0
# XXX: the close command should free vfs::memchan somehow??
return [list $filed]
--- tclvfs-1.3-20080503.orig/library/tclprocvfs.tcl
+++ tclvfs-1.3-20080503/library/tclprocvfs.tcl
@@ -84,9 +84,12 @@
"" -
"r" {
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
puts -nonewline $nfd [_generate ::${ns}::${name}]
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- tclvfs-1.3-20080503.orig/library/webdavvfs.tcl
+++ tclvfs-1.3-20080503/library/webdavvfs.tcl
@@ -153,8 +153,12 @@
upvar #0 $token state
set filed [vfs::memchan]
+ set encoding [fconfigure $filed -encoding]
+ set eofchar [fconfigure $filed -eofchar]
+ set translation [fconfigure $filed -translation]
fconfigure $filed -encoding binary -translation binary
puts -nonewline $filed [::http::data $token]
+ fconfigure $filed -translation $translation -encoding $encoding -eofchar $eofchar
seek $filed 0
::http::cleanup $token
return [list $filed]
--- tclvfs-1.3-20080503.orig/library/tkvfs.tcl
+++ tclvfs-1.3-20080503/library/tkvfs.tcl
@@ -72,9 +72,12 @@
"" -
"r" {
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
puts -nonewline $nfd [_generate ${widg}.${name}]
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- tclvfs-1.3-20080503.orig/library/tarvfs.tcl
+++ tclvfs-1.3-20080503/library/tarvfs.tcl
@@ -107,6 +107,9 @@
::tar::stat $tarfd $name sb
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
# get the starting point from structure
@@ -115,7 +118,7 @@
puts -nonewline $nfd $data
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- tclvfs-1.3-20080503.orig/library/zipvfs.tcl
+++ tclvfs-1.3-20080503/library/zipvfs.tcl
@@ -108,6 +108,9 @@
::zip::stat $zipfd $name sb
set nfd [vfs::memchan]
+ set encoding [fconfigure $nfd -encoding]
+ set eofchar [fconfigure $nfd -eofchar]
+ set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
seek $zipfd $sb(ino) start
@@ -115,7 +118,7 @@
puts -nonewline $nfd $data
- fconfigure $nfd -translation auto
+ fconfigure $nfd -translation $translation -encoding $encoding -eofchar $eofchar
seek $nfd 0
return [list $nfd]
}
--- tclvfs-1.3-20080503.orig/library/mk4vfs.tcl
+++ tclvfs-1.3-20080503/library/mk4vfs.tcl
@@ -183,19 +183,25 @@
set fd [vfs::zstream decompress $fd $sb(csize) $sb(size)]
} else {
set fd [vfs::memchan]
+ set encoding [fconfigure $fd -encoding]
+ set eofchar [fconfigure $fd -eofchar]
+ set translation [fconfigure $fd -translation]
fconfigure $fd -translation binary
set s [mk::get $sb(ino) contents]
puts -nonewline $fd [vfs::zip -mode decompress $s]
- fconfigure $fd -translation auto
+ fconfigure $fd -translation $translation -encoding $encoding -eofchar $eofchar
seek $fd 0
}
} elseif { $::mk4vfs::direct } {
set fd [vfs::memchan]
+ set encoding [fconfigure $fd -encoding]
+ set eofchar [fconfigure $fd -eofchar]
+ set translation [fconfigure $fd -translation]
fconfigure $fd -translation binary
puts -nonewline $fd [mk::get $sb(ino) contents]
- fconfigure $fd -translation auto
+ fconfigure $fd -translation $translation -encoding $encoding -eofchar $eofchar
seek $fd 0
} else {
set fd [mk::channel $sb(ino) contents r]
@@ -226,6 +232,9 @@
}
set fd [vfs::memchan]
+ set encoding [fconfigure $fd -encoding]
+ set eofchar [fconfigure $fd -eofchar]
+ set translation [fconfigure $fd -translation]
fconfigure $fd -translation binary
set s [mk::get $sb(ino) contents]
@@ -237,7 +246,7 @@
puts -nonewline $fd $s
#set fd [mk::channel $sb(ino) contents a]
}
- fconfigure $fd -translation auto
+ fconfigure $fd -translation $translation -encoding $encoding -eofchar $eofchar
seek $fd 0 end
return [list $fd [list mk4vfs::do_close $db $fd $mode $sb(ino)]]
}

View file

@ -0,0 +1,21 @@
--- tclvfs-1.3-20080503.orig/tclconfig/tcl.m4
+++ tclvfs-1.3-20080503/tclconfig/tcl.m4
@@ -1486,12 +1486,15 @@
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
+ # following line added by CW for Debian GNU/Hurd
+ TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\${TCL_LIB_FILE}.0"
+
SHLIB_LD="${CC} -shared"
- DL_OBJS=""
+ DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
CC_SEARCH_FLAGS=""
- LD_SEARCH_FLAGS=""
+ LD_SEARCH_FLAGS="${CC_SEARCH_FLAGS}"
if test "`uname -m`" = "alpha" ; then
CFLAGS="$CFLAGS -mieee"
fi

View file

@ -0,0 +1,33 @@
--- tclvfs-1.3-20080503.orig/doc/vfs.n
+++ tclvfs-1.3-20080503/doc/vfs.n
@@ -138,7 +138,7 @@
\fImount.zip\fR is a zip archive which has been mounted (on top of
itself) and contains \fIxxx/yyy\fR, and the current working directory
is inside \fIxxx\fR, and we evaluate a command like \fIfile exists
-yyy\fR, then \fIroot\R will be \fIC:/foo/bar/mount.zip\fR,
+yyy\fR, then \fIroot\fR will be \fIC:/foo/bar/mount.zip\fR,
\fIrelative\fR will be \fIxxx/yyy\fR, and \fIactualpath\fR will be
\fIyyy\fR. The file separator between the \fIroot\fR and \fIrelative\fR
is omitted.
@@ -218,7 +218,7 @@
Delete the given directory. \fIrecursive\fR is either 0 or 1. If
it is 1 then even if the directory is non-empty, an attempt should
be made to recursively delete it and its contents. If it is 0 and
-the directory is non-empty, a posix error (EEXIST) should be
+the directory is non-empty, a posix error (ENOTEMPTY) should be
thrown.
.TP
\fIcommand\fR \fIstat\fR \fIr-r-a\fR
--- tclvfs-1.3-20080503.orig/doc/vfslib.n
+++ tclvfs-1.3-20080503/doc/vfslib.n
@@ -58,8 +58,8 @@
.PP
The current supported types are ftp, tar, http, zip, mk4, ns, webdav. In
addition there is the ability to mount any 'urltype' as a new volume,
-provided an appropriate vfs is supported. This means that you can treat
-'ftp://', 'http://' and 'file://' urls as files. To do this, simply
+provided an appropriate vfs is supported. This means that you can
+treat 'ftp://', 'http://' and 'file://' urls as files. To do this, simply
evaluate the command
.PP
\fIvfs::urltype::Mount ftp\fR

View file

@ -0,0 +1,28 @@
Debian-specific patch by Sergei Golovan which replaces current directory
for tclvfs library by a fixed one.
--- tclvfs-1.3-20080503.orig/pkgIndex.tcl.in
+++ tclvfs-1.3-20080503/pkgIndex.tcl.in
@@ -12,19 +12,18 @@
package require Tcl 8.4
namespace eval ::vfs {}
-variable vfs::dll [file join $dir @PKG_LIB_FILE@]
+variable vfs::dll [file join /usr/lib @PACKAGE_NAME@@PACKAGE_VERSION@ @PKG_LIB_FILE@]
-proc loadvfs {dll} {
+proc loadvfs {dir dll} {
global auto_path
if {![file exists $dll]} { return }
- set dir [file dirname $dll]
if {[lsearch -exact $auto_path $dir] == -1} {
lappend auto_path $dir
}
load $dll
}
-package ifneeded vfs @PACKAGE_VERSION@ [list loadvfs $vfs::dll]
+package ifneeded vfs @PACKAGE_VERSION@ [list loadvfs $dir $vfs::dll]
# Allow optional redirect of VFS_LIBRARY components. Only necessary
# for testing, but could be used elsewhere.

View file

@ -0,0 +1,41 @@
Patch by Victor Wagner (modified by Sergei Golovan for archives less
than 512 bytes long) fixes zip vfs to work with prepended executable.
--- tclvfs-1.3-20080503.orig/library/zipvfs.tcl
+++ tclvfs-1.3-20080503/library/zipvfs.tcl
@@ -113,7 +113,8 @@
set translation [fconfigure $nfd -translation]
fconfigure $nfd -translation binary
- seek $zipfd $sb(ino) start
+ upvar #0 zip::$zipfd cb
+ seek $zipfd [expr {$sb(ino)+$cb(base)}] start
zip::Data $zipfd sb data
puts -nonewline $nfd $data
@@ -370,6 +371,7 @@
seek $fd $n end
set hdr [read $fd $len]
+ set read [string length $hdr]
set pos [string first "PK\05\06" $hdr]
if {$pos == -1} {
if {$at >= $sz} {
@@ -384,7 +386,7 @@
}
set hdr [string range $hdr [expr $pos + 4] [expr $pos + 21]]
- set pos [expr [tell $fd] + $pos - 512]
+ set pos [expr [tell $fd] + $pos - $read]
binary scan $hdr ssssiis \
cb(ndisk) cb(cdisk) \
@@ -445,7 +447,7 @@
zip::EndOfArchive $fd cb
- seek $fd $cb(coff) start
+ seek $fd [expr {$cb(coff)+$cb(base)}] start
set toc(_) 0; unset toc(_); #MakeArray

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
tclvfs: tclvfs (virtial filesystem extension for Tcl)
tclvfs:
tclvfs: The TclVfs project aims to provide an extension to the Tcl language
tclvfs: which allows Virtual Filesystems to be built using Tcl scripts only.
tclvfs:
tclvfs: http://sourceforge.net/projects/tclvfs/
tclvfs:
tclvfs:
tclvfs:
tclvfs:
tclvfs:

View file

@ -0,0 +1,93 @@
#!/bin/sh
# Slackware build script for tclvfs
# Written by Zbigniew Baniewski, zb@ispid.com.pl
PRGNAM=tclvfs
VERSION=20080503
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/${PRGNAM}-${VERSION}.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
cat $CWD/patches/01-configure.patch | patch -p1 || exit
cat $CWD/patches/02-encoding.patch | patch -p1 || exit
cat $CWD/patches/03-m4.patch | patch -p1 || exit
cat $CWD/patches/04-man.patch | patch -p1 || exit
cat $CWD/patches/05-pkgindex.patch | patch -p1 || exit
cat $CWD/patches/06-zipfix.patch | patch -p1 || exit
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
CPPFLAGS="-I/usr/include/tcl-private/generic" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--with-tcl=/usr/lib${LIBDIRSUFFIX} \
--with-tclinclude=/usr/include/tcl-private/generic \
--with-tk=/usr/lib${LIBDIRSUFFIX} \
--with-tkinclude=/usr/include/tk-private/generic \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a ChangeLog license.terms Readme.txt examples tests $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,10 @@
PRGNAM="tclvfs"
VERSION="20080503"
HOMEPAGE="http://sourceforge.net/projects/tclvfs/"
DOWNLOAD="http://downloads.sourceforge.net/tclvfs/tclvfs-20080503.tar.gz"
MD5SUM="3f6dbec91a305f97475d155ca6b1b563"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
MAINTAINER="Zbigniew Baniewski"
EMAIL="zb@ispid.com.pl"
APPROVED="Niels Horn"