1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
#!/bin/bash # makemodule.sh, GNU GPL 3. # We need # Name.pm (The Perl-Module, full name is "Your::Module::Name") # README # examples (dir) # in this directory. After the process, there should # be a .tar.gz in this directory. # Use "makemodule.sh clean" to clean up. VERSION="1.00" # Version of Module modulename="Your::Module::Name" authorname="Max Mustermann" authoremail="Max Mustermann@...de" checkForFile () { if [ ! -e "$1" ]; then echo echo "File or directory '$1' not found in this directory. Aborting." echo exit fi } basedir=$(pwd) tarname="Your-Module-Name-$VERSION.tar.gz" versiondirname="Your-Module-Name-$VERSION" exampledir="$basedir/Your-Module-Name" libdir="$exampledir/lib/Your/Module" versiondir="$basedir/$versiondirname" tarfile="$basedir/$tarname" cleanUp () { if [ -d "$exampledir" ]; then # rm -r "$exampledir" fi if [ -d "$versiondir" ]; then # rm -r "$versiondir" fi if [ -e "$tarfile" ]; then # rm "$tarfile" fi } if [ "$1" = "clean" ]; then cleanUp exit fi checkForFile "Name.pm" checkForFile "README" checkForFile "examples" cleanUp module-starter --module="$modulename" --author="$authorname" --email="$authoremail" cp -v Name.pm "$libdir" cp -rv examples "$exampledir" cp -v README "$exampledir" mv "$exampledir" "$versiondir" tar -czvf "$tarname" "$versiondirname"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
#!/usr/bin/perl use warnings; use strict; #################################################### # makemodule.pl, (C) 2017. GNU GPL 3. # # After the process, there should # be a .tar.gz in this directory. # # Use "makemodule.pl clean" to clean up. #################################################### use Cwd; my $version="1.00"; my $modulename = "Your::Module::Name"; my $authorname = "Max Mustermann"; my $authoremail = "Max Mustermann@...de"; my %required = ("Name.pm" => "libdir", "README" => "exampledir", "examples" => "exampledir"); sub getDestination { my $deststr = shift; my $libdir = shift; my $exampledir = shift; if ($deststr eq "libdir") { return $libdir; } if ($deststr eq "exampledir") { return $exampledir; } } sub cleanUp { my $exampledir = shift; my $versiondir = shift; my $tarfile = shift; if (-d $exampledir ) { # system("rm -r $exampledir"); } if (-d $versiondir ) { # system("rm -r $versiondir"); } if (-e $tarfile) { # system("rm $tarfile"); } } sub checkForExistence { my $fname = shift; if (! -e $fname) { print "\nFile or directory '$fname' not found in this directory. Aborting.\n\n"; exit; } } my $basedir = getcwd(); my $i; my @modulenameparts = split(/\:\:/, $modulename); my $temp = join("-", @modulenameparts); my $exampledir = "$basedir/$temp"; my $tarname .= "$temp-$version.tar.gz"; my $versiondirname="$temp-$version"; my $libdir="$exampledir/lib/"; for $i (0 .. $#modulenameparts - 1) { $libdir .= $modulenameparts[$i]; $libdir .= "/"; } my $versiondir="$basedir/$versiondirname"; my $tarfile="$basedir/$tarname"; my $execstr; for $i (keys(%required)) { $required{$i} = getDestination($required{$i}, $libdir, $exampledir); } if ($#ARGV >= 0 && $ARGV[0] eq "clean") { cleanUp($exampledir, $versiondir, $tarfile); exit; } for $i (keys(%required)) { checkForExistence($i); } cleanUp($exampledir, $versiondir, $tarfile); $execstr = "module-starter --module=\""; $execstr .= "$modulename\" --author=\"$authorname\" --email=\"$authoremail\""; system($execstr); for $i (keys(%required)) { $execstr = "cp -rv "; $execstr .= "$basedir/$i "; $execstr .= "\"$required{$i}\""; system($execstr); } system("mv \"$exampledir\" \"$versiondir\""); system("tar -czvf \"$tarname\" \"$versiondirname\"");
Quotejedesmal, wenn ich nach Monaten oder Jahren mein CPAN-Modul (bisher eins) updaten will, muß ich mir nochmal klarmachen, wie man aus seiner .pm-Datei (und dem README und den Beispieldateien) ein CPAN-taugliches .tar.gz macht.
2017-04-15T16:47:57 rostiMachs doch einfach mit h2xs, das nimmt Dir die ganze Arbeit ab.
2017-04-15T20:17:58 hlubenow2017-04-15T16:47:57 rostiMachs doch einfach mit h2xs, das nimmt Dir die ganze Arbeit ab.
Ist das nicht für Perl-Module in C?