chiark / gitweb /
Allow downloading of database tree source code via dictup CGI scripts
[ypp-sc-tools.db-live.git] / yarrg / web / source.tar.gz
index 1d92ad8584255028578f7b1cbb2da41f9376f5f5..0e47a83e38d755720427b9c453db6bed6cf33288 100755 (executable)
 </%doc><%flags>
 inherit => undef
 </%flags><%perl>
-use IO::Pipe;
 use CommodsWeb;
+use Commods;
 
 $r->content_type('application/octet-stream');
 $m->flush_buffer();
 
-$ENV{'YPPSC_YARRG_SRCBASE'}= sourcebasedir();
-my $pipe= new IO::Pipe or die $!;
-my $pid= fork();  defined $pid or die $!;
-if (!$pid) {
-       $pipe->writer();
-       exec '/bin/sh','-c','
-               cd -P "$YPPSC_YARRG_SRCBASE"
-               (
-                git-ls-files -z;
-                git-ls-files -z --others --exclude-from=.gitignore;
-                if test -d .git; then find .git -print0; fi
-               ) | (
-                cpio -Hustar -o --quiet -0 -R 1000:1000 || \
-                cpio -Hustar -o --quiet -0
-               ) | gzip
-       ';
-       die $!;
-}
-$pipe->reader();
-
-my ($d, $l);
-while ($l= read $pipe, $d, 65536) {
-       print $d;
+source_tarball(sourcebasedir(), sub {
+       print $_[0];
        $m->flush_buffer();
-}
-waitpid $pid,0;
-defined $l or die "read pipe $!";
-$pipe->error and die "pipe error $!";
-close $pipe;
-# deliberately ignore errors
+})
 
 </%perl>