Skip to content

Add -c flag to specify changes content on the command line #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# brian's standard GitHub Actions Ubuntu config for Perl 5 modules
# version 20250101.001
# version 20250126.002
# https://github.com/briandfoy/github_workflows
# https://github.com/features/actions
# This file is licensed under the Artistic License 2.0
Expand All @@ -8,6 +8,24 @@
# in your repo settings. Or not. It still works if it isn't defined.
# In that environment, add whatever environment variables or secrets
# that you want.
#
# Variables that you can set in the "automated_testing" environment:
#
# EXTRA_CPAN_MODULES - extra arguments to the first call to cpan.
# Just use EXTRA_CPANM_MODULES though. This is
# here for legacy
#
# EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050
#
# UBUNTU_EXTRA_APT_GET - extra packages to install before we start
#
# UBUNTU_EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm
# but only on Ubuntu. Other workflows won't use this.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050

---
name: ubuntu

Expand Down Expand Up @@ -52,7 +70,7 @@ on:
pull_request:
# weekly build on the master branch just to see what CPAN is doing
schedule:
- cron: "59 13 * * 0"
- cron: "37 3 * * 0"
jobs:
perl:
environment: automated_testing
Expand Down Expand Up @@ -81,13 +99,17 @@ jobs:
- uses: actions/checkout@v3
- name: Platform check
run: uname -a
- name: setup platform
run: |
apt-get upgrade
apt-get -y install curl ${{ vars.UBUNTU_EXTRA_APT_GET }}
- name: Perl version check
run: |
perl -V
perl -v | perl -0777 -ne 'm/(v5\.\d+)/ && print "PERL_VERSION=$1"' >> $GITHUB_ENV
# Some older versions of Perl have trouble with hostnames in certs. I
# haven't figured out why.
- name: Setup environment
- name: enhance environment
run: |
echo "PERL_LWP_SSL_VERIFY_HOSTNAME=0" >> $GITHUB_ENV
# HTML::Tagset bumped its minimum version to v5.10 for no good reason
Expand All @@ -102,13 +124,14 @@ jobs:
- name: fix html-tagset for v5.8
if: env.PERL_VERSION == 'v5.8'
run: |
cpan App::Cpan
curl -L -O https://cpan.metacpan.org/authors/id/P/PE/PETDANCE/HTML-Tagset-3.24.tar.gz
tar -xzf HTML-Tagset-3.24.tar.gz
cd HTML-Tagset-3.24
rm META.*
mv Makefile.PL Makefile.PL.orig
perl -n -e 'next if /(^use 5)|(MIN_PERL)/; print' Makefile.PL.orig > Makefile.PL
cpan -T .
cpan -M http://www.cpan.org -T .
cd ..
pwd
ls
Expand All @@ -121,13 +144,14 @@ jobs:
- name: Install cpanm and multiple modules
run: |
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm --notest IO::Socket::SSL LWP::Protocol::https App::Cpan HTTP::Tiny ExtUtils::MakeMaker Test::Manifest Test::More
cpanm --notest IO::Socket::SSL LWP::Protocol::https App::Cpan HTTP::Tiny ExtUtils::MakeMaker Test::Manifest Test::More ${{ vars.EXTRA_CPANM_MODULES }} ${{ vars.UBUNTU_EXTRA_CPANM_MODULES }}
cpan -M http://www.cpan.org -T Test::Manifest ${{ vars.EXTRA_CPAN_MODULES }}
# Install the dependencies, again not testing them. This installs the
# module in the current directory, so we end up installing the module,
# but that's not a big deal.
- name: Install dependencies
run: |
cpanm --notest --installdeps --with-suggests --with-recommends . ${{ vars.EXTRA_CPAN_MODULES }}
cpanm --notest --installdeps --with-suggests --with-recommends .
- name: Show cpanm failures
if: ${{ failure() }}
run: |
Expand Down Expand Up @@ -167,7 +191,7 @@ jobs:
- name: Run coverage tests
if: env.PERL_VERSION != 'v5.8' && env.PERL_VERSION != 'v5.10'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cpanm --notest Devel::Cover Devel::Cover::Report::Coveralls
perl Makefile.PL
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# brian's standard GitHub Actions macOS config for Perl 5 modules
# version 20250101.001
# version 20250125.002
# https://github.com/briandfoy/github_workflows
# https://github.com/features/actions
# This file is licensed under the Artistic License 2.0
Expand All @@ -8,6 +8,21 @@
# in your repo settings. Or not. It still works if it isn't defined.
# In that environment, add whatever environment variables or secrets
# that you want.
#
# Variables that you can set in the "automated_testing" environment:
#
# EXTRA_CPAN_MODULES - extra arguments to the first call to cpan.
# Just use EXTRA_CPANM_MODULES though. This is
# here for legacy
#
# EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050
#
# MACOS_EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm
# but only on macOS. Other workflows won't use this.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050
---
name: macos

Expand Down Expand Up @@ -78,14 +93,14 @@ jobs:
- name: Prepare cpan
run: |
openssl version
cpan -M http://www.cpan.org -T IO::Socket::SSL HTTP::Tiny
cpan -M https://www.cpan.org -T ExtUtils::MakeMaker Test::Manifest
cpan -M https://www.cpan.org -T App::cpanminus IO::Socket::SSL HTTP::Tiny ExtUtils::MakeMaker Test::Manifest ${{ vars.EXTRA_CPAN_MODULES }}
cpanm --notest Test::Manifest ${{ vars.EXTRA_CPANM_MODULES }} ${{ vars.MACOS_EXTRA_CPANM_MODULES }}
# Install the dependencies, again not testing them. This installs the
# module in the current directory, so we end up installing the module,
# but that's not a big deal.
- name: Install dependencies
run: |
cpan -M https://www.cpan.org -T . ${{ vars.EXTRA_CPAN_MODULES }}
cpan -M https://www.cpan.org -T .
- name: Run tests
run: |
perl Makefile.PL
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# brian's standard GitHub Actions release config for Perl 5 modules
# version 20241118.001
# version 20241125.002
# https://github.com/briandfoy/github_workflows
# https://github.com/features/actions
# This file is licensed under the Artistic License 2.0
Expand All @@ -12,6 +12,21 @@
# This requires that you configure a repository secret named
# RELEASE_ACTION_TOKEN with a GitHub Personal Access Token
# that has "read and write" permissions on Repository/Contents
#
# Variables that you can set in the "automated_testing" environment:
#
# EXTRA_CPAN_MODULES - extra arguments to the first call to cpan.
# Just use EXTRA_CPANM_MODULES though. This is
# here for legacy
#
# EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050
#
# UBUNTU_EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm
# but only on Ubuntu. Other workflows won't use this.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050
---
name: release

Expand Down Expand Up @@ -74,13 +89,14 @@ jobs:
- name: Install cpanm and multiple modules
run: |
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm --notest IO::Socket::SSL HTTP::Tiny ExtUtils::MakeMaker Test::Manifest
cpanm --notest IO::Socket::SSL HTTP::Tiny ExtUtils::MakeMaker Test::Manifest ${{ vars.EXTRA_CPANM_MODULES }} ${{ vars.UBUNTU_EXTRA_CPANM_MODULES }}
cpan -M http://www.cpan.org -T Test::Manifest ${{ vars.EXTRA_CPAN_MODULES }}
# Install the dependencies, again not testing them. This installs the
# module in the current directory, so we end up installing the module,
# but that's not a big deal.
- name: Install dependencies
run: |
cpanm --notest --installdeps --with-suggests --with-recommends . ${{ vars.EXTRA_CPAN_MODULES }}
cpanm --notest --installdeps --with-suggests --with-recommends .
# This makes the distribution and tests it, but assumes by the time we
# got here, everything else was already tested.
- name: Create distro
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# brian's standard GitHub Actions Windows config for Perl 5 modules
# version 20250101.001
# version 20250126.001
# https://github.com/briandfoy/github_workflows
# https://github.com/features/actions
# This file is licensed under the Artistic License 2.0
Expand All @@ -8,6 +8,19 @@
# in your repo settings. Or not. It still works if it isn't defined.
# In that environment, add whatever environment variables or secrets
# that you want.
#
# EXTRA_CPAN_MODULES - extra arguments to the first call to cpan.
# Just use EXTRA_CPANM_MODULES though. This is
# here for legacy
#
# EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050
#
# WINDOWS_EXTRA_CPANM_MODULES - extra arguments to the first call to cpanm
# but only on Windows. Other workflows won't use this.
# this is useful to install very particular
# modules, such as DBD::mysql@4.050
---
name: windows

Expand Down Expand Up @@ -66,19 +79,32 @@ jobs:
- uses: actions/checkout@v3
- name: Set up Perl
run: |
choco install strawberryperl
choco uninstall strawberryperl
choco upgrade strawberryperl
echo "C:\strawberry\c\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\strawberry\perl\site\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\strawberry\perl\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Perl version
run: perl -V
# cpan can operate with https, but we need IO::SSL::Socket, which
# does not come with Perl.
#
# When using cpan, use -M to specify the CDN-backed www.cpan.org
# mirror. I've noticed that letting CPAN.pm auto-choose mirrors
# sometimes selects things that the action can't reach.
#
# Also, use the -T option to not test the dependencies. Assume these
# mainline modules are good and save lots of CI minutes.
- name: Install cpanm and multiple modules
run: |
cpan -M http://www.cpan.org -T App::cpanminus ${{ vars.EXTRA_CPAN_MODULES }}
cpanm --notest IO::Socket::SSL LWP::Protocol::https HTTP::Tiny ExtUtils::MakeMaker Test::Manifest Test::More ${{ vars.EXTRA_CPANM_MODULES }} ${{ vars.WINDOWS_EXTRA_CPANM_MODULES }}
# Install the dependencies, again not testing them. This installs the
# module in the current directory, so we end up installing the module,
# but that's not a big deal.
- name: Install dependencies
run: |
cpan -M https://www.cpan.org -T .
cpan -M https://www.cpan.org -T Test::Manifest ${{ vars.EXTRA_CPAN_MODULES }}
- name: Run tests
run: |
perl Makefile.PL
Expand Down
1 change: 0 additions & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ LICENSE
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
Module-Release-2.136.tar.gz
README.pod
script/release
script/release-test
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ ToDo
\.github_token
\.gitattributes\b

Module-Release-

none
38 changes: 31 additions & 7 deletions lib/Module/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ use strict;
use warnings;
no warnings;

our $VERSION = '2.136';
our $VERSION = '2.137';

use Carp qw(carp croak);
use File::Basename qw(dirname);
use File::Spec;
use IPC::Open3;
use Scalar::Util qw(blessed);
use Symbol 'gensym';

my %Loaded_mixins = ( );

Expand Down Expand Up @@ -1321,26 +1323,48 @@ sub run {
$self->_debug( "$command\n" );
$self->_die( "Didn't get a command!" ) unless defined $command;

open my($fh), "-|", "$command" or $self->_die( "Could not open command [$command]: $!" );
$fh->autoflush;
my $pid = IPC::Open3::open3(
my $child_in, my $child_out, my $child_err = gensym,
$command
);
close $child_in;

$child_out->autoflush;

#open my($fh), "-|", "$command" or $self->_die( "Could not open command [$command]: $!" );
#$fh->autoflush;

my $output = '';
my $error = '';
my $buffer = '';
local $| = 1;

my $readlen = $self->debug ? 1 : 256;

while( read $fh, $buffer, $readlen ) {
$output .= $_;
while( read $child_out, $buffer, $readlen ) {
$self->_debug( $_, $buffer );
$output .= $buffer;
}

while( read $child_err, $buffer, $readlen ) {
$self->_debug( $_, $buffer );
$error .= $buffer;
}

if( $error =~ m/exec of .*? failed| Windows/x ) {
$self->_warn( "Could not run <$command>: $error" );
}
$self->_debug( $self->_dashes, "\n" );

unless( close $fh ) {
waitpid( $pid, 0 );
my $child_exit_status = $? >> 8;


$self->_warn( $error ) if length $error;

if( $child_exit_status ) {
$self->_run_error_set;
$self->_warn( "Command [$command] didn't close cleanly: $?" );
$self->_warn( "Command [$command] didn't close cleanly: $child_exit_status" );
}

return $output;
Expand Down
Loading
Loading