From 7de93c19750477eed3555e5a8a93b03b01b79997 Mon Sep 17 00:00:00 2001 From: tsg Date: Mon, 18 Jan 2016 19:01:02 +0000 Subject: [PATCH] Import portgen. OK many --- infrastructure/bin/portgen | 52 ++++++++++++++++++ infrastructure/man/man1/portgen.1 | 91 +++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100755 infrastructure/bin/portgen create mode 100644 infrastructure/man/man1/portgen.1 diff --git a/infrastructure/bin/portgen b/infrastructure/bin/portgen new file mode 100755 index 00000000000..ad5ab17f3cf --- /dev/null +++ b/infrastructure/bin/portgen @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +# $OpenBSD: portgen,v 1.1 2016/01/18 19:01:02 tsg Exp $ +# +# Copyright (c) 2015 Giannis Tsaraias +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +use 5.012; +use warnings; + +my ($portdir); + +use FindBin; + +BEGIN { + $portdir = $ENV{PORTSDIR} || '/usr/ports'; +} + +use lib ( "$portdir/infrastructure/lib", "$FindBin::Bin/../lib" ); + +use OpenBSD::PortGen::Port::CPAN; +use OpenBSD::PortGen::Port::PyPI; +use OpenBSD::PortGen::Port::Ruby; + +my ( $type, $module ) = @ARGV; + +die "usage: portgen type module\n" unless $type and $module; + +my $o; +if ( $type eq 'p5' ) { + $o = OpenBSD::PortGen::Port::CPAN->new(); +} elsif ( $type eq 'py' ) { + $o = OpenBSD::PortGen::Port::PyPI->new(); +} elsif ( $type eq 'ruby' ) { + $o = OpenBSD::PortGen::Port::Ruby->new(); +} else { + die "unknown module type\n"; +} + +my @new_ports = $o->port($module); +say for @new_ports; diff --git a/infrastructure/man/man1/portgen.1 b/infrastructure/man/man1/portgen.1 new file mode 100644 index 00000000000..0bfb92139a2 --- /dev/null +++ b/infrastructure/man/man1/portgen.1 @@ -0,0 +1,91 @@ +.\" $OpenBSD: portgen.1,v 1.1 2016/01/18 19:01:02 tsg Exp $ +.\" +.\" Copyright (c) 2015 Giannis Tsaraias +.\" Copyright (c) 2015 Vadim Zhukov +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: January 18 2016 $ +.Dt PORTGEN 1 +.Os +.Sh NAME +.Nm portgen +.Nd port modules on the fly +.Sh SYNOPSIS +.Nm portgen +.Ar type +.Ar module-name +.Sh DESCRIPTION +The +.Nm +utility creates ports for the given +.Ar module-name +from +.Ar type +module framework. +The module is downloaded, analyzed and translated into a port. +Any missing dependencies are handled recursively. +New ports will land under ${PORTSDIR}/mystuff. +The +.Ev PORTSDIR +value will be taken from current user environment, and defaults to +.Pa /usr/ports . +.Pp +The +.Nm +utility currently supports the following +.Ar type +values: +.Pp +.Bl -inset -offset indent -compact +.It Cm p5 +for Perl modules on CPAN. +.It Cm ruby +for Ruby gems. +.El +.Pp +The following packages must be installed prior to the invocation of +.Nm : +.Pp +.Bl -item -offset indent -compact +.It +.Cm sqlports-compact +or +.Cm sqlports +.It +.Cm p5-DBI +.It +.Cm p5-DBD-SQLite +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +The following command will download the latest version of Config::AutoConf +from CPAN, parse it and create a port for it: +.Bd -ragged -offset indent +.Nm +p5 Config::AutoConf +.Ed +.Sh SEE ALSO +.Xr port-modules 5 , +.Xr ports 7 +.Sh HISTORY +The +.Nm +utility first appeared in +.Ox 5.9 +as a result of Google Summer of Code 2015. +.Sh AUTHORS +.An Giannis Tsaraias Aq Mt tsg@openbsd.org +.Sh CAVEATS +Not every module could be converted to a port.