portgen 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/perl
  2. # $OpenBSD: portgen,v 1.1 2016/01/18 19:01:02 tsg Exp $
  3. #
  4. # Copyright (c) 2015 Giannis Tsaraias <tsg@openbsd.org>
  5. #
  6. # Permission to use, copy, modify, and distribute this software for any
  7. # purpose with or without fee is hereby granted, provided that the above
  8. # copyright notice and this permission notice appear in all copies.
  9. #
  10. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. use 5.012;
  18. use warnings;
  19. my ($portdir);
  20. use FindBin;
  21. BEGIN {
  22. $portdir = $ENV{PORTSDIR} || '/usr/ports';
  23. }
  24. use lib ( "$portdir/infrastructure/lib", "$FindBin::Bin/../lib" );
  25. use OpenBSD::PortGen::Port::CPAN;
  26. use OpenBSD::PortGen::Port::PyPI;
  27. use OpenBSD::PortGen::Port::Ruby;
  28. my ( $type, $module ) = @ARGV;
  29. die "usage: portgen type module\n" unless $type and $module;
  30. my $o;
  31. if ( $type eq 'p5' ) {
  32. $o = OpenBSD::PortGen::Port::CPAN->new();
  33. } elsif ( $type eq 'py' ) {
  34. $o = OpenBSD::PortGen::Port::PyPI->new();
  35. } elsif ( $type eq 'ruby' ) {
  36. $o = OpenBSD::PortGen::Port::Ruby->new();
  37. } else {
  38. die "unknown module type\n";
  39. }
  40. my @new_ports = $o->port($module);
  41. say for @new_ports;