user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH] Makefile.PL: drop generated lib/PublicInbox.pm in blib/
  2021-10-19 11:13  5% [PATCH] Makefile.PL: drop generated lib/PublicInbox.pm in blib/ Ævar Arnfjörð Bjarmason
@ 2021-10-19 11:53  0% ` Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2021-10-19 11:53 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: meta

Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> Running "make test" on this project doesn't pass unless you've got an
> existing PublicInbox.pm in your @INC, presumably nobody's set this up
> on a fresh machine in a while.
> 
> This Makefile.PL trickery seems to do it, I've validated this with
> this ad-hoc test of committing blib/ and Makefile to the repository:
> 
>     git clean -dxf; perl Makefile.PL && make -j8 all && git add -f blib Makefile.PL Makefile && git commit -m"now"
> 
> Running that in interactive rebase before/after shows that only the
> PublicInbox.pm file was added to blib/lib/. We use $(INST_LIB) instead
> of a hardcoded 'blib/lib' now, but it's what ExtUtils::MakeMaker
> recommends, so it's probably for the better.

That works for me.

> As far as I can tell this broke with 1fae720d (build: generate
> PublicInbox.pm with $VERSION, 2021-04-01), but I have not tested
> that. See also 1fae720d (build: generate PublicInbox.pm with $VERSION,
> 2021-04-01) which made the PublicInbox.pm a generated file.

Thanks, applied and pushed as 8377d44046ade5becb21f71e4d1d68dd6ae2bbf0

Fwiw, "make check" or "make check-run" can be way faster on SMP
systems; so I don't think anybody's run the EU::MM "make test"
in ages.

^ permalink raw reply	[relevance 0%]

* [PATCH] Makefile.PL: drop generated lib/PublicInbox.pm in blib/
@ 2021-10-19 11:13  5% Ævar Arnfjörð Bjarmason
  2021-10-19 11:53  0% ` Eric Wong
  0 siblings, 1 reply; 4+ results
From: Ævar Arnfjörð Bjarmason @ 2021-10-19 11:13 UTC (permalink / raw)
  To: meta; +Cc: Ævar Arnfjörð Bjarmason

Running "make test" on this project doesn't pass unless you've got an
existing PublicInbox.pm in your @INC, presumably nobody's set this up
on a fresh machine in a while.

This Makefile.PL trickery seems to do it, I've validated this with
this ad-hoc test of committing blib/ and Makefile to the repository:

    git clean -dxf; perl Makefile.PL && make -j8 all && git add -f blib Makefile.PL Makefile && git commit -m"now"

Running that in interactive rebase before/after shows that only the
PublicInbox.pm file was added to blib/lib/. We use $(INST_LIB) instead
of a hardcoded 'blib/lib' now, but it's what ExtUtils::MakeMaker
recommends, so it's probably for the better.

As far as I can tell this broke with 1fae720d (build: generate
PublicInbox.pm with $VERSION, 2021-04-01), but I have not tested
that. See also 1fae720d (build: generate PublicInbox.pm with $VERSION,
2021-04-01) which made the PublicInbox.pm a generated file.
---
 Makefile.PL | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Makefile.PL b/Makefile.PL
index 348a343d..b3ac59be 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -190,6 +190,16 @@ WriteMakefile(
 		FILES => 't/home*/setup* t/home*/t* t/home*/.public-inbox '.
 			't/data-gen/*'
 	},
+	PM => {
+		map {
+			s[^lib/][]s;
+			+('lib/' . $_ => '$(INST_LIB)/' . $_);
+		} grep {
+			# Will include *.pod and an *.h file, but so
+			# would ExtUtils::MakeMaker.
+			m[^lib/];
+		} @manifest
+	},
 );
 
 sub MY::postamble {
-- 
2.33.1.1338.g20da966911a


^ permalink raw reply related	[relevance 5%]

* [PATCH 1/2] build: generate PublicInbox.pm with $VERSION
  2021-04-01  9:32  4% [PATCH 0/2] lei sucks Eric Wong
@ 2021-04-01  9:32  7% ` Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2021-04-01  9:32 UTC (permalink / raw)
  To: meta

Thanks to git-describe, we can generate and update this
file to aid users in bug reporting.
---
 .gitignore       |  1 +
 MANIFEST         |  1 +
 Makefile.PL      |  9 +++++++--
 t/config.t       |  7 ++++---
 version-gen.perl | 29 +++++++++++++++++++++++++++++
 5 files changed, 42 insertions(+), 5 deletions(-)
 create mode 100644 version-gen.perl

diff --git a/.gitignore b/.gitignore
index f7e4c595..f0370cca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@
 /NEWS.atom
 /NEWS
 *.log
+/lib/PublicInbox.pm
diff --git a/MANIFEST b/MANIFEST
index 49d273fc..5e3b4aec 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -482,6 +482,7 @@ t/www_listing.t
 t/www_static.t
 t/x-unknown-alpine.eml
 t/xcpdb-reshard.t
+version-gen.perl
 xt/cmp-msgstr.t
 xt/cmp-msgview.t
 xt/create-many-inboxes.t
diff --git a/Makefile.PL b/Makefile.PL
index feb89ec1..129b082d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -5,6 +5,7 @@ use strict;
 use ExtUtils::MakeMaker;
 open my $m, '<', 'MANIFEST' or die "open(MANIFEST): $!\n";
 chomp(my @manifest = (<$m>));
+push @manifest, 'lib/PublicInbox.pm'; # generated
 my @EXE_FILES = grep(m!^script/!, @manifest);
 my $v = {};
 my $t = {};
@@ -139,7 +140,7 @@ WriteMakefile(
 	NAME => 'PublicInbox', # n.b. camel-case is not our choice
 
 	# XXX drop "PENDING" in .pod before updating this!
-	VERSION => '1.6.1',
+	VERSION => '1.7.0.PENDING',
 
 	AUTHOR => 'Eric Wong <e@80x24.org>',
 	ABSTRACT => 'public-inbox server infrastructure',
@@ -242,13 +243,17 @@ Makefile.PL : MANIFEST
 # prefix + bindir matches git.git Makefile:
 prefix = \$(HOME)
 bindir = \$(prefix)/bin
-symlink-install :
+symlink-install : lib/PublicInbox.pm
 	mkdir -p \$(bindir)
 	lei=\$\$(realpath lei.sh) && cd \$(bindir) && \\
 	for x in \$(EXE_FILES); do \\
 		ln -sf "\$\$lei" \$\$(basename "\$\$x"); \\
 	done
 
+pure_all :: lib/PublicInbox.pm
+lib/PublicInbox.pm : FORCE
+	VERSION=\$(VERSION) \$(PERL) -w ./version-gen.perl
+
 update-copyrights :
 	\@case '\$(GNULIB_PATH)' in '') echo >&2 GNULIB_PATH unset; false;; esac
 	git ls-files | UPDATE_COPYRIGHT_HOLDER='all contributors' \\
diff --git a/t/config.t b/t/config.t
index 73527ec2..877e5d5d 100644
--- a/t/config.t
+++ b/t/config.t
@@ -1,11 +1,12 @@
 # Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
-use warnings;
-use Test::More;
-use PublicInbox::Config;
+use v5.10.1;
 use PublicInbox::TestCommon;
 use PublicInbox::Import;
+use_ok 'PublicInbox';
+ok(defined(eval('$PublicInbox::VERSION')), 'VERSION defined');
+use_ok 'PublicInbox::Config';
 my ($tmpdir, $for_destroy) = tmpdir();
 
 {
diff --git a/version-gen.perl b/version-gen.perl
new file mode 100644
index 00000000..e9964e30
--- /dev/null
+++ b/version-gen.perl
@@ -0,0 +1,29 @@
+#!perl -w
+use v5.10.1;
+my $v = $ENV{VERSION} // die 'VERSION unset';
+my $f = './lib/PublicInbox.pm';
+if (-d ($ENV{GIT_DIR} // '.git') || -f '.git') {
+	chomp(my $gv = `git describe --match "v[0-9]*" HEAD`);
+	if ($? == 0) {
+		substr($gv, 0, 1, ''); # remove "v"
+		system(qw(git update-index -q --refresh));
+		if (my @n = `git diff-index --name-only HEAD --`) {
+			$gv .= '-dirty';
+		}
+		$v = $gv;
+	}
+}
+$v =~ tr/-/./;
+if (-f $f && do $f && (eval('$PublicInbox::VERSION') // 'undef') eq $v) {
+	exit
+}
+my $tmp = "$f.tmp.$$";
+open my $fh, '>', $tmp  or die "open($tmp): $!";
+print $fh <<EOM or die "print($tmp): $!";
+# this file is generated by $0
+package PublicInbox;
+our \$VERSION = '$v';
+1;
+EOM
+close $fh or die "close($tmp): $!";
+rename($tmp, $f) or die "rename($tmp, $f): $!";

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] lei sucks
@ 2021-04-01  9:32  4% Eric Wong
  2021-04-01  9:32  7% ` [PATCH 1/2] build: generate PublicInbox.pm with $VERSION Eric Wong
  0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2021-04-01  9:32 UTC (permalink / raw)
  To: meta

Inspired by the mutt slogan.

Eric Wong (2):
  build: generate PublicInbox.pm with $VERSION
  lei sucks: sub-command to aid bug reporting

 .gitignore                  |  1 +
 MANIFEST                    |  2 ++
 Makefile.PL                 |  9 +++--
 lib/PublicInbox/LeiSucks.pm | 71 +++++++++++++++++++++++++++++++++++++
 t/config.t                  |  7 ++--
 t/lei.t                     |  1 +
 version-gen.perl            | 29 +++++++++++++++
 7 files changed, 115 insertions(+), 5 deletions(-)
 create mode 100644 lib/PublicInbox/LeiSucks.pm
 create mode 100644 version-gen.perl

^ permalink raw reply	[relevance 4%]

Results 1-4 of 4 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-04-01  9:32  4% [PATCH 0/2] lei sucks Eric Wong
2021-04-01  9:32  7% ` [PATCH 1/2] build: generate PublicInbox.pm with $VERSION Eric Wong
2021-10-19 11:13  5% [PATCH] Makefile.PL: drop generated lib/PublicInbox.pm in blib/ Ævar Arnfjörð Bjarmason
2021-10-19 11:53  0% ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).