mirror of
https://git.proxmox.com/git/proxmox-perl-rs
synced 2025-05-23 21:40:23 +00:00
buildsys: add genpackage.pl script
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
ba8dad1190
commit
3d447c9762
32
scripts/genpackage.pl
Executable file
32
scripts/genpackage.pl
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
# Create a perl package given a product and package name.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use File::Path qw(make_path);
|
||||||
|
|
||||||
|
my $product = shift @ARGV or die "missing product name (PVE, PMG or Common)\n";
|
||||||
|
|
||||||
|
die "missing package name\n" if !@ARGV;
|
||||||
|
|
||||||
|
for my $package (@ARGV) {
|
||||||
|
my $path = ($package =~ s@::@/@gr) . ".pm";
|
||||||
|
|
||||||
|
print "Generating $path\n";
|
||||||
|
|
||||||
|
$path =~ m@^(.*)/[^/]+@;
|
||||||
|
make_path($1, { mode => 0755 });
|
||||||
|
|
||||||
|
open(my $fh, '>', $path) or die "failed to open '$path' for writing: $!\n";
|
||||||
|
|
||||||
|
print {$fh} <<"EOF";
|
||||||
|
package $package;
|
||||||
|
use base 'Proxmox::Lib::$product';
|
||||||
|
BEGIN { __PACKAGE__->bootstrap(); }
|
||||||
|
1;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
close($fh);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user