From 827f63a065432e4223cef357e47992291f34f15e Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Mon, 29 May 2023 09:12:44 +0200 Subject: [PATCH] Cleanup unused cowsay files (related to legacy Perl binary version) Summary: Premising that Remarkup supports a fully-featured cowsay generator (!)... since 2015 this awesome thing no longer requires a binary cowsay command, since everything was rewritten in the core: c705c8011e964945a6f73ae78087e188de0bd71f So, some files from the legacy cowsay version in Perl can be safely removed. We still thank the original author Tony Monroe for the original version in Perl (dated 2000), and Evan Priestley for the re-implementation in PHP. Probably nobody knows about this feature. This may change in the future. See T15401. Closes T15418 Test Plan: Try some awesome cows to verify that everything still works. For instance: ``` cowsay {{{ hello }}} ``` ``` cowsay (think=yes,eyes=XX,tongue=^^) {{{ hello }}} ``` ``` cowsay (cow=stegosaurus) {{{ hello }}} ``` If nothing explodes, yuppie! Cowsay still works. Credits to the original version in Perl remained in place. Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15418 Differential Revision: https://we.phorge.it/D25242 --- externals/cowsay/INSTALL | 15 --- externals/cowsay/MANIFEST | 11 -- externals/cowsay/README | 8 ++ externals/cowsay/Wrap.pm.diff | 47 ------- externals/cowsay/cowsay | 187 ---------------------------- externals/cowsay/cowsay.1 | 168 ------------------------- externals/cowsay/install.sh | 92 -------------- externals/cowsay/pgp_public_key.txt | 14 --- 8 files changed, 8 insertions(+), 534 deletions(-) delete mode 100644 externals/cowsay/INSTALL delete mode 100644 externals/cowsay/MANIFEST delete mode 100644 externals/cowsay/Wrap.pm.diff delete mode 100755 externals/cowsay/cowsay delete mode 100644 externals/cowsay/cowsay.1 delete mode 100755 externals/cowsay/install.sh delete mode 100644 externals/cowsay/pgp_public_key.txt diff --git a/externals/cowsay/INSTALL b/externals/cowsay/INSTALL deleted file mode 100644 index d3844ca565..0000000000 --- a/externals/cowsay/INSTALL +++ /dev/null @@ -1,15 +0,0 @@ -================= -Installing cowsay -================= - -If you really want to get things installed a nice and pretty way, - - sh install.sh - -It will ask approximately one question. If you can't answer it, -you need serious help. - -If the install goes well, you can start cowing immediately! Just -be sure to read the manual page first... - -$Id: INSTALL,v 1.1 1999/08/14 08:03:17 tony Exp $ diff --git a/externals/cowsay/MANIFEST b/externals/cowsay/MANIFEST deleted file mode 100644 index a3ff805fed..0000000000 --- a/externals/cowsay/MANIFEST +++ /dev/null @@ -1,11 +0,0 @@ -ChangeLog Changes to recent versions. -INSTALL Instructions for installing cowsay. -LICENSE The license for use and redistribution of cowsay. -MANIFEST This file. -README Read this first. Really. -Wrap.pm.diff Diff for Text/Wrap.pm. -cows/* Support files used by cowsay. -cowsay Main cowsay executable. -cowsay.1 Main cowsay manual page. -install.sh cowsay installation script. -pgp_public_key.txt Verify the signature file with this key. diff --git a/externals/cowsay/README b/externals/cowsay/README index b5de08c405..50b746c1ec 100644 --- a/externals/cowsay/README +++ b/externals/cowsay/README @@ -36,3 +36,11 @@ this directory. -- Tony Monroe (tony@nog.net) $Id: README,v 1.3 2000/05/28 06:24:46 tony Exp $ + +---- + +In September 2015, Phabricator imported the Perl version of cowsay +in the core, to use its nice template files. Anyway, the logic now +is not in Perl. It was re-implemented in PHP, here: + +src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php diff --git a/externals/cowsay/Wrap.pm.diff b/externals/cowsay/Wrap.pm.diff deleted file mode 100644 index 1da064079e..0000000000 --- a/externals/cowsay/Wrap.pm.diff +++ /dev/null @@ -1,47 +0,0 @@ -*** Wrap.pm.in Thu May 22 00:21:42 1997 ---- Wrap.pm Fri Nov 12 10:00:15 1999 -*************** -*** 3,9 **** - require Exporter; - - @ISA = (Exporter); -! @EXPORT = qw(wrap); - @EXPORT_OK = qw($columns); - - $VERSION = 97.011701; ---- 3,9 ---- - require Exporter; - - @ISA = (Exporter); -! @EXPORT = qw(wrap fill); - @EXPORT_OK = qw($columns); - - $VERSION = 97.011701; -*************** -*** 66,71 **** ---- 66,90 ---- - - print "-----------$r---------\n" if $debug;; - return $r; -+ } -+ -+ ## Copied up from below. -+ sub fill -+ { -+ my ($ip, $xp, @raw) = @_; -+ my @para; -+ my $pp; -+ -+ for $pp (split(/\n\s+/, join("\n",@raw))) { -+ $pp =~ s/\s+/ /g; -+ my $x = wrap($ip, $xp, $pp); -+ push(@para, $x); -+ } -+ -+ # if paragraph_indent is the same as line_indent, -+ # separate paragraphs with blank lines -+ -+ return join ($ip eq $xp ? "\n\n" : "\n", @para); - } - - 1; diff --git a/externals/cowsay/cowsay b/externals/cowsay/cowsay deleted file mode 100755 index 900ca46014..0000000000 --- a/externals/cowsay/cowsay +++ /dev/null @@ -1,187 +0,0 @@ -#%BANGPERL% - -## -## Cowsay 3.03 -## -## This file is part of cowsay. (c) 1999-2000 Tony Monroe. -## - -use Text::Tabs qw(expand); -use Text::Wrap qw(wrap fill $columns); -use File::Basename; -use Getopt::Std; -use Cwd; - -$version = "3.03"; -$progname = basename($0); -$eyes = "oo"; -$tongue = " "; -$cowpath = $ENV{'COWPATH'} || '%PREFIX%/share/cows'; -@message = (); -$thoughts = ""; - -## Yeah, this is rude, I know. But hopefully it gets around a nasty -## little version dependency. - -$Text::Wrap::initial_tab = 8; -$Text::Wrap::subsequent_tab = 8; -$Text::Wrap::tabstop = 8; - -## One of these days, we'll get it ported to Windows. Yeah, right. - -if (($^O eq "MSWin32") or ($^O eq "Windows_NT")) { ## Many perls, eek! - $pathsep = ';'; -} else { - $pathsep = ':'; -} - -%opts = ( - 'e' => 'oo', - 'f' => 'default.cow', - 'n' => 0, - 'T' => ' ', - 'W' => 40, -); - -getopts('bde:f:ghlLnNpstT:wW:y', \%opts); - -&display_usage if $opts{'h'}; -&list_cowfiles if $opts{'l'}; - -$borg = $opts{'b'}; -$dead = $opts{'d'}; -$greedy = $opts{'g'}; -$paranoid = $opts{'p'}; -$stoned = $opts{'s'}; -$tired = $opts{'t'}; -$wired = $opts{'w'}; -$young = $opts{'y'}; -$eyes = substr($opts{'e'}, 0, 2); -$tongue = substr($opts{'T'}, 0, 2); -$the_cow = ""; - -&slurp_input; -$Text::Wrap::columns = $opts{'W'}; -@message = ($opts{'n'} ? expand(@message) : - split("\n", fill("", "", @message))); -&construct_balloon; -&construct_face; -&get_cow; -print @balloon_lines; -print $the_cow; - -sub list_cowfiles { - my $basedir; - my @dirfiles; - chop($basedir = cwd); - for my $d (split(/$pathsep/, $cowpath)) { - print "Cow files in $d:\n"; - opendir(COWDIR, $d) || die "$0: Cannot open $d\n"; - for my $file (readdir COWDIR) { - if ($file =~ s/\.cow$//) { - push(@dirfiles, $file); - } - } - closedir(COWDIR); - print wrap("", "", sort @dirfiles), "\n"; - @dirfiles = (); - chdir($basedir); - } - exit(0); -} - -sub slurp_input { - unless ($ARGV[0]) { - chomp(@message = ); - } else { - &display_usage if $opts{'n'}; - @message = join(' ', @ARGV); - } -} - -sub maxlength { - my ($l, $m); - $m = -1; - for my $i (@_) { - $l = length $i; - $m = $l if ($l > $m); - } - return $m; -} - -sub construct_balloon { - my $max = &maxlength(@message); - my $max2 = $max + 2; ## border space fudge. - my $format = "%s %-${max}s %s\n"; - my @border; ## up-left, up-right, down-left, down-right, left, right - if ($0 =~ /think/i) { - $thoughts = 'o'; - @border = qw[ ( ) ( ) ( ) ]; - } elsif (@message < 2) { - $thoughts = '\\'; - @border = qw[ < > ]; - } else { - $thoughts = '\\'; - if ($V and $V gt v5.6.0) { # Thanks, perldelta. - @border = qw[ / \\ \\ / | | ]; - } else { - @border = qw[ / \ \ / | | ]; - } - } - push(@balloon_lines, - " " . ("_" x $max2) . " \n" , - sprintf($format, $border[0], $message[0], $border[1]), - (@message < 2 ? "" : - map { sprintf($format, $border[4], $_, $border[5]) } - @message[1 .. $#message - 1]), - (@message < 2 ? "" : - sprintf($format, $border[2], $message[$#message], $border[3])), - " " . ("-" x $max2) . " \n" - ); -} - -sub construct_face { - if ($borg) { $eyes = "=="; } - if ($dead) { $eyes = "xx"; $tongue = "U "; } - if ($greedy) { $eyes = "\$\$"; } - if ($paranoid) { $eyes = "@@"; } - if ($stoned) { $eyes = "**"; $tongue = "U "; } - if ($tired) { $eyes = "--"; } - if ($wired) { $eyes = "OO"; } - if ($young) { $eyes = ".."; } -} - -sub get_cow { -## -## Get a cow from the specified cowfile; otherwise use the default cow -## which was defined above in $the_cow. -## - my $f = $opts{'f'}; - my $full = ""; - if ($opts{'f'} =~ m,/,) { - $full = $opts{'f'}; - } else { - for my $d (split(/:/, $cowpath)) { - if (-f "$d/$f") { - $full = "$d/$f"; - last; - } elsif (-f "$d/$f.cow") { - $full = "$d/$f.cow"; - last; - } - } - if ($full eq "") { - die "$progname: Could not find $f cowfile!\n"; - } - } - do $full; - die "$progname: $@\n" if $@; -} - -sub display_usage { - die </dev/null 2>&1; then - echo Found a good perl in $perl - goodperls="$goodperls $perl" - fi -done -echo The following perl executables will run cowsay: -echo $goodperls -echo I recommend the latest stable perl you can find. -set $goodperls -if [ -z "$1" ]; then - echo Ack! You do not have Perl 5 installed correctly! - echo Get thee to CPAN! - exit 1 -fi -usethisperl=$1 -echo I will be using $1 because I know it will work. - -echo Now I need an installation prefix. I will use /usr/local unless -printf "you give me a better idea here: " -if [ -n "$backdoor" ]; then - prefix=$backdoor - printf "%s (specified on command line)\n" $prefix -else - read prefix -fi - -PREFIX=${prefix:-/usr/local} - -echo Okay, time to install this puppy. - -echo s,%BANGPERL%,!$usethisperl,\; > install.pl -echo s,%PREFIX%,$PREFIX,\; >> install.pl -set -x -mkdir -p $PREFIX/bin || (mkdir $PREFIX; mkdir $PREFIX/bin) -$usethisperl -p install.pl cowsay > $PREFIX/bin/cowsay -chmod a+x $PREFIX/bin/cowsay -ln -s cowsay $PREFIX/bin/cowthink -mkdir -p $PREFIX/man/man1 || ($mkdir $PREFIX; mkdir $PREFIX/man; mkdir $PREFIX/man/man1) -$usethisperl -p install.pl cowsay.1 > $PREFIX/man/man1/cowsay.1 -chmod a+r $PREFIX/man/man1/cowsay.1 -ln -s cowsay.1 $PREFIX/man/man1/cowthink.1 -mkdir -p $PREFIX/share/cows || (mkdir $PREFIX; mkdir $PREFIX/share; mkdir $PREFIX/share/cows) -tar -cf - $filelist | (cd $PREFIX/share && tar -xvf -) -set +x - -echo Okay, let us see if the install actually worked. - -if [ ! -f $PREFIX/share/cows/default.cow ]; then - echo The default cow file did not make it across! - echo Ooops, it failed...sorry! - exit 1 -fi - -echo Installation complete! Enjoy the cows! diff --git a/externals/cowsay/pgp_public_key.txt b/externals/cowsay/pgp_public_key.txt deleted file mode 100644 index 135735e6f9..0000000000 --- a/externals/cowsay/pgp_public_key.txt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: 2.6.2 - -mQCNAzNS+H4AAAEEAMilCcxLMIqMNXhZoeHjbeJGnHoKP0JpKDejz66qBlDwP+du -FvVBHkyNIuU3orKe7l/aXIR8TcpjrxdcmrjjzwuB1aV48V4swT7v9UXvv9YP41Pd -1pXYXNelXHmE0eKSfcnkkFmYTJBXPaPNTJ3rpZpZOEW3SfgrrheqQm6w/6IJAAUR -tBpUb255IE1vbnJvZSA8dG9ueUBub2cubmV0PrQdVG9ueSBNb25yb2UgPHRtb25y -b2VAbm9nLm5ldD6JAJUDBRA2bDA5F6pCbrD/ogkBASOZA/9XtYSpcPjpi62MTEZl -l+wV1svtlUlPvKkDE7FB9bwnMbF1FgGhTe/H4/8qDu20m5eGxMX58Ri7HPXWjjJ/ -CrUWMzGVbg1JBkgh+d9QvEywmR0j4WezaifW1nCbxk0GrW1PjJyGb3kx7vrIF1Km -xt6VwxTgfJzjIioBJFb4EiDyaLQnVG9ueSBNb25yb2UgPHRtb25yb2VAQ1NVQS5C -ZXJrZWxleS5FRFU+ -=WpM4 ------END PGP PUBLIC KEY BLOCK----- -- 2.51.2