bluto

Release package and announcement generator
Info | Log | Files | Refs | README | LICENSE

commit a67e5b899453b4e86399e4ccf96ec6b449d726c9
Author: nolash <dev@holbrook.no>
Date:   Sun,  7 Nov 2021 20:26:39 +0100

Initial commit

Diffstat:
ALICENSE | 14++++++++++++++
Asetup.deb.env | 12++++++++++++
Asetup.env | 19+++++++++++++++++++
Ato_debian.pl | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ato_python.pl | 48++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 162 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/setup.deb.env b/setup.deb.env @@ -0,0 +1,12 @@ +[main:deb] +standards_version=3.8.5 +priority=optional + +[dep:deb-build] +debhelper=>=9 + +[dep:deb-install] +dpkg=0 + +[dep:deb-exec] +make=0 diff --git a/setup.env b/setup.env @@ -0,0 +1,19 @@ +[main] +name= +version= +summary= + +[tech] +name= + +[author:nick] +name= +email= +pgp= +url= + +[locate:git] +gitlab= + +[license] +WTFPL=2 diff --git a/to_debian.pl b/to_debian.pl @@ -0,0 +1,69 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Config::Simple; +use Getopt::Long qw/:config auto_help/; + +my $deb_standards_version = '3.9.5'; +my $deb_priority = 'optional'; +my $deb_arch = 'any'; + +GetOptions( + 'standards-version:s' => \$deb_standards_version, + 'priority:s' => \$deb_priority, + 'arch:s' => \$deb_arch, +); + + +Config::Simple->import_from('setup.env', \my %config); +Config::Simple->import_from('setup.deb.env', \my %config_deb); + + +our $first_author; + +for my $k (keys %config) { + my @p = split(/:/, $k); + print "processing key " . $k . " " . $p[0] . "\n"; + if ($p[0] eq 'author' && ! defined $first_author) { + my @n = split(/\./, $p[1]); + my $name = $config{'author:' . $n[0] . '.name'}; + $first_author = $name; + my $email = $config{'author:' . $n[0] . '.email'}; + if (defined $email) { + $first_author .= ' <' . $email . '>'; + } + } +} + +my %deb_depends = ( + 'exec' => [], + 'build' => [], + 'install' => [], +); +for my $k (keys %config_deb) { + my @p = split(/\./, $k, 2); + if (substr($p[0], 0, 7) eq 'dep:deb') { + my @m = split(/-/, $p[0]); + my $dep = $p[1]; + if ($config_deb{$k} ne '0') { + $dep .= ' (' . $config_deb{$k}. ')'; + } + push(@{$deb_depends{$m[1]}}, $dep); + } +} + + +print "Source: " . $config{'main.name'} . "\n"; +print "Section: " . $config{'tech.name'} . "\n"; +print "Priority: " . $deb_priority . "\n"; +print "Maintainer: " . $first_author . "\n"; +print "Standards-Version: " . $deb_standards_version . "\n"; +print "Build-Depends: " . join(', ', @{$deb_depends{'build'}}) . "\n"; +print "\n"; +print "Package: " . $config{'main.name'} . "\n"; +print "Architecture: " . $deb_arch . "\n"; +print "Pre-Depends: " . join(', ', @{$deb_depends{'install'}}) . "\n"; +print "Depends: " . join(', ', @{$deb_depends{'exec'}}) . "\n"; +print "Description: " . $config{'main.summary'} . "\n"; diff --git a/to_python.pl b/to_python.pl @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Config::Simple; +use Getopt::Long qw/ :config auto_help /; +use File::Temp qw/ tempdir /; +use File::Spec qw/ catfile /; + +Config::Simple->import_from('setup.env', \my %config); + +my $d = tempdir( CLEANUP => 1 ); +my $fn = File::Spec->catfile($d, 'config_py.ini'); +my $fh; +open($fh, '>', $fn); +print $fh "[metadata]\n"; +close($fh); + +our %first_author = ( + name => undef, + email => undef, +); +our $first_url; +for my $k (keys %config) { + my @p = split(/:/, $k); + if ($p[0] eq 'author' && ! defined $first_author{'name'}) { + my @n = split(/\./, $p[1]); + my $name = $config{'author:' . $n[0] . '.name'}; + $first_author{'name'} = $name; + my $email = $config{'author:' . $n[0] . '.email'}; + if (defined $email) { + $first_author{'email'} = $email; + } + } elsif ($p[0] eq 'locate' && ! defined $first_url) { + $first_url = $config{$k}; + } +} + +my $py_cfg = new Config::Simple($fn); +$py_cfg->param('metadata.author_email', $first_author{email}); +$py_cfg->param('metadata.author', $first_author{name}); +$py_cfg->param('metadata.description', $config{'main.summary'}); +$py_cfg->param('metadata.url', $first_url); +$py_cfg->param('metadata.version', $config{'main.version'}); +$py_cfg->param('metadata.name', $config{'main.name'}); + +print $py_cfg->as_string()