[Fakeroot-commits] [SCM] fakeroot branch, upstream, updated. 08ed00124d8b6b445d3b91a9aa15eec638b02f05

Clint Adams schizo at debian.org
Sun Nov 15 03:17:28 UTC 2009


The following commit has been merged in the upstream branch:
commit 262e2f55b8c2f2dda2e54b54cb31790a16ae9581
Author: Clint Adams <schizo at debian.org>
Date:   Mon Jan 21 22:32:22 2008 +0000

    Add Fakeroot::Stat from THUS plc to a contrib/ directory in the source tarball.  closes: #459728.
    
    git-archimport-id: fakeroot at packages.debian.org--fakeroot/fakeroot--main--0.0--patch-160

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 at 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 at 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 at 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
+ at realstat = stat(".test.file");
+ at 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(":", at realstat)) or exit 1;
+
+# 4: Make sure it returns root if we use fakeroot
+ at teststat = fakestat($key, ".test.file");
+ok($teststat[4], 0) or exit 1;
+ok($teststat[5], 0) or exit 1;

-- 
fakeroot



More information about the Fakeroot-commits mailing list