Thu Apr 23 21:38:02 2009 UTC ()
Update "rpm2pkg" package to version 2.2. Changes since version 2.1.1:
- Switch to 2-clause BSD license.
- Compile with extra warnings (again) if GCC is used as the compiler.
- Fix build warnings reported by "-Wsign-compare".


(tron)
diff -r1.40 -r1.41 pkgsrc/pkgtools/rpm2pkg/Makefile
diff -r1.6 -r1.7 pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c

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

--- pkgsrc/pkgtools/rpm2pkg/Makefile 2009/04/09 00:48:14 1.40
+++ pkgsrc/pkgtools/rpm2pkg/Makefile 2009/04/23 21:38:02 1.41
@@ -1,39 +1,40 @@ @@ -1,39 +1,40 @@
1# $NetBSD: Makefile,v 1.40 2009/04/09 00:48:14 joerg Exp $ 1# $NetBSD: Makefile,v 1.41 2009/04/23 21:38:02 tron Exp $
2 2
3DISTNAME= rpm2pkg-2.1.1 3DISTNAME= rpm2pkg-2.2
4PKGREVISION= 2 
5CATEGORIES= pkgtools 4CATEGORIES= pkgtools
6MASTER_SITES= # empty 5MASTER_SITES= # empty
7DISTFILES= # empty 6DISTFILES= # empty
8 7
9OWNER= tron@NetBSD.org 8OWNER= tron@NetBSD.org
10HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/ 9HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/
11COMMENT= Convert RPM archives to NetBSD packages 10COMMENT= Convert RPM archives to NetBSD packages
12 11
13CONFLICTS+= suse-base<=6.4 12CONFLICTS+= suse-base<=6.4
14 13
 14LICENSE= modified-bsd
 15
15PKG_DESTDIR_SUPPORT= user-destdir 16PKG_DESTDIR_SUPPORT= user-destdir
16 17
17WRKSRC= ${WRKDIR} 18WRKSRC= ${WRKDIR}
18 19
19CPPFLAGS+= ${BUILDLINK_CPPFLAGS.bzip2} ${BUILDLINK_CPPFLAGS.rpm} \ 20CPPFLAGS+= ${BUILDLINK_CPPFLAGS.bzip2} ${BUILDLINK_CPPFLAGS.rpm} \
20 ${BUILDLINK_CPPFLAGS.zlib} 21 ${BUILDLINK_CPPFLAGS.zlib}
21LIBS+= -lrpm -lintl -lz -lbz2 22LIBS+= -lrpm -lintl -lz -lbz2
22 23
23.include "../../mk/bsd.prefs.mk" 24.include "../../mk/compiler.mk"
24 25
25.if (${CC} == gcc) 26.if !empty(CC_VERSION:Mgcc-*)
26CFLAGS+= -Wall 27CFLAGS+= -Wall -Wshadow -Wsign-compare -Wunused-value
27.endif 28.endif
28 29
29INSTALLATION_DIRS= ${PKGMANDIR}/man8 sbin 30INSTALLATION_DIRS= ${PKGMANDIR}/man8 sbin
30 31
31do-build: 32do-build:
32 cd ${WRKSRC}; ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o rpm2pkg \ 33 cd ${WRKSRC}; ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o rpm2pkg \
33 ${FILESDIR}/rpm2pkg.c ${LIBS} 34 ${FILESDIR}/rpm2pkg.c ${LIBS}
34 35
35do-install: 36do-install:
36 ${INSTALL_PROGRAM} ${WRKSRC}/rpm2pkg ${DESTDIR}${PREFIX}/sbin 37 ${INSTALL_PROGRAM} ${WRKSRC}/rpm2pkg ${DESTDIR}${PREFIX}/sbin
37 ${INSTALL_MAN} ${FILESDIR}/rpm2pkg.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8 38 ${INSTALL_MAN} ${FILESDIR}/rpm2pkg.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8
38 39
39.include "../../archivers/bzip2/buildlink3.mk" 40.include "../../archivers/bzip2/buildlink3.mk"

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

--- pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c 2006/01/21 20:46:29 1.6
+++ pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c 2009/04/23 21:38:02 1.7
@@ -1,33 +1,30 @@ @@ -1,33 +1,30 @@
1/* $NetBSD: rpm2pkg.c,v 1.6 2006/01/21 20:46:29 tron Exp $ */ 1/* $NetBSD: rpm2pkg.c,v 1.7 2009/04/23 21:38:02 tron Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2004 The NetBSD Foundation, Inc. 4 * Copyright (c) 2004-2009 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.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of The NetBSD Foundation nor the names of its 
19 * contributors may be used to endorse or promote products derived 
20 * from this software without specific prior written permission. 
21 * 18 *
22 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
33 */ 30 */
@@ -118,30 +115,30 @@ typedef void PListEntryFunc(PListEntry * @@ -118,30 +115,30 @@ typedef void PListEntryFunc(PListEntry *
118#define PLIST_ORDER_FORWARD 0 115#define PLIST_ORDER_FORWARD 0
119#define PLIST_ORDER_BACKWARD 1 116#define PLIST_ORDER_BACKWARD 1
120 117
121#define INVERT_PLIST_ORDER(o) (1 - (o)) 118#define INVERT_PLIST_ORDER(o) (1 - (o))
122 119
123typedef struct FileHandleStruct { 120typedef struct FileHandleStruct {
124 FILE *fh_File; 121 FILE *fh_File;
125 BZFILE *fh_BZFile; 122 BZFILE *fh_BZFile;
126 gzFile *fh_GZFile; 123 gzFile *fh_GZFile;
127 off_t fh_Pos; 124 off_t fh_Pos;
128} FileHandle; 125} FileHandle;
129 126
130static int 127static int
131InitBuffer(void **Buffer, int *BufferSizePtr) 128InitBuffer(void **Buffer, size_t *BufferSizePtr)
132{ 129{
133 if (*Buffer == NULL) { 130 if (*Buffer == NULL) {
134 int BufferSize; 131 size_t BufferSize;
135 132
136 BufferSize = sysconf(_SC_PAGESIZE) * 256; 133 BufferSize = sysconf(_SC_PAGESIZE) * 256;
137 while ((*Buffer = malloc(BufferSize)) == NULL) { 134 while ((*Buffer = malloc(BufferSize)) == NULL) {
138 BufferSize >>= 1; 135 BufferSize >>= 1;
139 if (BufferSize == 0) 136 if (BufferSize == 0)
140 return FALSE; 137 return FALSE;
141 } 138 }
142 *BufferSizePtr = BufferSize; 139 *BufferSizePtr = BufferSize;
143 } 140 }
144 return TRUE; 141 return TRUE;
145} 142}
146 143
147static void 144static void
@@ -226,37 +223,38 @@ SkipAndAlign(FileHandle *fh, off_t Skip) @@ -226,37 +223,38 @@ SkipAndAlign(FileHandle *fh, off_t Skip)
226 223
227 NewPos = (fh->fh_Pos + Skip + 3) & ~3; 224 NewPos = (fh->fh_Pos + Skip + 3) & ~3;
228 if (fh->fh_Pos == NewPos) 225 if (fh->fh_Pos == NewPos)
229 return TRUE; 226 return TRUE;
230 227
231 if (fh->fh_GZFile != NULL) { 228 if (fh->fh_GZFile != NULL) {
232 if (gzseek(fh->fh_GZFile, NewPos, SEEK_SET) == NewPos) { 229 if (gzseek(fh->fh_GZFile, NewPos, SEEK_SET) == NewPos) {
233 fh->fh_Pos = NewPos; 230 fh->fh_Pos = NewPos;
234 return TRUE; 231 return TRUE;
235 } 232 }
236 return FALSE; 233 return FALSE;
237 } else { 234 } else {
238 static void *Buffer = NULL; 235 static void *Buffer = NULL;
239 static int BufferSize = 0; 236 static size_t BufferSize = 0;
240 237
241 if (!InitBuffer(&Buffer, &BufferSize)) 238 if (!InitBuffer(&Buffer, &BufferSize))
242 return FALSE; 239 return FALSE;
243 240
244 while (fh->fh_Pos < NewPos) { 241 while (fh->fh_Pos < NewPos) {
245 off_t Length; 242 off_t Length;
246 int Chunk; 243 int Chunk;
247 244
248 Length = NewPos - fh->fh_Pos; 245 Length = NewPos - fh->fh_Pos;
249 Chunk = (Length > BufferSize) ? BufferSize : Length; 246 Chunk = (Length > (off_t)BufferSize) ?
 247 (off_t)BufferSize : Length;
250 if (!Read(fh, Buffer, Chunk)) 248 if (!Read(fh, Buffer, Chunk))
251 return FALSE; 249 return FALSE;
252 } 250 }
253 } 251 }
254 252
255 return TRUE; 253 return TRUE;
256} 254}
257 255
258static PListEntry * 256static PListEntry *
259InsertPListEntry(PListEntry **Tree,char *Name) 257InsertPListEntry(PListEntry **Tree,char *Name)
260{ 258{
261 PListEntry *Node; 259 PListEntry *Node;
262 260
@@ -549,27 +547,27 @@ MakeSymLink(char *Link, char *Name) @@ -549,27 +547,27 @@ MakeSymLink(char *Link, char *Name)
549 return FALSE; 547 return FALSE;
550 } 548 }
551 549
552 return ((unlink(Name) == 0) && (symlink(Link, Name) == 0)); 550 return ((unlink(Name) == 0) && (symlink(Link, Name) == 0));
553} 551}
554 552
555static int 553static int
556WriteFile(FileHandle *In, char *Name, mode_t Mode, unsigned long Length, 554WriteFile(FileHandle *In, char *Name, mode_t Mode, unsigned long Length,
557 char *Link) 555 char *Link)
558{ 556{
559 int Out; 557 int Out;
560 struct stat Stat; 558 struct stat Stat;
561 static void *Buffer = NULL; 559 static void *Buffer = NULL;
562 static int BufferSize = 0; 560 static size_t BufferSize = 0;
563 561
564 if ((lstat(Name, &Stat) == 0) && 562 if ((lstat(Name, &Stat) == 0) &&
565 (!S_ISREG(Stat.st_mode) || (unlink(Name) < 0))) { 563 (!S_ISREG(Stat.st_mode) || (unlink(Name) < 0))) {
566 return FALSE; 564 return FALSE;
567 } 565 }
568 566
569 if (!InitBuffer(&Buffer, &BufferSize)) 567 if (!InitBuffer(&Buffer, &BufferSize))
570 return FALSE; 568 return FALSE;
571 569
572 if (Link != NULL) { 570 if (Link != NULL) {
573 if (link(Link, Name) < 0) 571 if (link(Link, Name) < 0)
574 return FALSE; 572 return FALSE;
575 Out = open(Name, O_WRONLY, Mode); 573 Out = open(Name, O_WRONLY, Mode);