| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #!/usr/bin/env perl | | 1 | #!/usr/bin/env perl |
2 | # | | 2 | # |
3 | # $NetBSD: port2pkg.pl,v 1.19 2007/07/10 15:27:57 joerg Exp $ | | 3 | # $NetBSD: port2pkg.pl,v 1.20 2012/01/02 12:15:48 joerg Exp $ |
4 | # | | 4 | # |
5 | | | 5 | |
6 | require 'getopts.pl'; | | 6 | require 'getopts.pl'; |
7 | $^W=1; | | 7 | $^W=1; |
8 | use strict; | | 8 | use strict; |
9 | use vars qw($opt_m); | | 9 | use vars qw($opt_m); |
10 | my($maintainer) = "pkgsrc-users\@NetBSD.org"; | | 10 | my($maintainer) = "pkgsrc-users\@NetBSD.org"; |
11 | my($makefile, $master_site_subdir, $extract_cmd); | | 11 | my($makefile, $master_site_subdir, $extract_cmd); |
12 | my($portsdir, $pkgdir); | | 12 | my($portsdir, $pkgdir); |
13 | my($namespace, $portname, $portversion, $distname, | | 13 | my($namespace, $portname, $portversion, $distname, |
14 | $pkgname, $pkgnameprefix, $pkgnamesuffix); | | 14 | $pkgname, $pkgnameprefix, $pkgnamesuffix); |
15 | my(@man, @cat); | | 15 | my(@man, @cat); |
16 | | | 16 | |
| @@ -279,27 +279,27 @@ sub add_manual { | | | @@ -279,27 +279,27 @@ sub add_manual { |
279 | } | | 279 | } |
280 | | | 280 | |
281 | sub conv_PLIST { | | 281 | sub conv_PLIST { |
282 | my ($file, $plist); | | 282 | my ($file, $plist); |
283 | return 0 if (!opendir(PKGDIR, "$pkgdir")); | | 283 | return 0 if (!opendir(PKGDIR, "$pkgdir")); |
284 | while ($plist = readdir(PKGDIR)) { | | 284 | while ($plist = readdir(PKGDIR)) { |
285 | next if (!($plist =~ /^PLIST/)); | | 285 | next if (!($plist =~ /^PLIST/)); |
286 | | | 286 | |
287 | open(OLDPLIST, "$pkgdir/$plist") | | 287 | open(OLDPLIST, "$pkgdir/$plist") |
288 | || die "$pkgdir/$plist: $!\n"; | | 288 | || die "$pkgdir/$plist: $!\n"; |
289 | open(NEWPLIST, ">$pkgdir/new.$plist") | | 289 | open(NEWPLIST, ">$pkgdir/new.$plist") |
290 | || die "$pkgdir/new.$plist: $!\n"; | | 290 | || die "$pkgdir/new.$plist: $!\n"; |
291 | | | 291 | |
292 | print NEWPLIST "\@comment \$NetBSD\$\n"; | | 292 | print NEWPLIST "\@comment \$"."NetBSD\$\n"; |
293 | my ($cat_added, $man_added); | | 293 | my ($cat_added, $man_added); |
294 | while (<OLDPLIST>) { | | 294 | while (<OLDPLIST>) { |
295 | s|\%\%([^\%]+)\%\%|\${$1}|g; | | 295 | s|\%\%([^\%]+)\%\%|\${$1}|g; |
296 | next if (/^\@.*ldconfig/); | | 296 | next if (/^\@.*ldconfig/); |
297 | if (defined($cat_added) && $cat_added == 0 && /^[d-z]/){ | | 297 | if (defined($cat_added) && $cat_added == 0 && /^[d-z]/){ |
298 | &add_manual(*NEWPLIST, "cat"); | | 298 | &add_manual(*NEWPLIST, "cat"); |
299 | $cat_added++; | | 299 | $cat_added++; |
300 | } | | 300 | } |
301 | if (defined($man_added) && $man_added == 0 && /^[n-z]/){ | | 301 | if (defined($man_added) && $man_added == 0 && /^[n-z]/){ |
302 | &add_manual(*NEWPLIST, "man"); | | 302 | &add_manual(*NEWPLIST, "man"); |
303 | $man_added++; | | 303 | $man_added++; |
304 | } | | 304 | } |
305 | | | 305 | |
| @@ -313,45 +313,45 @@ sub conv_PLIST { | | | @@ -313,45 +313,45 @@ sub conv_PLIST { |
313 | close(NEWPLIST); | | 313 | close(NEWPLIST); |
314 | close(OLDPLIST); | | 314 | close(OLDPLIST); |
315 | rename("$pkgdir/new.$plist", "$pkgdir/$plist"); | | 315 | rename("$pkgdir/new.$plist", "$pkgdir/$plist"); |
316 | } | | 316 | } |
317 | closedir(PKGDIR); | | 317 | closedir(PKGDIR); |
318 | } | | 318 | } |
319 | | | 319 | |
320 | sub add_NetBSD_ID { | | 320 | sub add_NetBSD_ID { |
321 | my ($patch); | | 321 | my ($patch); |
322 | if (open(MD5, "$portsdir/files/md5") | | 322 | if (open(MD5, "$portsdir/files/md5") |
323 | || open(MD5, "$portsdir/distinfo")) { | | 323 | || open(MD5, "$portsdir/distinfo")) { |
324 | open(NMD5, ">$pkgdir/distinfo") | | 324 | open(NMD5, ">$pkgdir/distinfo") |
325 | || die "$pkgdir/distinfo: $!\n"; | | 325 | || die "$pkgdir/distinfo: $!\n"; |
326 | print NMD5 "\$NetBSD\$\n\n"; | | 326 | print NMD5 "\$"."NetBSD\$\n\n"; |
327 | while (<MD5>) { | | 327 | while (<MD5>) { |
328 | print NMD5 $_; | | 328 | print NMD5 $_; |
329 | } | | 329 | } |
330 | close(NMD5); | | 330 | close(NMD5); |
331 | close(MD5); | | 331 | close(MD5); |
332 | } | | 332 | } |
333 | | | 333 | |
334 | opendir(PATCHDIR, "$portsdir/patches") || | | 334 | opendir(PATCHDIR, "$portsdir/patches") || |
335 | opendir(PATCHDIR, "$portsdir/files") || | | 335 | opendir(PATCHDIR, "$portsdir/files") || |
336 | return 0; | | 336 | return 0; |
337 | while ($patch = readdir(PATCHDIR)) { | | 337 | while ($patch = readdir(PATCHDIR)) { |
338 | if ($patch eq "\." || $patch eq "\.." | | 338 | if ($patch eq "\." || $patch eq "\.." |
339 | || $patch eq "CVS") {next;} | | 339 | || $patch eq "CVS") {next;} |
340 | if (open(PATCH, "$portsdir/patches/$patch") | | 340 | if (open(PATCH, "$portsdir/patches/$patch") |
341 | || open(PATCH, "$portsdir/files/$patch")) { | | 341 | || open(PATCH, "$portsdir/files/$patch")) { |
342 | open(NPATCH, ">$pkgdir/patches/$patch") | | 342 | open(NPATCH, ">$pkgdir/patches/$patch") |
343 | || die "$pkgdir/patches/$patch: $!\n"; | | 343 | || die "$pkgdir/patches/$patch: $!\n"; |
344 | print NPATCH "\$NetBSD\$\n\n"; | | 344 | print NPATCH "\$"."NetBSD\$\n\n"; |
345 | while (<PATCH>) { | | 345 | while (<PATCH>) { |
346 | if (/(FreeBSD)/i || | | 346 | if (/(FreeBSD)/i || |
347 | /(#!.*perl)/) { | | 347 | /(#!.*perl)/) { |
348 | print "WARN: $pkgdir/patches/" . | | 348 | print "WARN: $pkgdir/patches/" . |
349 | "$patch includes \"$1\".\n"; | | 349 | "$patch includes \"$1\".\n"; |
350 | } | | 350 | } |
351 | print NPATCH $_; | | 351 | print NPATCH $_; |
352 | } | | 352 | } |
353 | close(NPATCH); | | 353 | close(NPATCH); |
354 | close(PATCH); | | 354 | close(PATCH); |
355 | } | | 355 | } |
356 | } | | 356 | } |
357 | closedir(PATCHDIR); | | 357 | closedir(PATCHDIR); |