diff options
author | sakamoto <sakamoto@pkgsrc.org> | 2000-04-26 16:18:58 +0000 |
---|---|---|
committer | sakamoto <sakamoto@pkgsrc.org> | 2000-04-26 16:18:58 +0000 |
commit | b804cbd46a13f4aecc985b27aefa7d71d6edb42b (patch) | |
tree | 63ef7551b4a438d6d3b563c3df16a994d6ebeeba /pkgtools | |
parent | 8ec6999a53641a833820886cb88a0b955415d506 (diff) | |
download | pkgsrc-b804cbd46a13f4aecc985b27aefa7d71d6edb42b.tar.gz |
Update port2pkg to 1.4
Changes:
Support PORTNAME/PORTVERSION variables.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/port2pkg/Makefile | 10 | ||||
-rwxr-xr-x | pkgtools/port2pkg/files/port2pkg.pl | 51 |
2 files changed, 40 insertions, 21 deletions
diff --git a/pkgtools/port2pkg/Makefile b/pkgtools/port2pkg/Makefile index 31266e0099e..575200d5e6d 100644 --- a/pkgtools/port2pkg/Makefile +++ b/pkgtools/port2pkg/Makefile @@ -1,14 +1,14 @@ -# $NetBSD: Makefile,v 1.4 1999/11/24 10:36:53 agc Exp $ +# $NetBSD: Makefile,v 1.5 2000/04/26 16:18:58 sakamoto Exp $ # -DISTNAME= port2pkg-1.2 +DISTNAME= port2pkg-1.4 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty MAINTAINER= sakamoto@netbsd.org -DEPENDS+= pkglint-*:../../pkgtools/pkglint +RUN_DEPENDS+= pkglint:../../pkgtools/pkglint USE_PERL5= YES @@ -28,9 +28,11 @@ NROFF= nroff do-build: ${NROFF} -mandoc ${FILESDIR}/port2pkg.1 >${WRKSRC}/port2pkg.0 + ${SED} -e 's|$${GTAR}|${GTAR}|g' ${FILESDIR}/port2pkg.pl \ + > ${WRKSRC}/port2pkg do-install: - ${INSTALL_SCRIPT} ${FILESDIR}/port2pkg.pl ${PREFIX}/bin/port2pkg + ${INSTALL_SCRIPT} ${WRKSRC}/port2pkg ${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/port2pkg.0 ${PREFIX}/man/cat1 ${INSTALL_MAN} ${FILESDIR}/port2pkg.1 ${PREFIX}/man/man1 diff --git a/pkgtools/port2pkg/files/port2pkg.pl b/pkgtools/port2pkg/files/port2pkg.pl index f6716888f0b..d2461d8172d 100755 --- a/pkgtools/port2pkg/files/port2pkg.pl +++ b/pkgtools/port2pkg/files/port2pkg.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# $NetBSD: port2pkg.pl,v 1.3 1999/09/14 00:43:20 sakamoto Exp $ +# $NetBSD: port2pkg.pl,v 1.4 2000/04/26 16:18:59 sakamoto Exp $ # require 'getopts.pl'; @@ -8,8 +8,9 @@ $^W=1; use strict; use vars qw($opt_m); my($maintainer) = "packages\@netbsd.org"; -my($makefile,$master_site_subdir,$extract_cmd); +my($makefile, $master_site_subdir, $extract_cmd); my($portsdir, $pkgdir); +my($namespace, $portname, $portversion, $distname, $pkgname); my(@man, @cat); if (! &Getopts('m:')) {&usage_and_exit();} @@ -27,7 +28,7 @@ if (! -d "$pkgdir") { } } -system("tar cCf $portsdir - .|tar xCf $pkgdir -"); +system("${GTAR} cCf $portsdir - .|${GTAR} xCf $pkgdir -"); &read_Makefile(); &conv_Makefile(); @@ -57,7 +58,14 @@ sub read_Makefile { my ($extract_before_args, $extract_after_args); foreach my $line (split(/\n/, $makefile)) { $_ = $line; - if (/^MASTER_SITE_SUBDIR\?*=\s*(.*)/) { + if (/^PORTNAME\?*=(\s*)(.*)/) { + $namespace = $1; + $portname = $2; + } elsif (/^PORTVERSION\?*=\s*(.*)/) { + $portversion = $1; + } elsif (/^DISTNAME\?*=\s*(.*)/) { + $distname = $1; + } elsif (/^MASTER_SITE_SUBDIR\?*=\s*(.*)/) { $master_site_subdir = $1; if (!($master_site_subdir =~ /\/$/)) { $master_site_subdir .= "/"; @@ -85,6 +93,17 @@ sub read_Makefile { $extract_cmd = "$extract_cmd$extract_before_args" . " \${DOWNLOADED_DISTFILE}$extract_after_args"; } + + if (defined($distname)) { + $distname =~ s/\${PORTNAME}/$portname/; + $distname =~ s/\${PORTVERSION}/$portversion/; + + if ($distname ne "$portname-$portversion") { + $pkgname = "$portname-$portversion"; + } + } else { + $distname = "$portname-$portversion"; + } } sub conv_Makefile { @@ -112,9 +131,7 @@ sub conv_Makefile { while (<PORTS>) { if (/\\$/) { $nextline++; - if ($remove) { - next; - } + next if ($remove); } else { $nextline = 0; if ($remove) { @@ -150,24 +167,24 @@ sub conv_Makefile { print "WARN: found \"$1\"\n"; } - if (/^MAN(.)\?*=/ || + if (/^PORTVERSION/ || + /^DISTNAME/ || + /^MAN(.)\?*=/ || /^CAT(.)\?*=/ || /^MASTER_SITE_SUBDIR/ || /^EXTRACT_BEFORE_ARGS/ || /^EXTRACT_AFTER_ARGS/) { - if ($nextline) { - $remove = 1; - } + $remove if ($nextline); + } elsif (/^PORTNAME/) { + print PKG "DISTNAME=$namespace$distname\n"; + print PKG "PKGNAME=$namespace$pkgname\n" if defined($pkgname); + $remove if ($nextline); } elsif (/^(EXTRACT_CMD\?*=)/) { print PKG "$1\t$extract_cmd\n"; - if ($nextline) { - $remove = 1; - } + $remove if ($nextline); } elsif (/^(MAINTAINER\?*=)/) { print PKG "$1\t$maintainer\n"; - if ($nextline) { - $remove = 1; - } + $remove if ($nextline); open(DESCR, "$pkgdir/pkg/DESCR") || die "$pkgdir/pkg/DESCR: $!\n"; |