summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Crane <arc@cpan.org>2016-10-12 10:34:13 +0100
committerYves Orton <demerphq@gmail.com>2016-10-24 17:36:43 +0200
commit4a59181454f23dbf43f396b924ff7434b63c9d98 (patch)
treeb446470ee4a2e5ac745caca7061675c35385bb16
parentd3148f758506efd28325dfd8e1b698385133f0cd (diff)
downloadperl-4a59181454f23dbf43f396b924ff7434b63c9d98.tar.gz
RT#129229: move sort_manifest() into its own library
This means that the MANIFEST.srt target in the Makefile no longer needs to load a library that depends on Cwd (and other potentially-dynamic modules). That in turn fixes a missing-dependency bug in the Makefile.
-rw-r--r--MANIFEST1
-rw-r--r--Porting/README.pod4
-rw-r--r--Porting/manifest_lib.pl53
-rw-r--r--Porting/manisort2
-rw-r--r--Porting/pod_lib.pl29
-rw-r--r--Porting/pod_rules.pl1
6 files changed, 60 insertions, 30 deletions
diff --git a/MANIFEST b/MANIFEST
index 7c9b752942..d2dfa4c489 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5004,6 +5004,7 @@ Porting/make_snapshot.pl Make a tgz snapshot of our tree with a .patch file in i
Porting/makemeta Create the top-level META.yml
Porting/makerel Release making utility
Porting/manicheck Check against MANIFEST
+Porting/manifest_lib.pl Library for checking and sorting the MANIFEST
Porting/manisort Sort the MANIFEST
Porting/new-perldelta.pl Generate a new perldelta
Porting/newtests-perldelta.pl Generate Perldelta stub for newly added tests
diff --git a/Porting/README.pod b/Porting/README.pod
index af78bbf9e8..bb047eb6e8 100644
--- a/Porting/README.pod
+++ b/Porting/README.pod
@@ -250,6 +250,10 @@ web page to use to generate the snapshot files.
This script outputs a list of files in F<MANIFEST> which don't exist and a
list of files that exist and aren't in F<MANIFEST>.
+=head2 F<manifest_lib.pl>
+
+This library provides functions used in checking and sorting the F<MANIFEST>.
+
=head2 F<manisort>
This script sorts the files in F<MANIFEST>.
diff --git a/Porting/manifest_lib.pl b/Porting/manifest_lib.pl
new file mode 100644
index 0000000000..0b63046056
--- /dev/null
+++ b/Porting/manifest_lib.pl
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+use strict;
+
+=head1 NAME
+
+Porting/manifest_lib.pl - functions for managing manifests
+
+=head1 SYNOPSIS
+
+ require './Porting/manifest_lib.pl';
+
+=head1 DESCRIPTION
+
+=head2 C<sort_manifest>
+
+Treats its arguments as (chomped) lines from a MANIFEST file, and returns that
+listed sorted appropriately.
+
+=cut
+
+# Try to get a sane sort. case insensitive, more or less
+# sorted such that path components are compared independently,
+# and so that lib/Foo/Bar sorts before lib/Foo-Alpha/Baz
+# and so that lib/Foo/Bar.pm sorts before lib/Foo/Bar/Alpha.pm
+# and so that configure and Configure sort together.
+sub sort_manifest {
+ return
+ # case insensitive sorting of directory components independently.
+ map { $_->[0] } # extract the full line
+ sort {
+ $a->[1] cmp $b->[1] || # sort in order of munged filename
+ $a->[0] cmp $b->[0] # then by the exact text in full line
+ }
+ map {
+ # split out the filename and the description
+ my ($f) = split /\s+/, $_, 2;
+ # lc the filename so Configure and configure sort together in the list
+ my $m= lc $f; # $m for munged
+ # replace slashes by nulls, this makes short directory names sort before
+ # longer ones, such as "foo/" sorting before "foo-bar/"
+ $m =~ s!/!\0!g;
+ # replace the extension (only one) by null null extension.
+ # this puts any foo/blah.ext before any files in foo/blah/
+ $m =~ s!(\.[^.]+\z)!\0\0$1!;
+ # return the original string, and the munged filename
+ [ $_, $m ];
+ } @_;
+}
+
+1;
+
+# ex: set ts=8 sts=4 sw=4 et:
diff --git a/Porting/manisort b/Porting/manisort
index 72cbb9c455..3d698e2743 100644
--- a/Porting/manisort
+++ b/Porting/manisort
@@ -14,7 +14,7 @@ $| = 1;
# Get command line options
use Getopt::Long;
-require "Porting/pod_lib.pl";
+require "Porting/manifest_lib.pl";
my $outfile;
my $check_only = 0;
my $quiet = 0;
diff --git a/Porting/pod_lib.pl b/Porting/pod_lib.pl
index 4ad204cb49..6eaacde48c 100644
--- a/Porting/pod_lib.pl
+++ b/Porting/pod_lib.pl
@@ -663,35 +663,6 @@ sub get_pod_metadata {
return \%state;
}
-# Try to get a sane sort. case insensitive, more or less
-# sorted such that path components are compared independently,
-# and so that lib/Foo/Bar sorts before lib/Foo-Alpha/Baz
-# and so that lib/Foo/Bar.pm sorts before lib/Foo/Bar/Alpha.pm
-# and so that configure and Configure sort together.
-sub sort_manifest {
- return
- # case insensitive sorting of directory components independently.
- map { $_->[0] } # extract the full line
- sort {
- $a->[1] cmp $b->[1] || # sort in order of munged filename
- $a->[0] cmp $b->[0] # then by the exact text in full line
- }
- map {
- # split out the filename and the description
- my ($f) = split /\s+/, $_, 2;
- # lc the filename so Configure and configure sort together in the list
- my $m= lc $f; # $m for munged
- # replace slashes by nulls, this makes short directory names sort before
- # longer ones, such as "foo/" sorting before "foo-bar/"
- $m =~ s!/!\0!g;
- # replace the extension (only one) by null null extension.
- # this puts any foo/blah.ext before any files in foo/blah/
- $m =~ s!(\.[^.]+\z)!\0\0$1!;
- # return the original string, and the munged filename
- [ $_, $m ];
- } @_;
-}
-
1;
# ex: set ts=8 sts=4 sw=4 et:
diff --git a/Porting/pod_rules.pl b/Porting/pod_rules.pl
index af5550ebf2..37cbb9cca1 100644
--- a/Porting/pod_rules.pl
+++ b/Porting/pod_rules.pl
@@ -33,6 +33,7 @@ if (ord("A") == 193) {
);
require 'Porting/pod_lib.pl';
+require 'Porting/manifest_lib.pl';
sub my_die;
# process command-line switches