* [PATCH] Gcf2: Create cache folder if missing
@ 2022-09-08 19:57 Ricardo Ribalda
2022-09-08 22:08 ` Eric Wong
0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Ribalda @ 2022-09-08 19:57 UTC (permalink / raw)
To: meta; +Cc: Ricardo Ribalda
The code expects that the folder is already present, this patch creates
it if missing.
Without this path the test fails with:
open(/home/debci/.cache/public-inbox/inline-c/.public-inbox.lock): No such file or directory at /usr/share/perl5/PublicInbox/Gcf2.pm line 20
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
---
lib/PublicInbox/Gcf2.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/PublicInbox/Gcf2.pm b/lib/PublicInbox/Gcf2.pm
index 41ee0715..02cd0de2 100644
--- a/lib/PublicInbox/Gcf2.pm
+++ b/lib/PublicInbox/Gcf2.pm
@@ -10,12 +10,14 @@ use PublicInbox::Spawn qw(which popen_rd); # may set PERL_INLINE_DIRECTORY
use Fcntl qw(LOCK_EX SEEK_SET);
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
use IO::Handle; # autoflush
+use File::Path qw(make_path);
BEGIN {
my (%CFG, $c_src);
# PublicInbox::Spawn will set PERL_INLINE_DIRECTORY
# to ~/.cache/public-inbox/inline-c if it exists
my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} //
die 'PERL_INLINE_DIRECTORY not defined';
+ make_path($inline_dir);
my $f = "$inline_dir/.public-inbox.lock";
open my $fh, '+>', $f or die "open($f): $!";
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Gcf2: Create cache folder if missing
2022-09-08 19:57 [PATCH] Gcf2: Create cache folder if missing Ricardo Ribalda
@ 2022-09-08 22:08 ` Eric Wong
2022-09-09 10:10 ` Ricardo Ribalda Delgado
2022-12-23 22:11 ` [PATCH] cleanup pure Perl use Eric Wong
0 siblings, 2 replies; 4+ messages in thread
From: Eric Wong @ 2022-09-08 22:08 UTC (permalink / raw)
To: Ricardo Ribalda; +Cc: meta
Applied as commit ad8acf7d6484d0a489499742cadadbd4f890ab53
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Gcf2: Create cache folder if missing
2022-09-08 22:08 ` Eric Wong
@ 2022-09-09 10:10 ` Ricardo Ribalda Delgado
2022-12-23 22:11 ` [PATCH] cleanup pure Perl use Eric Wong
1 sibling, 0 replies; 4+ messages in thread
From: Ricardo Ribalda Delgado @ 2022-09-09 10:10 UTC (permalink / raw)
To: Eric Wong; +Cc: meta
[-- Attachment #1: Type: text/plain, Size: 146 bytes --]
Thanks!
On Fri, Sep 9, 2022 at 12:09 AM Eric Wong <e@80x24.org> wrote:
> Applied as commit ad8acf7d6484d0a489499742cadadbd4f890ab53
> Thanks.
>
[-- Attachment #2: Type: text/html, Size: 421 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] cleanup pure Perl use
2022-09-08 22:08 ` Eric Wong
2022-09-09 10:10 ` Ricardo Ribalda Delgado
@ 2022-12-23 22:11 ` Eric Wong
1 sibling, 0 replies; 4+ messages in thread
From: Eric Wong @ 2022-12-23 22:11 UTC (permalink / raw)
To: meta; +Cc: Ricardo Ribalda
Eric Wong <e@80x24.org> wrote:
> Applied as commit ad8acf7d6484d0a489499742cadadbd4f890ab53
Actually, this shouldn't be needed.
It was causing much noise for users who don't have Inline::C
installed. I don't want to depend on a C compiler nor do
I want binaries of this work distributed.
The underlying problem was PERL_INLINE_DIRECTORY stays set by
our code even if Spawn fails to build.
----------8<---------
Subject: [PATCH] cleanup pure Perl use
This quiets down tests when the optional Inline::C is missing.
We do not currently have a hard dependency on Inline::C; and we
should not leave PERL_INLINE_DIRECTORY set in PublicInbox::Spawn
if Inline fails to build.
Leaving PERL_INLINE_DIRECTORY set by Spawn after it fails (due
to missing Inline::C) would cause downstream failures in Gcf2
builds for the same reason. So we should bail out of the Gcf2
build early if Spawn already failed due to missing Inline::C.
The only time we want to be noisy is if a user explicitly sets
PERL_INLINE_DIRECTORY and Inline::C is missing.
This reverts commit ad8acf7d6484d0a489499742cadadbd4f890ab53.
ad8acf7d6484d0a4 (Gcf2: Create cache folder if missing, 2022-09-08)
---
lib/PublicInbox/Gcf2.pm | 4 +---
lib/PublicInbox/Spawn.pm | 7 +++++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/Gcf2.pm b/lib/PublicInbox/Gcf2.pm
index 54b3d6aa..d13e6b1a 100644
--- a/lib/PublicInbox/Gcf2.pm
+++ b/lib/PublicInbox/Gcf2.pm
@@ -10,16 +10,14 @@ use PublicInbox::Spawn qw(which popen_rd); # may set PERL_INLINE_DIRECTORY
use Fcntl qw(LOCK_EX SEEK_SET);
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
use IO::Handle; # autoflush
-use File::Path qw(make_path);
use PublicInbox::Git;
BEGIN {
my (%CFG, $c_src);
# PublicInbox::Spawn will set PERL_INLINE_DIRECTORY
- # to ~/.cache/public-inbox/inline-c if it exists
+ # to ~/.cache/public-inbox/inline-c if it exists and Inline::C works
my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} //
die 'PERL_INLINE_DIRECTORY not defined';
- make_path($inline_dir);
my $f = "$inline_dir/.public-inbox.lock";
open my $fh, '+>', $f or die "open($f): $!";
diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm
index 3f69108a..7f61d8db 100644
--- a/lib/PublicInbox/Spawn.pm
+++ b/lib/PublicInbox/Spawn.pm
@@ -268,13 +268,14 @@ void recv_cmd4(PerlIO *s, SV *buf, STRLEN n)
#endif /* defined(CMSG_SPACE) && defined(CMSG_LEN) */
ALL_LIBC
- my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} //= (
+ my $inline_dir = $ENV{PERL_INLINE_DIRECTORY} // (
$ENV{XDG_CACHE_HOME} //
( ($ENV{HOME} // '/nonexistent').'/.cache' )
).'/public-inbox/inline-c';
warn "$inline_dir exists, not writable\n" if -e $inline_dir && !-w _;
$all_libc = undef unless -d _ && -w _;
if (defined $all_libc) {
+ local $ENV{PERL_INLINE_DIRECTORY} = $inline_dir;
my $f = "$inline_dir/.public-inbox.lock";
open my $oldout, '>&', \*STDOUT or die "dup(1): $!";
open my $olderr, '>&', \*STDERR or die "dup(2): $!";
@@ -302,7 +303,9 @@ EOM
$all_libc = undef;
}
}
- unless ($all_libc) {
+ if (defined $all_libc) { # set for Gcf2
+ $ENV{PERL_INLINE_DIRECTORY} = $inline_dir;
+ } else {
require PublicInbox::SpawnPP;
*pi_fork_exec = \&PublicInbox::SpawnPP::pi_fork_exec
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-23 22:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-08 19:57 [PATCH] Gcf2: Create cache folder if missing Ricardo Ribalda
2022-09-08 22:08 ` Eric Wong
2022-09-09 10:10 ` Ricardo Ribalda Delgado
2022-12-23 22:11 ` [PATCH] cleanup pure Perl use Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).