diff options
author | Kim Kibum <kb0929.kim@samsung.com> | 2012-05-21 17:42:02 +0900 |
---|---|---|
committer | Kim Kibum <kb0929.kim@samsung.com> | 2012-05-21 17:42:02 +0900 |
commit | a3e1b0949f2734a7296074f6b80c0c100da2bd3e (patch) | |
tree | 396ba284386385d66cdb864bbb773ac6eaa959c5 /contrib/Fakeroot-Stat-1.8.8 | |
parent | 2924cc08916c97ace431cd8936a3525d42dbcaa8 (diff) | |
download | fakeroot-a3e1b0949f2734a7296074f6b80c0c100da2bd3e.tar.gz fakeroot-a3e1b0949f2734a7296074f6b80c0c100da2bd3e.tar.bz2 fakeroot-a3e1b0949f2734a7296074f6b80c0c100da2bd3e.zip |
Upload Tizen:Base source
Diffstat (limited to 'contrib/Fakeroot-Stat-1.8.8')
-rw-r--r-- | contrib/Fakeroot-Stat-1.8.8/MANIFEST | 7 | ||||
-rw-r--r-- | contrib/Fakeroot-Stat-1.8.8/META.yml | 11 | ||||
-rw-r--r-- | contrib/Fakeroot-Stat-1.8.8/Makefile.PL | 16 | ||||
-rw-r--r-- | contrib/Fakeroot-Stat-1.8.8/README | 33 | ||||
-rw-r--r-- | contrib/Fakeroot-Stat-1.8.8/Stat.xs | 71 | ||||
-rw-r--r-- | contrib/Fakeroot-Stat-1.8.8/lib/Fakeroot/Stat.pm | 47 | ||||
-rw-r--r-- | contrib/Fakeroot-Stat-1.8.8/t/Fakeroot-Stat.t | 33 |
7 files changed, 218 insertions, 0 deletions
diff --git a/contrib/Fakeroot-Stat-1.8.8/MANIFEST b/contrib/Fakeroot-Stat-1.8.8/MANIFEST new file mode 100644 index 0000000..807e0d5 --- /dev/null +++ b/contrib/Fakeroot-Stat-1.8.8/MANIFEST @@ -0,0 +1,7 @@ +Makefile.PL +MANIFEST +README +lib/Fakeroot/Stat.pm +Stat.xs +t/Fakeroot-Stat.t +META.yml Module meta-data (added by MakeMaker) diff --git a/contrib/Fakeroot-Stat-1.8.8/META.yml b/contrib/Fakeroot-Stat-1.8.8/META.yml new file mode 100644 index 0000000..f3b6e55 --- /dev/null +++ b/contrib/Fakeroot-Stat-1.8.8/META.yml @@ -0,0 +1,11 @@ +# http://module-build.sourceforge.net/META-spec.html +#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# +name: Fakeroot-Stat +version: 1.8.8 +version_from: lib/Fakeroot/Stat.pm +installdirs: site +requires: + Test: 0 + +distribution_type: module +generated_by: ExtUtils::MakeMaker version 6.30 diff --git a/contrib/Fakeroot-Stat-1.8.8/Makefile.PL b/contrib/Fakeroot-Stat-1.8.8/Makefile.PL new file mode 100644 index 0000000..29173d3 --- /dev/null +++ b/contrib/Fakeroot-Stat-1.8.8/Makefile.PL @@ -0,0 +1,16 @@ +# $Thus: source/cvs/Fakeroot-Stat/Makefile.PL,v 1.9.96.3 2007/11/29 15:05:56 benhaman-repoman Exp $ + +use ExtUtils::MakeMaker; + +WriteMakefile( + 'NAME' => 'Fakeroot::Stat', + 'VERSION_FROM' => 'lib/Fakeroot/Stat.pm', + 'PREREQ_PM' => { + 'Test' => '0', + }, + ($] >= 5.005 ? ( + 'ABSTRACT_FROM' => 'lib/Fakeroot/Stat.pm', + 'AUTHOR' => 'SCM Team at THUS plc <scm@thus.net>') + : ()), + 'LIBS' => ["-lfakeroot"] +); diff --git a/contrib/Fakeroot-Stat-1.8.8/README b/contrib/Fakeroot-Stat-1.8.8/README new file mode 100644 index 0000000..77e0805 --- /dev/null +++ b/contrib/Fakeroot-Stat-1.8.8/README @@ -0,0 +1,33 @@ +Fakeroot::Stat version 1.8.8 +============================ + +This provides fakestat() and fakelstat() functions which will communicate +with a faked and return what the faked stat or lstat information is for +the file. + +INSTALLATION + +To install this module type the following: + + perl Makefile.PL + make + make test + make install + +DEPENDENCIES + +This module requires these other modules and libraries: + + fakeroot version 1.8.8 or later + +COPYRIGHT AND LICENCE + +Copyright (C) 2002-2007 THUS plc. + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +AUTHORS + +Members of the SCM Team at THUS plc (scm@thus.net) + diff --git a/contrib/Fakeroot-Stat-1.8.8/Stat.xs b/contrib/Fakeroot-Stat-1.8.8/Stat.xs new file mode 100644 index 0000000..1942247 --- /dev/null +++ b/contrib/Fakeroot-Stat-1.8.8/Stat.xs @@ -0,0 +1,71 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +MODULE = Fakeroot::Stat PACKAGE = Fakeroot::Stat + +void +fakestat(key, path) + char *key; + char *path; + PROTOTYPE: $$ + INIT: + struct stat st; + int i; + PPCODE: + /* Stat first, then fill in uid/gid from fakeroot (ignore everything + * else */ + i = stat(path, &st); + if (i == 0) { + if (key && strlen(key)) + fake_get_owner(0, key, path, &st.st_uid, &st.st_gid, + &st.st_mode); + + EXTEND(SP, 13); + PUSHs(sv_2mortal(newSVnv(st.st_dev))); + PUSHs(sv_2mortal(newSVnv(st.st_ino))); + PUSHs(sv_2mortal(newSVnv(st.st_mode))); + PUSHs(sv_2mortal(newSVnv(st.st_nlink))); + PUSHs(sv_2mortal(newSVnv(st.st_uid))); + PUSHs(sv_2mortal(newSVnv(st.st_gid))); + PUSHs(sv_2mortal(newSVnv(st.st_rdev))); + PUSHs(sv_2mortal(newSVnv(st.st_size))); + PUSHs(sv_2mortal(newSVnv(st.st_atime))); + PUSHs(sv_2mortal(newSVnv(st.st_mtime))); + PUSHs(sv_2mortal(newSVnv(st.st_ctime))); + PUSHs(sv_2mortal(newSVnv(st.st_blksize))); + PUSHs(sv_2mortal(newSVnv(st.st_blocks))); + } + +void +fakelstat(key, path) + char *key; + char *path; + PROTOTYPE: $$ + INIT: + struct stat st; + int i; + PPCODE: + /* Stat first, then fill in uid/gid from fakeroot (ignore everything + * else */ + i = lstat(path, &st); + if (i == 0) { + if (key && strlen(key)) + fake_get_owner(1, key, path, &st.st_uid, &st.st_gid, + &st.st_mode); + + EXTEND(SP, 13); + PUSHs(sv_2mortal(newSVnv(st.st_dev))); + PUSHs(sv_2mortal(newSVnv(st.st_ino))); + PUSHs(sv_2mortal(newSVnv(st.st_mode))); + PUSHs(sv_2mortal(newSVnv(st.st_nlink))); + PUSHs(sv_2mortal(newSVnv(st.st_uid))); + PUSHs(sv_2mortal(newSVnv(st.st_gid))); + PUSHs(sv_2mortal(newSVnv(st.st_rdev))); + PUSHs(sv_2mortal(newSVnv(st.st_size))); + PUSHs(sv_2mortal(newSVnv(st.st_atime))); + PUSHs(sv_2mortal(newSVnv(st.st_mtime))); + PUSHs(sv_2mortal(newSVnv(st.st_ctime))); + PUSHs(sv_2mortal(newSVnv(st.st_blksize))); + PUSHs(sv_2mortal(newSVnv(st.st_blocks))); + } diff --git a/contrib/Fakeroot-Stat-1.8.8/lib/Fakeroot/Stat.pm b/contrib/Fakeroot-Stat-1.8.8/lib/Fakeroot/Stat.pm new file mode 100644 index 0000000..f16dcad --- /dev/null +++ b/contrib/Fakeroot-Stat-1.8.8/lib/Fakeroot/Stat.pm @@ -0,0 +1,47 @@ +package Fakeroot::Stat; + +use 5.006; +use strict; +use warnings; + +require Exporter; +require DynaLoader; + +our @ISA = qw(Exporter DynaLoader); + +our @EXPORT = qw( + fakestat + fakelstat +); +our $VERSION = '1.8.8'; + +bootstrap Fakeroot::Stat $VERSION; + +# Preloaded methods go here. + +1; +__END__ + +=head1 NAME + +Fakeroot::Stat - Perl extension for interrogating a faked daemon + +=head1 SYNOPSIS + + use Fakeroot::Stat; + + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = fakestat($fakerootkey, $filename); + + # fakelstat as above, but does an lstat + +=head1 AUTHOR + +SCM Team at THUS plc E<lt>scm@thus.netE<gt> + +=head1 SEE ALSO + +L<perl>. + +=cut diff --git a/contrib/Fakeroot-Stat-1.8.8/t/Fakeroot-Stat.t b/contrib/Fakeroot-Stat-1.8.8/t/Fakeroot-Stat.t new file mode 100644 index 0000000..8cdf44f --- /dev/null +++ b/contrib/Fakeroot-Stat-1.8.8/t/Fakeroot-Stat.t @@ -0,0 +1,33 @@ +use Test; +BEGIN { plan tests => 5 }; +END { kill 'TERM', $pid if defined $pid; unlink ".test.file" }; + +# 1: Can we run it? +use Fakeroot::Stat; +ok(1) or exit 1; + +# Start FAKED +open FAKED, "$ENV{FAKED}|" or die "Couldn't start faked: $!"; +chomp ($out = <FAKED>); +close FAKED; +($key, $pid) = split(/:/, $out, 2); +die "No key returned from faked" unless length $key; + +open TEST, "> .test.file"; +print TEST "This file means we tested\n"; +close TEST; + +# Try it +@realstat = stat(".test.file"); +@fakestat = fakestat(undef, ".test.file"); + +# 2: Make sure we return the same elements as stat +ok(scalar(@fakestat), scalar(@realstat)) or exit 1; + +# 3: Make sure we return the same without faked +ok(join(":", @fakestat), join(":",@realstat)) or exit 1; + +# 4: Make sure it returns root if we use fakeroot +@teststat = fakestat($key, ".test.file"); +ok($teststat[4], 0) or exit 1; +ok($teststat[5], 0) or exit 1; |