Gentoo Archives: gentoo-commits

From: Kent Fredric <kentfredric@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/perl-overlay:master commit in: scripts/
Date: Mon, 31 Oct 2011 02:48:35
Message-Id: b5d9da14ba9824a678d75a36018e52fca726403c.kent@gentoo
1 commit: b5d9da14ba9824a678d75a36018e52fca726403c
2 Author: Kent Fredric <kentfredric <AT> gmail <DOT> com>
3 AuthorDate: Tue Oct 25 13:40:46 2011 +0000
4 Commit: Kent Fredric <kentfredric <AT> gmail <DOT> com>
5 CommitDate: Mon Oct 31 02:45:46 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git;a=commit;h=b5d9da14
7
8 interesting reverse lookup stuff
9
10 ---
11 scripts/gen_ebuild.pl | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
12 1 files changed, 70 insertions(+), 0 deletions(-)
13
14 diff --git a/scripts/gen_ebuild.pl b/scripts/gen_ebuild.pl
15 new file mode 100644
16 index 0000000..0d0fa06
17 --- /dev/null
18 +++ b/scripts/gen_ebuild.pl
19 @@ -0,0 +1,70 @@
20 +#!/usr/bin/env perl
21 +
22 +eval 'echo "Called with something not perl"' && exit 1 # Non-Perl protection.
23 + if 0;
24 +
25 +use 5.14.2;
26 +use strict;
27 +use warnings;
28 +use FindBin;
29 +use lib "$FindBin::Bin/lib";
30 +use env::gentoo::perl_experimental;
31 +use metacpan qw( mcpan );
32 +
33 +my $flags;
34 +my $singleflags;
35 +
36 +@ARGV = grep { defined } map {
37 + $_ =~ /^--(\w+)/
38 + ? do { $flags->{$1}++; undef }
39 + : do {
40 + $_ =~ /^-(\w+)/
41 + ? do { $singleflags->{$1}++; undef }
42 + : do { $_ }
43 + }
44 +} @ARGV;
45 +
46 +if ( $flags->{help} or $singleflags->{h} ) { print help(); exit 0; }
47 +
48 +# FILENAME: gen_ebuild.pl
49 +# CREATED: 25/10/11 12:15:51 by Kent Fredric (kentnl) <kentfredric@×××××.com>
50 +# ABSTRACT: An attempt at generating ebuilds entirely from MetaCPAN data
51 +
52 +# usage:
53 +#
54 +# gen_ebuild.pl DOY/Moose-2.0301-TRIAL
55 +# emits Moose/Moose-2.30.100_rc.ebuild
56 +my ($release) = shift(@ARGV);
57 +
58 +my $result = [ map { $_->{as_string} } metacpan->find_dist_simple( $release , {notrim=>1}) ];
59 +
60 +use Data::Dump qw( pp );
61 +use JSON qw( to_json );
62 +say to_json($result , { pretty => 1 } );
63 +1;
64 +
65 +sub pkg_for_module {
66 + my ($module) = shift;
67 +
68 +}
69 +
70 +sub gen_dep {
71 + state $template = qq{\t# %s%s\n\techo %s\n};
72 + my ( $module, $version ) = @_;
73 +
74 +}
75 +
76 +sub help {
77 + return <<'EOF';
78 +gen_ebuild.pl
79 +
80 +USAGE:
81 +
82 + gen_ebuild.pl DOY/Moose-2.0301-TRIAL
83 +
84 + edit ./Moose-2.30.100_rc.ebuild
85 +
86 + done!
87 +
88 +EOF
89 +}