Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into rurban/fix-gc-thr-g…
Browse files Browse the repository at this point in the history
…h880+gh875
  • Loading branch information
Reini Urban committed Jan 9, 2013
2 parents 735c5e1 + 0e55e66 commit ef74e48
Show file tree
Hide file tree
Showing 17 changed files with 312 additions and 69 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
@@ -1,7 +1,7 @@
2013-01-15 release 5.0.0
- Core
+ Remove duplicate library search path entries, move "." from the beginning to
the end. [GH 368]
the end. [GH #368]
+ Install forgotten runtime include files:
cloneflags.pasm
packfile_annotation_keytype.pasm
Expand All @@ -13,10 +13,12 @@
YAML/Dumper/Base.pbc, YAML/Dumper/Default.pbc
+ New experimental PARROT_DYNEXT environment variable
+ New experimental dynext_dirs config entry (same as PARROT_DYNEXT and -X)
+ Add OS error messages to FileHandle.open() error messages [GH #911]
- Build
+ Generate MANIFEST.generated, cleanup MANIFEST,
removed MANIFEST_configure.generated, add installation of forgotten files
[GH #890]
+ Generate datadir/MANIFEST* for all installed files [GH #899]
+ Improved Configure.pl probes for --with-llvm
+ Replace / slashes with \ on windows for all Makefiles automatically.
This improves cygwin interaction, like remote or cronjob smoking on windows.
Expand All @@ -26,6 +28,7 @@
- Documentation
+ Re-added docs/ops, the generated ops summary and docs/packfile-c.pod
+ Improved pdd10_embedding
+ Document FileHandle.open() exceptions and error messages
- Tests
+ Added t/library/lib_search_path.t

Expand Down
12 changes: 12 additions & 0 deletions Configure.pl
Expand Up @@ -79,7 +79,19 @@

# Log files created by Configure.pl in MANIFEST.generated
$conf->{active_configuration} = 1;

# Create a fresh MANIFEST for make install
unlink 'MANIFEST.generated';
if (do 'lib/Parrot/Config/Generated.pm') {
my $make = $Parrot::Config::Generated::PConfig{make};
if ($make and -f 'Makefile') {
$Parrot::Config::Generated::PConfig{gmake_version}
? system ($make, '-s', 'clean') : system ($make, 'clean');
}
}
elsif (-f 'Makefile' and $^O =~ /(linux|darwin)/) {
system ('make', '-s', 'clean');
}

# Run the actual steps from Parrot::Configure
$conf->runsteps or exit(1);
Expand Down
8 changes: 8 additions & 0 deletions api.yaml
Expand Up @@ -649,3 +649,11 @@
- 'library'
- 'experimental'
ticket: 'https://github.com/parrot/parrot/issues/302'
-
name : 'Socket.read(nb) with nb > 512'
eligible : '4.8'
note :
The Socket .read method with an nb argument greater than the current SO_RCVBUF buffer size (typically 512) will since 4.8 behave like POSIX read() and recv(), returning only up to nb bytes. You need to loop until the wanted number of bytes is received.
tags :
- api
ticket : 'https://github.com/parrot/parrot/issues/909'
3 changes: 2 additions & 1 deletion config/gen/makefiles/root.in
Expand Up @@ -1012,7 +1012,6 @@ src/null_config.c : myconfig $(BUILD_TOOLS_DIR)/parrot_config_c.pl
install_config.fpmc : myconfig config_lib.pir $(PARROT)
@echo "Invoking Parrot to generate install_config.fpmc"
$(PARROT) config_lib.pir --install > $@
$(ADDGENERATED) "install_config$(O)" "[main]" lib
$(ADDGENERATED) "$@" "[main]" lib

src/parrot_config$(O) : \
Expand Down Expand Up @@ -3133,6 +3132,7 @@ install-bin: installable docs
--libdir=$(LIB_DIR) \
--includedir=$(INCLUDE_DIR) \
--destdir=$(DESTDIR) \
--datadir=$(DATA_DIR) \
--docdir=$(DOC_DIR) \
--mandir=$(MAN_DIR) \
--versiondir=$(VERSION_DIR) \
Expand Down Expand Up @@ -3161,6 +3161,7 @@ install-doc: docs
--docdir=$(DOC_DIR) \
--mandir=$(MAN_DIR) \
--destdir=$(DESTDIR) \
--datadir=$(DATA_DIR) \
--versiondir=$(VERSION_DIR) \
MANIFEST MANIFEST.generated

Expand Down
10 changes: 6 additions & 4 deletions docs/deprecations/deprecations.pod
Expand Up @@ -37,11 +37,13 @@ For instructions on how to deprecate Parrot code, please see:

Moved "." in the library search paths from the beginning to the end.

- low impact expected:
load_bytecode and .include and load_language might load now different files,
- high impact expected:
build systems need to change their build and tests to favor their new libraries
over already installed ones, to use absolute paths or add -L./ -X./.
load_bytecode, .include and load_language might load now different files,
if they exist in "./" AND in the proper library location.
To keep the old behavior set the environment variables PARROT_INCLUDE
and PARROT_LIBRARY to "./"
To keep the old behavior use parrot -L./ -X./ or set the environment variables
PARROT_INCLUDE and PARROT_LIBRARY to "./"

=back

Expand Down
8 changes: 4 additions & 4 deletions lib/Parrot/Docs/Section/Tests.pm
Expand Up @@ -47,10 +47,10 @@ sub new {
$self->new_group( 'Examples Tests', '', 't/examples' ),
$self->new_group( 'Libraries Tests', '', 't/library' ),
$self->new_group( 'Native Bytecode Tests', '', 't/native_pbc' ),
$self->new_group( 'Ops Tests', '', 't/op', 't/dynoplibs' ),
$self->new_group( 'PMC Tests', '', 't/pmc', 't/dynpmc' ),
$self->new_group( 'C Source Code Tests', '', 't/src' ),
$self->new_group( 'Stress Tests', '', 't/stress' ),
$self->new_group( 'Ops Tests', '', 't/op', 't/dynoplibs' ),
$self->new_group( 'PMC Tests', '', 't/pmc', 't/dynpmc' ),
$self->new_group( 'C Source Code Tests', '', 't/src' ),
$self->new_group( 'Stress Tests', '', 't/stress' ),
);
}

Expand Down
112 changes: 104 additions & 8 deletions lib/Parrot/Install.pm
@@ -1,5 +1,5 @@
package Parrot::Install;
# Copyright (C) 2001-2009, Parrot Foundation.
# Copyright (C) 2001-2013, Parrot Foundation.
use strict;
use warnings;
use File::Basename qw( dirname );
Expand All @@ -12,6 +12,9 @@ our @EXPORT_OK = qw(
create_directories
install_files
);
use lib 'lib';
use Parrot::Config;
use Parrot::BuildUtil;

#################### DOCUMENTATION ####################

Expand All @@ -29,10 +32,10 @@ Parrot::Install - Functionality for installation programs
=head1 DESCRIPTION
This module exports on demand only three subroutines used in the Parrot
This module exports on demand some subroutines used in the Parrot
installation programs F<tools/dev/install_files.pl> and
F<tools/dev/install_dev_files.pl>. The subroutines are tested by tests found
in F<t/tools/install/>.
F<tools/dev/install_dev_files.pl>.
The subroutines are tested by tests found in F<t/tools/install/>.
=head1 SUBROUTINES
Expand Down Expand Up @@ -185,6 +188,86 @@ sub create_directories {
return 1;
}

=head2 C<sanitycheck_install()>
Check if the generated F<MANIFEST.generated> contains some typically
needed files. Dies if not ok.
If you update your repo and rebuild parrot without perl Configure.PL
which deletes MANIFEST.generated anew, MANIFEST.generated might not
contain already up-to-date targets, thus not creating the required
MANIFEST.generated lines.
TODO: Keep a manual list of all to be installed files, merge it with
MANIFEST.generated and die if a file in the merged list does not exist,
i.e. cannot be installed.
=cut

sub _check_manifest {
my ($file,$gen) = @_;
my $manifest = $_[2];
my $fname = "MANIFEST.generated";
unless ($manifest =~ /^\Q$file\E/m) {
if ($^O eq 'MSWin32') { # Windows has mixed paths
$file =~ s{/}{\\}g;
return if $manifest =~ /^\Q$file\E/m;
}
if ($gen) {
die "Error: configure generated $file missing in $fname.\n"
. "make reconfig before make install.\n";
}
else {
die "Error: make generated $file missing in $fname.\n"
. "make clean before make install.\n";
}
}
}

sub sanitycheck_install {
my $fname = "MANIFEST.generated";
my $manifest = Parrot::BuildUtil::slurp_file($fname);
die "$fname not found.\n" unless $manifest;
# configure generated
_check_manifest($_, 1, $manifest) for qw(
lib/Parrot/Pmc2c/PCCMETHOD_BITS.pm
include/parrot/config.h
include/parrot/pbcversion.h
include/parrot/vtable.h
include/parrot/core_pmcs.h
lib/Parrot/PMC.pm
myconfig
lib/Parrot/Config/Generated.pm
runtime/parrot/library/config.pir
);
# make generated
my @MAKE_gen = qw(
vtable.dump
include/parrot/extend_vtable.h
runtime/parrot/include/datatypes.pasm
runtime/parrot/library/Test/More.pbc
compilers/tge/TGE/Parser.pir
runtime/parrot/library/P6Regex.pbc
runtime/parrot/languages/winxed/winxed.pbc
runtime/parrot/library/nqp-setting.pbc
runtime/parrot/library/config.pbc
runtime/parrot/library/opsc.pbc
install_config.fpmc
runtime/parrot/library/pcre.pbc
runtime/parrot/library/PCT/Grammar.pbc
);
my @dynext = qw(dynlexpad os file rational subproxy);
push @dynext, map {$_."_ops"} qw(bit io sys obscure math trans debug);
push @dynext, "select" if $^O !~ /^(MSWin32|msys)$/;
push @dynext, "gziphandle" if $PConfig{has_zlib};
push @MAKE_gen, "src/install_config".$PConfig{o};
push @MAKE_gen, map { "runtime/parrot/dynext/".$_.$PConfig{load_ext} } @dynext;
push @MAKE_gen, map { "installable_".$_.$PConfig{exe} }
qw(parrot pbc_dump pbc_disassemble parrot_config pbc_merge
pbc_to_exe parrot_nci_thunk_gen ops2c winxed);
_check_manifest($_, 0, $manifest) for @MAKE_gen;
}

=head2 C<install_files()>
B<Purpose:> Install the mentioned files into the appropriate locations.
Expand All @@ -200,16 +283,26 @@ list consisting of hashes.
B<Return Value:> True value.
B<Comment:>
B<Comment:> Adds all installed files to datadir/parrotdir/MANIFEST
=cut

sub install_files {
my($destdir, $dryrun, $files) = @_;
my($src, $dest, $mode);
my ($options, $type, $files) = @_;
ref($options) eq 'HASH' or die "Error: parameter \$options must be a hashref\n";

ref($files) eq 'ARRAY' or die "Error: parameter \$files must be an array\n";
my ($destdir, $datadir, $versiondir, $dryrun) =
@$options{qw(destdir datadir versiondir dryrun)};
ref($files) eq 'ARRAY' or die "Error: parameter \$files must be an arrayref\n";

my ($src, $dest, $mode, $manifest);
print("Installing ...\n");
if (!$dryrun) {
my $destdatadir= File::Spec->catdir( $destdir, $datadir, $versiondir);
my $fname = File::Spec->catdir( $destdatadir, "MANIFEST" . ($type ? ".".$type : '') );
open $manifest, ">", $fname or die "Could not create $fname\n";
print "$fname\n";
}
foreach my $el ( @$files ) {
unless(ref($el) eq 'HASH') {
my($ref) = ref($el);
Expand Down Expand Up @@ -237,16 +330,19 @@ sub install_files {
# this loop
if (-e $dest) {
print "$dest\n";
print $manifest "$dest\n" unless $dryrun;
next;
}
}
}
cp( $src, $dest ) or die "Error: couldn't copy $src to $dest: $!\n";
print "$dest\n";
print $manifest "$dest\n" unless $dryrun;
}
$mode = ( stat($src) )[2];
chmod $mode, $dest;
}
close $manifest unless $dryrun;
return 1;
}

Expand Down
13 changes: 9 additions & 4 deletions src/io/filehandle.c
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, Parrot Foundation.
Copyright (C) 2001-2013, Parrot Foundation.
=head1 NAME
Expand Down Expand Up @@ -469,9 +469,14 @@ io_filehandle_open(PARROT_INTERP, ARGMOD(PMC *handle), ARGIN(STRING *path), INTV

os_handle = Parrot_io_internal_open(interp, path, flags);

if (os_handle == PIO_INVALID_HANDLE)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
"Unable to open filehandle from path '%Ss'", path);
if (os_handle == PIO_INVALID_HANDLE) {
if (errno)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
"Unable to open filehandle from path '%Ss': %s(%d)", path, strerror(errno), errno);
else
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
"Unable to open filehandle from path '%Ss'", path);
}

/* Set generic flag here if is a terminal then
* FileHandle can know how to setup buffering.
Expand Down
30 changes: 11 additions & 19 deletions src/nci_test.c
Expand Up @@ -126,25 +126,17 @@ typedef void (*cb_D4_func)(void*, void*);
PARROT_DYNEXT_EXPORT void nci_cb_D4(cb_D4_func, void*);

/* Variable definitions */

PARROT_DYNEXT_EXPORT int int_cb_D4;
PARROT_DYNEXT_EXPORT int nci_dlvar_char;
PARROT_DYNEXT_EXPORT int nci_dlvar_short;
PARROT_DYNEXT_EXPORT int nci_dlvar_int;
PARROT_DYNEXT_EXPORT long nci_dlvar_long;
PARROT_DYNEXT_EXPORT float nci_dlvar_float;
PARROT_DYNEXT_EXPORT double nci_dlvar_double;
PARROT_DYNEXT_EXPORT char nci_dlvar_cstring[];

int int_cb_D4 = -55555;
int nci_dlvar_char = 22;
int nci_dlvar_short = 333;
int nci_dlvar_int = -4444;
long nci_dlvar_long = -7777777;
float nci_dlvar_float = -333.0;
double nci_dlvar_double = -55555.55555;
char nci_dlvar_cstring[] = "This is a C-string.\n";

/* Note that PARROT_DATA (i.e. extern) or static will not work with
our nci test. We want only one symbol, exported as visible.
*/
PARROT_DYNEXT_EXPORT int int_cb_D4 = -55555;
PARROT_DYNEXT_EXPORT int nci_dlvar_char = 22;
PARROT_DYNEXT_EXPORT int nci_dlvar_short = 333;
PARROT_DYNEXT_EXPORT int nci_dlvar_int = -4444;
PARROT_DYNEXT_EXPORT long nci_dlvar_long = -7777777;
PARROT_DYNEXT_EXPORT float nci_dlvar_float = -333.0;
PARROT_DYNEXT_EXPORT double nci_dlvar_double = -55555.55555;
PARROT_DYNEXT_EXPORT char nci_dlvar_cstring[] = "This is a C-string.\n";

/* Function definitions */

Expand Down
28 changes: 26 additions & 2 deletions src/pmc/filehandle.pmc
@@ -1,5 +1,5 @@
/*
Copyright (C) 2008-2011, Parrot Foundation.
Copyright (C) 2008-2013, Parrot Foundation.

=head1 NAME

Expand Down Expand Up @@ -249,6 +249,30 @@ invocant is modified and becomes an open filehandle. A copy of the invocant is
also returned by the method (some subclasses may create this as the primary
filehandle, rather than modifying the invocant).

Exceptions:

EXCEPTION_PIO_ERROR with the following messages:

Empty filename

"Cannot open FileHandle, no path"

Already open filehandle

"Cannot reopen already open FileHandle"

Invalid handle, no errno as with ISDIR:

"Unable to open filehandle from path '$path'"

Invalid handle (fd < 0), or other error:

"Unable to open filehandle from path '$path': $strerror($errno)"

EXCEPTION_INVALID_OPERATION with:

"Invalid mode for file open"

=cut

*/
Expand All @@ -259,7 +283,7 @@ filehandle, rather than modifying the invocant).

if (!Parrot_io_is_closed(INTERP, SELF))
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_PIO_ERROR,
"Cannot reopen already open filehandle");
"Cannot reopen already open FileHandle");

if (!got_mode || STRING_IS_NULL(mode))
GET_ATTR_mode(INTERP, SELF, mode);
Expand Down

0 comments on commit ef74e48

Please sign in to comment.