Browse Source

get rid of IPC::System::Simple dependency

Just loop over a stream instead.
main
Brennen Bearnes 8 months ago
parent
commit
cf058ce3f2
2 changed files with 7 additions and 35 deletions
  1. +3
    -14
      README.md
  2. +4
    -21
      git-changelog

+ 3
- 14
README.md View File

@ -33,21 +33,10 @@ INSTALLING
This shells out to `git`, so you'll need a working Git installation.
You'll also need IPC::System::Simple. On a Linux system, you can probably
install with:
You'll need a working, relatively recent Perl. I don't think it has any Perl
dependencies outside of the standard library.
```
sudo cpan -i IPC::System::Simple
```
On Debian, it's in apt as `libipc-system-simple-perl`. You can probably
install on a Debian system with:
```
sudo apt-get install libipc-system-simple-perl
```
After that, copy `git-changelog` to somewhere in your path.
Otherwise, copy `git-changelog` to somewhere in your path.
I'll package this up for CPAN at some point. Probably.


+ 4
- 21
git-changelog View File

@ -23,11 +23,6 @@ points for each commit since the previous version.
Urgency is just hardcoded to "high". I guess it probably ought to be...
Sensitive to semver or something? I don't really know.
=head1 INSTALLING
You'll need IPC::System::Simple. It's in Debian as
`libipc-system-simple-perl`.
=head1 AUTHOR
Brennen Bearnes
@ -47,9 +42,6 @@ use 5.10.0;
use Getopt::Long;
use POSIX qw(strftime);
# Turns out to be pretty much exactly what I want for system calls:
use IPC::System::Simple qw(capturex);
my $project_name = 'project';
my $distribution = 'distribution';
GetOptions(
@ -59,17 +51,14 @@ GetOptions(
# See PRETTY FORMATS in git-log(1) for placeholders.
# https://git-scm.com/docs/pretty-formats
my $log = git(
'log',
'--reverse',
qq{--pretty=format:%H\t%d\t%aD\t%aN\t%aE\t%s}
);
open (my $logstream, "git log --reverse --pretty='format:%H\t%d\t%aD\t%aN\t%aE\t%s' |")
or die("$0: Failed to run git\n$!\n");
my @changes;
my @loglines = split "\n", $log;
my @changelog_entries;
for my $line (@loglines)
while (my $line = <$logstream>)
{
chomp($line);
my @fields = split "\t", $line;
my ($hash, $decoration, $date, $author_name, $author_mail, $subject) = @fields;
my $author = "$author_name <$author_mail>";
@ -86,9 +75,6 @@ for my $line (@loglines)
}
}
# Might be useful if you wanted to pull out other details:
# my $full_commit = git('show', $hash);
# Accumulate commit subject lines:
push @changes, $subject;
@ -123,6 +109,3 @@ $body
-- $author $date
CHANGELOG
}
# Run git with some options, return result:
sub git { capturex('git', @_); }

Loading…
Cancel
Save