Sun Sep 5 00:24:30 2010 UTC ()
Update "rpm2pkg" package to version 3.1.1:
- Fix start of "lzcat" if "LZCAT" is not defined as a full pathname.
- Handle short reads on the pipe to "lzcat".


(tron)
diff -r1.47 -r1.48 pkgsrc/pkgtools/rpm2pkg/Makefile
diff -r1.12 -r1.13 pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c

cvs diff -r1.47 -r1.48 pkgsrc/pkgtools/rpm2pkg/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/rpm2pkg/Makefile 2010/09/04 19:23:00 1.47
+++ pkgsrc/pkgtools/rpm2pkg/Makefile 2010/09/05 00:24:30 1.48
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1# $NetBSD: Makefile,v 1.47 2010/09/04 19:23:00 tron Exp $ 1# $NetBSD: Makefile,v 1.48 2010/09/05 00:24:30 tron Exp $
2 2
3DISTNAME= rpm2pkg-3.1 3DISTNAME= rpm2pkg-3.1.1
4CATEGORIES= pkgtools 4CATEGORIES= pkgtools
5MASTER_SITES= # empty 5MASTER_SITES= # empty
6DISTFILES= # empty 6DISTFILES= # empty
7NO_CHECKSUM= yes 7NO_CHECKSUM= yes
8 8
9OWNER= tron@NetBSD.org 9OWNER= tron@NetBSD.org
10HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/ 10HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/
11COMMENT= Convert RPM archives to NetBSD packages 11COMMENT= Convert RPM archives to NetBSD packages
12LICENSE= modified-bsd 12LICENSE= modified-bsd
13 13
14CONFLICTS+= suse-base<=6.4 14CONFLICTS+= suse-base<=6.4
15 15
16PKG_DESTDIR_SUPPORT= user-destdir 16PKG_DESTDIR_SUPPORT= user-destdir

cvs diff -r1.12 -r1.13 pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c (expand / switch to unified diff)

--- pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c 2010/09/04 19:23:00 1.12
+++ pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c 2010/09/05 00:24:30 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rpm2pkg.c,v 1.12 2010/09/04 19:23:00 tron Exp $ */ 1/* $NetBSD: rpm2pkg.c,v 1.13 2010/09/05 00:24:30 tron Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2001-2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2001-2010 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matthias Scheler. 8 * by Matthias Scheler.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -322,27 +322,27 @@ Open(int fd) @@ -322,27 +322,27 @@ Open(int fd)
322 (void)close(pfds[1]); 322 (void)close(pfds[1]);
323 free(fh); 323 free(fh);
324 return NULL; 324 return NULL;
325 325
326 case 0: 326 case 0:
327 (void)close(pfds[0]); 327 (void)close(pfds[0]);
328 if (dup2(fd, STDIN_FILENO) == -1 || 328 if (dup2(fd, STDIN_FILENO) == -1 ||
329 dup2(pfds[1], STDOUT_FILENO) == -1) { 329 dup2(pfds[1], STDOUT_FILENO) == -1) {
330 exit(EXIT_FAILURE); 330 exit(EXIT_FAILURE);
331 } 331 }
332 (void)close(fd); 332 (void)close(fd);
333 (void)close(pfds[1]); 333 (void)close(pfds[1]);
334 334
335 (void)execl(LZCAT, LZCAT, "-f", NULL); 335 (void)execlp(LZCAT, LZCAT, "-f", NULL);
336 exit(EXIT_FAILURE); 336 exit(EXIT_FAILURE);
337  337
338 default: 338 default:
339 (void)close(pfds[1]); 339 (void)close(pfds[1]);
340 fh->fh_Pipe = pfds[0]; 340 fh->fh_Pipe = pfds[0];
341 fh->fh_Child = pid; 341 fh->fh_Child = pid;
342 return fh; 342 return fh;
343 }  343 }
344#else 344#else
345 return NULL; 345 return NULL;
346#endif 346#endif
347 } 347 }
348 348
@@ -350,27 +350,41 @@ Open(int fd) @@ -350,27 +350,41 @@ Open(int fd)
350} 350}
351 351
352static bool 352static bool
353Read(FileHandle *fh, void *buffer, size_t length) 353Read(FileHandle *fh, void *buffer, size_t length)
354{ 354{
355 ssize_t bytes; 355 ssize_t bytes;
356 356
357 if (fh->fh_BZFile != NULL) { 357 if (fh->fh_BZFile != NULL) {
358 int bzerror; 358 int bzerror;
359 bytes = BZ2_bzRead(&bzerror, fh->fh_BZFile, buffer, length); 359 bytes = BZ2_bzRead(&bzerror, fh->fh_BZFile, buffer, length);
360 } else if (fh->fh_GZFile != NULL) { 360 } else if (fh->fh_GZFile != NULL) {
361 bytes = gzread(fh->fh_GZFile, buffer, length); 361 bytes = gzread(fh->fh_GZFile, buffer, length);
362 } else if (fh->fh_Pipe >= 0) { 362 } else if (fh->fh_Pipe >= 0) {
363 bytes = read(fh->fh_Pipe, buffer, length); 363 bytes = 0;
 364 while (length > 0) {
 365 ssize_t chunk = read(fh->fh_Pipe, buffer, length);
 366 if (chunk < 0) {
 367 bytes = -1;
 368 break;
 369 } else if (chunk == 0) {
 370 break;
 371 }
 372
 373 buffer += chunk;
 374 length -= chunk;
 375
 376 bytes += chunk;
 377 }
364 } else { 378 } else {
365 bytes = -1; 379 bytes = -1;
366 } 380 }
367 381
368 if (bytes > 0) 382 if (bytes > 0)
369 fh->fh_Pos += bytes; 383 fh->fh_Pos += bytes;
370 384
371 return (bytes == (ssize_t)length); 385 return (bytes == (ssize_t)length);
372} 386}
373 387
374static bool 388static bool
375SkipAndAlign(FileHandle *fh, off_t Skip) 389SkipAndAlign(FileHandle *fh, off_t Skip)
376 390