From 5a0f12d7e1ae3930842adf303cce3e7e3ead916f Mon Sep 17 00:00:00 2001 From: Jonathan Stowe Date: Sun, 6 Dec 2015 17:09:04 +0000 Subject: [PATCH] Updates required by @*INC going and new %?RESOURCES fixes #1 --- .gitignore | 1 + Build.pm | 8 ++++++-- META.info | 11 ++++++++--- lib/Sys/Lastlog.pm | 26 +++++++------------------- src/Configure.pl6 | 2 ++ src/Makefile.in | 6 +++--- t/02-lastlog.t | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 6fff84c..a9ef73e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ nytprof.out *.so *.bs /_eumm/ +.precomp diff --git a/Build.pm b/Build.pm index 32d3e6e..a336cab 100644 --- a/Build.pm +++ b/Build.pm @@ -17,7 +17,11 @@ class Build is Panda::Builder { die "This currently does not work on darwin"; } } - mkpath "$workdir/blib/lib"; - make("$workdir/src", "$workdir/blib/lib"); + my Str $blib = "$workdir/blib"; + rm_rf($blib); + mkpath "$blib/lib/Sys"; + mkpath "$blib/lib/../resources/lib"; + make("$workdir/src", "$blib/lib"); } } +# vim: expandtab shiftwidth=4 ft=perl6 ts=4 sts=4 diff --git a/META.info b/META.info index c4ea302..84d718c 100644 --- a/META.info +++ b/META.info @@ -1,7 +1,9 @@ { "name" : "Sys::Lastlog", "support" : { - "source" : "git://github.com/jonathanstowe/p6-Sys-Lastlog.git" + "source" : "git://github.com/jonathanstowe/p6-Sys-Lastlog.git", + "irc" : "irc://irc.freenode.net/#perl6", + "bugtracker" : "https://github.com/jonathanstowe/p6-Sys-Lastlog/issues" }, "source-url" : "git://github.com/jonathanstowe/p6-Sys-Lastlog.git", "authors" : [ "Jonathan Stowe " ], @@ -9,11 +11,13 @@ "perl" : "v6", "build-depends" : [ "panda", - "LibraryMake" + "LibraryMake", + "Shell::Command" ], "provides" : { "Sys::Lastlog" : "lib/Sys/Lastlog.pm" }, + "resources" : [ "lib/lastloghelper.so" ], "depends" : [ "LibraryMake", "System::Passwd" @@ -22,6 +26,7 @@ "Test" ], "description" : "Perl 6 access to Lastlog information on Unix-like systems", - "version" : "v0.0.4", + "version" : "v0.0.5", + "tags" : [ "unix", "audit", "lastlog" ], "auth" : "github:jonathanstowe" } diff --git a/lib/Sys/Lastlog.pm b/lib/Sys/Lastlog.pm index c27c211..3f92976 100644 --- a/lib/Sys/Lastlog.pm +++ b/lib/Sys/Lastlog.pm @@ -147,7 +147,7 @@ record is for. =end pod -class Sys::Lastlog:ver:auth { +class Sys::Lastlog:ver:auth { use System::Passwd; @@ -189,26 +189,14 @@ class Sys::Lastlog:ver:auth { sub library { my $so = get-vars(''); - my $libname = "lastloghelper$so"; - my $base = "lib/Sys/Lastlog/$libname"; - for @*INC <-> $v { - if $v ~~ Str { - $v ~~ s/^.*\#//; - if ($v ~ '/' ~ $libname).IO.r { - return $v ~ '/' ~ $libname; - } - } - else { - if my @files = ($v.files($base) || $v.files("blib/$base")) { - my $files = @files[0]; - my $tmp = $files{$base} || $files{"blib/$base"}; + my $libname = "lib/lastloghelper$so"; - $tmp.IO.copy($*SPEC.tmpdir ~ '/' ~ $libname); - return $*SPEC.tmpdir ~ '/' ~ $libname; - } - } + my $lib = %?RESOURCES{$libname}.Str; + + if not $lib.defined { + die "Unable to find library"; } - die "Unable to find library"; + $lib; } my sub p_getllent() returns Entry is native(&library) { * } diff --git a/src/Configure.pl6 b/src/Configure.pl6 index 8859f2f..3c375a5 100644 --- a/src/Configure.pl6 +++ b/src/Configure.pl6 @@ -3,8 +3,10 @@ use v6; use LibraryMake; +use Shell::Command; my $destdir = '../lib'; my %vars = get-vars($destdir); +mkpath "lib/../resources/lib"; process-makefile('src', %vars); make('src', $destdir); diff --git a/src/Makefile.in b/src/Makefile.in index e7be950..84aff21 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -all: %DESTDIR%/lastloghelper%SO% +all: %DESTDIR%/../resources/lib/lastloghelper%SO% -%DESTDIR%/lastloghelper%SO%: lastloghelper%O% - %LD% %LDSHARED% %LDFLAGS% %LIBS% %LDOUT%%DESTDIR%/lastloghelper%SO% lastloghelper%O% +%DESTDIR%/../resources/lib/lastloghelper%SO%: lastloghelper%O% + %LD% %LDSHARED% %LDFLAGS% %LIBS% %LDOUT%%DESTDIR%/../resources/lib/lastloghelper%SO% lastloghelper%O% lastloghelper%O%: lastloghelper.c %CC% -c %CCSHARED% %CCFLAGS% %CCOUT%lastloghelper%O% lastloghelper.c diff --git a/t/02-lastlog.t b/t/02-lastlog.t index c493ff7..f003e42 100644 --- a/t/02-lastlog.t +++ b/t/02-lastlog.t @@ -13,7 +13,7 @@ use Sys::Lastlog; my $uid; my $logname; -diag try { qx/id/ }; +#diag try { qx/id/ }; if $*USER.defined { $uid = $*USER.Numeric;