commit 0efcc7d21163aab72895f1856b36203033b79b3f
parent 3809e8cf56508fd5c86a9d180783a077be785126
Author: lash <dev@holbrook.no>
Date: Sun, 15 Sep 2024 17:43:00 +0100
Look up changelog in src file, add copyright
Diffstat:
6 files changed, 18 insertions(+), 43 deletions(-)
diff --git a/Bluto.pm b/Bluto.pm
@@ -7,6 +7,7 @@ use Log::Term::Ansi qw/error info debug warn trace/;
use Bluto::Archive;
use Bluto::Announce;
use Bluto::Tree;
+use File::Path qw / make_path /;
use constant { VCS_TAG_PREFIX => 'v' };
use constant { VERSION => '0.0.1' };
@@ -25,6 +26,7 @@ our %m_main = (
version => undef,
summary => undef,
license => undef,
+ copyright => undef,
tag_prefix => VCS_TAG_PREFIX,
changelog => undef,
time => undef,
@@ -193,6 +195,7 @@ sub from_config {
$r += _set_single($cfg, 'main.slug', 'slug', 1);
$r += _set_single($cfg, 'main.summary', 'summary', 1);
$r += _set_single($cfg, 'main.license', 'license', 1);
+ $r += _set_single($cfg, 'main.copyright', 'copyright', 1);
$r += _set_single($cfg, 'main.uri', 'uri', 1);
$r += _set_author($cfg, 'maintainer', 1);
if ($r) {
@@ -282,14 +285,13 @@ sub from_config {
} else {
push(@changelog_candidates, $version_src);
}
-
push(@changelog_candidates, "CHANGELOG." . $have_version_match);
push(@changelog_candidates, "CHANGELOG/" . $have_version_match);
push(@changelog_candidates, "CHANGELOG/CHANGELOG." . $have_version_match);
# TODO: if have sha256, check against the contents
for my $fn (@changelog_candidates) {
- my $fp = File::Spec->catfile ( $env->{content_dir}, $fn );
+ my $fp = File::Spec->catfile ( $env->{src_dir}, $fn );
if (open(my $f, '<', $fp)) {
$m_main{changelog} = '';
my $i = 0;
@@ -336,7 +338,9 @@ sub create_announce {
return undef;
}
- my $fp = File::Spec->catfile(Bluto::Tree->announce_path, $m_main{slug} . '.bluto.txt');
+ my $fp_base = File::Spec->catfile(Bluto::Tree->announce_path, $m_main{slug});
+ make_path($fp_base);
+ my $fp = File::Spec->catfile($fp_base, $m_main{slug} . '-' . $m_main{version} . '.bluto.txt');
open($f, '>', $fp) or (error('cannot open announce file: ' . $!) && return undef);
print $f $out;
close($f);
diff --git a/Bluto/Announce.pm b/Bluto/Announce.pm
@@ -77,6 +77,8 @@ Version release: [% version %]
License: [% license %]
+Copyright: [% copyright %]
+
Source bundles
--------------
diff --git a/Bluto/Archive.pm b/Bluto/Archive.pm
@@ -6,6 +6,7 @@ use Digest::SHA;
use Log::Term::Ansi qw/error info debug warn trace/;
use Bluto::Tree qw/release_path/;
+use File::Path qw / make_path /;
sub seal {
@@ -56,7 +57,7 @@ sub create {
my $old_dir = cwd;
- chdir($env->{src_dir});
+ chdir($env->{content_dir});
my $targz_local = undef;
my $targz_stem = $release->{slug} . '-' . $release->{version};
@@ -69,7 +70,9 @@ sub create {
}
chomp($rev);
my $targz = $targz_stem . '+build.' . $rev . '.tar.gz';
- $targz_local = File::Spec->catfile(Bluto::Tree->release_path, $targz);
+ my $targz_base = File::Spec->catfile(Bluto::Tree->release_path, $release->{slug});
+ make_path($targz_base);
+ $targz_local = File::Spec->catfile($targz_base, $targz);
if (! -f $targz_local ) {
debug("no package file found, looked for: " . $targz_local);
diff --git a/Bluto/Tree.pm b/Bluto/Tree.pm
@@ -2,7 +2,7 @@ package Bluto::Tree;
use File::Spec;
-use File::Path qw/ make_path /;
+use File::Path qw / make_path /;
our $_release_path;
our $_announce_path;
@@ -18,10 +18,10 @@ sub prepare {
my $release = shift;
my $env = shift;
- $_release_path = File::Spec->catfile($env->{out_dir}, $release->{slug}, 'release');
- File::Path->make_path(release_path);
+ $_release_path = File::Spec->catfile($env->{out_dir}, $release->{slug}, 'src');
+ make_path(release_path);
$_announce_path = File::Spec->catfile($env->{out_dir}, $release->{slug}, 'announce');
- File::Path->make_path(announce_path);
+ make_path(announce_path);
return 0;
}
diff --git a/base.tt b/base.tt
@@ -1,33 +0,0 @@
-Release announcement: [% name %]
-===
-
-Version release: [% version %]
-
-License: [% license %]
-
-Source bundles
---------------
-
-[% FOREACH v IN src %]* [% v %]
-[% END %]
-
-VCS
----
-
-[% FOREACH v IN vcs %]* [% v %]
-[% END %]
-
-ONLINE RESOURCES
-----------------
-
-[% FOREACH v IN url %]* [% v %]
-[% END %]
-
-CHANGELOG
----------
-
-[% changelog %]
-
------
-
-Generated by [% engine %] at [% time %]Z
diff --git a/to_std.pl b/to_std.pl
@@ -9,7 +9,6 @@ use Getopt::Long qw/ :config auto_help /;
#use File::Temp qw/ tempdir /;
use File::Basename qw/ dirname /;
use File::Spec;
-use File::Path qw/ make_path /;
use Cwd qw/ getcwd abs_path /;
use lib (dirname(abs_path($0)));