]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
rename Gcf2 -> Lg2 for general libgit2 use
authorEric Wong <e@80x24.org>
Sat, 15 Feb 2025 11:10:10 +0000 (11:10 +0000)
committerEric Wong <e@80x24.org>
Mon, 17 Feb 2025 20:09:10 +0000 (20:09 +0000)
We'll be exploring libgit2 for writing (and possibly reading) config
files, so the `gcf2' (git-cat-file-2) name isn't appropriate
anymore for the package name.  We'll still keep `gcf2_' for
subroutine names related to git-cat-file-like behavior.

Documentation/public-inbox-tuning.pod
MANIFEST
lib/PublicInbox/Gcf2Client.pm
lib/PublicInbox/Lg2.pm [moved from lib/PublicInbox/Gcf2.pm with 92% similarity]
lib/PublicInbox/SearchView.pm
lib/PublicInbox/Spawn.pm
lib/PublicInbox/TestCommon.pm
lib/PublicInbox/ViewVCS.pm
lib/PublicInbox/lg2.h [moved from lib/PublicInbox/gcf2_libgit2.h with 98% similarity]
t/gcf2.t
t/gcf2_client.t

index b56c2b100a4b37465f58329c4317e1b17a26b449..3f2c086164ee1e14628d08dc906043f6b3e58604 100644 (file)
@@ -71,7 +71,7 @@ public-inbox processes.
 If libgit2 development files are installed and L<Inline::C>
 is enabled (described above), per-inbox C<git cat-file --batch>
 processes are replaced with a single L<perl(1)> process running
-C<PublicInbox::Gcf2::loop> in read-only daemons.  libgit2 use
+C<PublicInbox::Lg2::gcf2_loop> in read-only daemons.  libgit2 use
 will be available in public-inbox 1.7.0+
 
 More (optional) L<Inline::C> use will be introduced in the future
index f0b42826a2b04c227ec059137b51ec53d110ca4a..8f35c1adb0383ec1d3ec695b34bef294f3b20e41 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -203,7 +203,6 @@ lib/PublicInbox/Filter/Mirror.pm
 lib/PublicInbox/Filter/RubyLang.pm
 lib/PublicInbox/Filter/SubjectTag.pm
 lib/PublicInbox/Filter/Vger.pm
-lib/PublicInbox/Gcf2.pm
 lib/PublicInbox/Gcf2Client.pm
 lib/PublicInbox/GetlineResponse.pm
 lib/PublicInbox/Git.pm
@@ -294,6 +293,7 @@ lib/PublicInbox/LeiUp.pm
 lib/PublicInbox/LeiViewText.pm
 lib/PublicInbox/LeiWatch.pm
 lib/PublicInbox/LeiXSearch.pm
+lib/PublicInbox/Lg2.pm
 lib/PublicInbox/Limiter.pm
 lib/PublicInbox/Linkify.pm
 lib/PublicInbox/Listener.pm
@@ -388,8 +388,8 @@ lib/PublicInbox/XapHelperCxx.pm
 lib/PublicInbox/Xapcmd.pm
 lib/PublicInbox/XhcMset.pm
 lib/PublicInbox/XhcMsetIterator.pm
-lib/PublicInbox/gcf2_libgit2.h
 lib/PublicInbox/khashl.h
+lib/PublicInbox/lg2.h
 lib/PublicInbox/xap_helper.h
 lib/PublicInbox/xh_cidx.h
 lib/PublicInbox/xh_mset.h
index 07ff7dcb60dd4d6dcd21ad49da48b4c3ebb1c9dd..17bf34c7fd0005095c0d0599df21eee4e7bb9c30 100644 (file)
@@ -1,12 +1,12 @@
 # Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
-# connects public-inbox processes to PublicInbox::Gcf2::loop()
+# connects public-inbox processes to PublicInbox::Lg2::gcf2_loop()
 package PublicInbox::Gcf2Client;
 use v5.12;
 use parent qw(PublicInbox::DS);
 use PublicInbox::Git;
-use PublicInbox::Gcf2; # fails if Inline::C or libgit2-dev isn't available
+use PublicInbox::Lg2; # fails if Inline::C or libgit2-dev isn't available
 use PublicInbox::Spawn qw(spawn);
 use Socket qw(AF_UNIX SOCK_STREAM);
 use PublicInbox::Syscall qw(EPOLLIN);
@@ -14,10 +14,10 @@ use PublicInbox::IO;
 use autodie qw(socketpair);
 
 # fields:
-#      sock => socket to Gcf2::loop
+#      sock => socket to Lg2::gcf2_loop
 # The rest of these fields are compatible with what PublicInbox::Git
 # uses code-sharing
-#      pid => PID of Gcf2::loop process
+#      pid => PID of Lg2::gcf2_loop process
 #      pid.owner => process which spawned {pid}
 #      in => same as {sock}, for compatibility with PublicInbox::Git
 #      inflight => array (see PublicInbox::Git)
@@ -30,7 +30,7 @@ sub new  {
        $s1->blocking(0);
        $opt->{0} = $opt->{1} = $s2;
        my $cmd = [$^X, $^W ? ('-w') : (),
-                       qw[-MPublicInbox::Gcf2 -e PublicInbox::Gcf2::loop]];
+                       qw[-MPublicInbox::Lg2 -e PublicInbox::Lg2::gcf2_loop]];
        $self->{inflight} = [];
        PublicInbox::IO::attach_pid($s1, spawn($cmd, $env, $opt),
                        \&PublicInbox::Git::gcf_drain, $self->{inflight});
similarity index 92%
rename from lib/PublicInbox/Gcf2.pm
rename to lib/PublicInbox/Lg2.pm
index acc2091c3e03484f3f55e7b2769957d9a6bba471..0ee9b3544fa7ab3046313a930951ca53603eaad4 100644 (file)
@@ -1,9 +1,8 @@
 # Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
-# backend for a git-cat-file-workalike based on libgit2,
-# other libgit2 stuff may go here, too.
-package PublicInbox::Gcf2;
+# including backend for a git-cat-file-workalike based on libgit2,
+package PublicInbox::Lg2;
 use v5.12;
 use PublicInbox::Spawn qw(which run_qx); # may set PERL_INLINE_DIRECTORY
 use Fcntl qw(SEEK_SET);
@@ -35,7 +34,7 @@ BEGIN {
                die "E: libgit2 not installed: $err\n" if $?;
                $vals->{$k} = $val;
        }
-       my $f = "$dir/gcf2_libgit2.h";
+       my $f = "$dir/lg2.h";
        $c_src = PublicInbox::IO::try_cat $f or die "cat $f: $!";
        # append pkg-config results to the source to ensure Inline::C
        # can rebuild if there's changes (it doesn't seem to detect
@@ -62,7 +61,7 @@ EOM
                seek($fh, 0, SEEK_SET);
                my @msg = <$fh>;
                truncate($fh, 0);
-               die "Inline::C Gcf2 build failed:\n", $err, "\n", @msg;
+               die "Inline::C Lg2 build failed:\n", $err, "\n", @msg;
        }
 }
 
@@ -86,9 +85,9 @@ sub add_alt ($$) {
        1;
 }
 
-# Usage: $^X -MPublicInbox::Gcf2 -e PublicInbox::Gcf2::loop [EXPIRE-TIMEOUT]
+# Usage: $^X -MPublicInbox::Lg2 -e PublicInbox::Lg2::gcf2_loop [EXPIRE-TIMEOUT]
 # (see lib/PublicInbox/Gcf2Client.pm)
-sub loop (;$) {
+sub gcf2_loop (;$) {
        my $exp = $_[0] || $ARGV[0] || 60; # seconds
        my $gcf2 = new();
        my (%seen, $check_at);
index 8ae422f91c985bca8dadfc9c11d1e59effc78803..8464ae1b6e73630edc7d491db63a206095ed1608 100644 (file)
@@ -169,7 +169,7 @@ sub path2inc ($) {
        if (my $short = $rmap_inc{$full}) {
                return $short;
        } elsif (!scalar(keys %rmap_inc) && -e $full) {
-               # n.b. $INC{'PublicInbox::Gcf2'} is undef if libgit2-dev
+               # n.b. $INC{'PublicInbox::Lg2'} is undef if libgit2-dev
                # doesn't exist
                my $f;
                %rmap_inc = map {;
index d818af0f1675b6ac770850bf0a4c2740804fbf0c..f79623b72d92e7ab2bdd338df8ab665d622131ed 100644 (file)
@@ -330,7 +330,7 @@ EOM
                        $all_libc = undef;
                }
        }
-       if (defined $all_libc) { # set for Gcf2
+       if (defined $all_libc) { # set for Lg2
                $ENV{PERL_INLINE_DIRECTORY} = $inline_dir;
                %RLIMITS = rlimit_map();
                *send_cmd4 = sub ($$$$;$) {
index e11781491794378b8251ec9439a61be85a32847b..a9967735fafad0276f437828629ca0c67f24cda3 100644 (file)
@@ -266,7 +266,7 @@ sub require_mods (@) {
                        eval "require $mod";
                }
                if ($@) {
-                       diag "require $mod: $@" if $mod =~ /Gcf2/;
+                       diag "require $mod: $@" if $mod =~ /Lg2/;
                        push @need, $mod;
                } elsif ($mod eq 'IO::Socket::SSL' &&
                        # old versions of IO::Socket::SSL aren't supported
index e1e129b1134b47e5001300d813f1c7bf2b9e33d9..552e3241b11e16dd313865752fe6090083090f5d 100644 (file)
@@ -129,7 +129,7 @@ sub cmt_title { # git->cat_async callback
 
 sub do_cat_async {
        my ($arg, $cb, @req) = @_;
-       # favor git(1) over Gcf2 (libgit2) for SHA-256 support
+       # favor git(1) over Lg2 (libgit2) for SHA-256 support
        my $ctx = ref $arg eq 'ARRAY' ? $arg->[0] : $arg;
        $ctx->{git}->cat_async($_, $cb, $arg) for @req;
        if ($ctx->{env}->{'pi-httpd.async'}) {
similarity index 98%
rename from lib/PublicInbox/gcf2_libgit2.h
rename to lib/PublicInbox/lg2.h
index e1f0ef39a68623baf45c30c285324b8dfbc502ef..0b1a33e0c324ebda2d2b30daba7c8025976882e2 100644 (file)
@@ -29,7 +29,7 @@ SV *new()
 
        ref = newSViv((IV)odb);
        self = newRV_noinc(ref);
-       sv_bless(self, gv_stashpv("PublicInbox::Gcf2", GV_ADD));
+       sv_bless(self, gv_stashpv("PublicInbox::Lg2", GV_ADD));
        SvREADONLY_on(ref);
 
        return self;
index 9f9e8e2003c0fe16acc764393c618a6a09858307..fc687058ccdffad95a9053b697f685efda60fc37 100644 (file)
--- a/t/gcf2.t
+++ b/t/gcf2.t
@@ -10,14 +10,14 @@ use Fcntl qw(:seek);
 use IO::Handle ();
 use POSIX qw(_exit);
 use Cwd qw(abs_path);
-require_mods('PublicInbox::Gcf2');
-use_ok 'PublicInbox::Gcf2';
+require_mods('PublicInbox::Lg2');
+use_ok 'PublicInbox::Lg2';
 use PublicInbox::Syscall qw($F_SETPIPE_SZ);
 use PublicInbox::Import;
 my ($tmpdir, $for_destroy) = tmpdir();
 
-my $gcf2 = PublicInbox::Gcf2::new();
-is(ref($gcf2), 'PublicInbox::Gcf2', '::new works');
+my $gcf2 = PublicInbox::Lg2::new();
+is(ref($gcf2), 'PublicInbox::Lg2', '::new works');
 my $COPYING = 'dba13ed2ddf783ee8118c6a581dbf75305f816a3';
 open my $agpl, '<', 'COPYING' or BAIL_OUT "AGPL-3 missing: $!";
 $agpl = do { local $/; <$agpl> };
@@ -102,7 +102,7 @@ SKIP: {
        ok($gcf2->cat_oid(fileno($fh), $COPYING), 'cat_oid normal');
        $ck_copying->('regular file');
 
-       $gcf2 = PublicInbox::Gcf2::new();
+       $gcf2 = PublicInbox::Lg2::new();
        $gcf2->add_alternate("$tmpdir/objects");
        open $fh, '+>', undef or BAIL_OUT "open: $!";
        ok($gcf2->cat_oid(fileno($fh), $COPYING), 'cat_oid alternate');
@@ -150,7 +150,7 @@ if ($nr) {
        close $r;
        my $broken = fileno($w);
        for (1..$nr) {
-               my $obj = PublicInbox::Gcf2::new();
+               my $obj = PublicInbox::Lg2::new();
                if (defined($objdir)) {
                        $obj->add_alternate($objdir);
                        for (1..$cat) {
index 33ee2c9124489f9f5cfe33c39030dc5fec319b3e..78921280be87e73090231862681594cf8913bbdb 100644 (file)
@@ -8,7 +8,7 @@ use autodie qw(open close);
 use PublicInbox::Import;
 use PublicInbox::DS;
 
-require_mods('PublicInbox::Gcf2');
+require_mods('PublicInbox::Lg2');
 use_ok 'PublicInbox::Gcf2Client';
 my ($tmpdir, $for_destroy) = tmpdir();
 my $git_a = "$tmpdir/a.git";