develooper Front page | perl.perl5.porters | Postings from April 2013

[PATCH] On eliminating external tools from the release process

Thread Next
Max Maischein
April 4, 2013 02:24
[PATCH] On eliminating external tools from the release process
Message ID:
Hi p5p,

several of our tools for the release process rely on Unix shell tools 
being available. This somewhat hampers the ability to do a release using 
only Windows or other OSes where the "unix centric" toolset is 
unavailable, but keeps the scripts themselves fairly simple.

During my release of 5.17.10, I patched away some of the external tools 
of Porting/sync-with-cpan, so it mostly works under Windows, and without 
reliance on the external programs. The patches are attached below, and 
separated thematically but please do not immediately apply them.

I found two general steps for eliminating external tools:

1) Perl already comes with ExtUtils::Command, which is a good 
replacement for many common shell commands. I assume that most of 
ExtUtils::Command was even written to replace common shell commands. The 
first patch changes many calls to these external tools to external calls 
to ExtUtils::Command. Supposedly, I could instead appropriate (code 
from) Shell::Command to remove the reliance on an external (Perl) 
process, but in my limited testing, this didn't always work.

2) As second example, Perl (now) has HTTP::Tiny in the core. We /could/ 
thus replace the reliance on `wget` in the script with use of 
HTTP::Tiny, which provides a fair bit of HTTP capability, even some proxies.

The immediate downside of this is that we lose all additional features 
that `wget` may bring, like SOCKS proxies, HTTPS etc.

The attached version of my changes adds five lines for every simple call 
to `wget`, trying with HTTP::Tiny first and falling back to the original 
`wget` second:

+    eval {
+        require HTTP::Tiny;
+        my $http= HTTP::Tiny->new();
+        $http->mirror( $url => $new_file );
+        1
+    } or system wget => $url, '-qO', $new_file;

I'm not sure if keeping both code paths is "worth it". Also, I'm not 
sure whether eliminating the use of external tools is a goal of any merit.

Happy Easter,

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About