diff options
author | wiz <wiz@pkgsrc.org> | 2000-12-15 14:58:43 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2000-12-15 14:58:43 +0000 |
commit | d839a9eba515fb013d3f152f9628290b6ceeaed9 (patch) | |
tree | 80b029d2a4626b36978e46b7654aa357e2fdb044 /pkgtools | |
parent | 04e105e609db72af90462392d8ef24c921f10f7e (diff) | |
download | pkgsrc-d839a9eba515fb013d3f152f9628290b6ceeaed9.tar.gz |
Make port2pkg handle the new FreeBSD ports structure. Bump version to 1.6.
Addresses pkg/11683.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/port2pkg/Makefile | 4 | ||||
-rwxr-xr-x | pkgtools/port2pkg/files/port2pkg.pl | 69 |
2 files changed, 53 insertions, 20 deletions
diff --git a/pkgtools/port2pkg/Makefile b/pkgtools/port2pkg/Makefile index 180d5172652..e3f3035897d 100644 --- a/pkgtools/port2pkg/Makefile +++ b/pkgtools/port2pkg/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.7 2000/07/27 16:29:05 hubertf Exp $ +# $NetBSD: Makefile,v 1.8 2000/12/15 14:58:43 wiz Exp $ # -DISTNAME= port2pkg-1.5 +DISTNAME= port2pkg-1.6 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/port2pkg/files/port2pkg.pl b/pkgtools/port2pkg/files/port2pkg.pl index 3ae75c1f8ea..520aa248280 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.5 2000/05/12 10:07:36 sakamoto Exp $ +# $NetBSD: port2pkg.pl,v 1.6 2000/12/15 14:58:44 wiz Exp $ # require 'getopts.pl'; @@ -31,6 +31,7 @@ if (! -d "$pkgdir") { system("${GTAR} cCf $portsdir - .|${GTAR} xCf $pkgdir -"); +&fix_new_ports(); &read_Makefile(); &conv_Makefile(); &conv_PLIST(); @@ -44,6 +45,33 @@ sub usage_and_exit { exit; } +sub fix_new_ports { + my (@allfiles); + my ($fn, $dn); + if (!opendir(PKGDIR, "$pkgdir/pkg")) { + mkdir("$pkgdir/pkg", 0777) || + warn("can't mkdir $pkgdir/pkg: $!"); + rename("$pkgdir/pkg-comment", "$pkgdir/pkg/COMMENT") || + warn("can't copy $pkgdir/pkg-comment to ". + "$pkgdir/pkg/COMMENT"); + rename("$pkgdir/pkg-descr", "$pkgdir/pkg/DESCR") || + warn("can't copy $pkgdir/pkg-descr to ". + "$pkgdir/pkg/DESCR"); + foreach $fn (<$pkgdir/pkg-plist*>) { + $dn = $fn; + $dn =~ s|.*pkg-plist|PLIST|; + rename("$fn", "$pkgdir/pkg/$dn") || + warn("can't copy $fn to $pkgdir/pkg/$dn"); + } + } + else { + closedir(PKGDIR); + } + unlink <$pkgdir/files/patch*>; + unlink("$pkgdir/distinfo"); + mkdir("$pkgdir/patches"); +} + sub read_Makefile { open(PORTS, "$portsdir/Makefile") || die "$portsdir/Makefile: $!\n"; @@ -243,45 +271,47 @@ sub add_manual { sub conv_PLIST { my ($file, $plist); - return 0 if (opendir(PKGDIR, "$portsdir/pkg") == 0); + return 0 if (!opendir(PKGDIR, "$pkgdir/pkg")); while ($plist = readdir(PKGDIR)) { next if (!($plist =~ /^PLIST/)); - open(PORTS, "$portsdir/pkg/$plist") - || die "$portsdir/pkg/$plist: $!\n"; - open(PKG, ">$pkgdir/pkg/$plist") - || die "$pkgdir/pkg/$plist: $!\n"; + open(OLDPLIST, "$pkgdir/pkg/$plist") + || die "$pkgdir/pkg/$plist: $!\n"; + open(NEWPLIST, ">$pkgdir/pkg/new.$plist") + || die "$pkgdir/pkg/new.$plist: $!\n"; - print PKG "\@comment \$NetBSD\$\n"; + print NEWPLIST "\@comment \$NetBSD\$\n"; my ($cat_added, $man_added); - while (<PORTS>) { + while (<OLDPLIST>) { s|\%\%([^\%]+)\%\%|\${$1}|g; next if (/^\@.*ldconfig/); if (defined($cat_added) && $cat_added == 0 && /^[d-z]/){ - &add_manual(*PKG, "cat"); + &add_manual(*NEWPLIST, "cat"); $cat_added++; } if (defined($man_added) && $man_added == 0 && /^[n-z]/){ - &add_manual(*PKG, "man"); + &add_manual(*NEWPLIST, "man"); $man_added++; } - print PKG $_; + print NEWPLIST $_; } if (defined($cat_added) && $cat_added == 0) - {&add_manual(*PKG, "cat");} + {&add_manual(*NEWPLIST, "cat");} if (defined($man_added) && $man_added == 0) - {&add_manual(*PKG, "man");} + {&add_manual(*NEWPLIST, "man");} - close(PKG); - close(PORTS); + close(NEWPLIST); + close(OLDPLIST); + rename("$pkgdir/pkg/new.$plist", "$pkgdir/pkg/$plist"); } closedir(PKGDIR); } sub add_NetBSD_ID { my ($patch); - if (open(MD5, "$portsdir/files/md5")) { + if (open(MD5, "$portsdir/files/md5") + || open(MD5, "$portsdir/distinfo")) { open(NMD5, ">$pkgdir/files/md5") || die "$pkgdir/files/md5: $!\n"; print NMD5 "\$NetBSD\$\n\n"; @@ -292,11 +322,14 @@ sub add_NetBSD_ID { close(MD5); } - return 0 if (opendir(PATCHDIR, "$portsdir/patches") == 0); + opendir(PATCHDIR, "$portsdir/patches") || + opendir(PATCHDIR, "$portsdir/files") || + return 0; while ($patch = readdir(PATCHDIR)) { if ($patch eq "\." || $patch eq "\.." || $patch eq "CVS") {next;} - if (open(PATCH, "$portsdir/patches/$patch")) { + if (open(PATCH, "$portsdir/patches/$patch") + || open(PATCH, "$portsdir/files/$patch")) { open(NPATCH, ">$pkgdir/patches/$patch") || die "$pkgdir/patches/$patch: $!\n"; print NPATCH "\$NetBSD\$\n\n"; |