From: Anas Nashif Date: Wed, 7 Nov 2012 01:51:53 +0000 (-0800) Subject: add packaging X-Git-Tag: accepted/tizen/20130503.230727~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33894efb281a59af0292a6c9b183eb11b30887cb;p=platform%2Fupstream%2Funzip.git add packaging --- diff --git a/packaging/unzip-6.0-attribs-overflow.patch b/packaging/unzip-6.0-attribs-overflow.patch new file mode 100644 index 0000000..3122325 --- /dev/null +++ b/packaging/unzip-6.0-attribs-overflow.patch @@ -0,0 +1,12 @@ +diff -up unzip60/zipinfo.c.attribs-overflow unzip60/zipinfo.c +--- unzip60/zipinfo.c.attribs-overflow 2009-11-30 09:55:39.000000000 +0100 ++++ unzip60/zipinfo.c 2009-11-30 09:56:42.844263244 +0100 +@@ -1881,7 +1881,7 @@ static int zi_short(__G) /* return PK- + #endif + int k, error, error_in_archive=PK_COOL; + unsigned hostnum, hostver, methid, methnum, xattr; +- char *p, workspace[12], attribs[16]; ++ char *p, workspace[12], attribs[17]; + char methbuf[5]; + static ZCONST char dtype[5]="NXFS"; /* normal, maximum, fast, superfast */ + static ZCONST char Far os[NUM_HOSTS+1][4] = { diff --git a/packaging/unzip-6.0-bzip2-configure.patch b/packaging/unzip-6.0-bzip2-configure.patch new file mode 100644 index 0000000..9cf006b --- /dev/null +++ b/packaging/unzip-6.0-bzip2-configure.patch @@ -0,0 +1,29 @@ +diff -up unzip60/unix/configure.bzip2-configure unzip60/unix/configure +--- unzip60/unix/configure.bzip2-configure 2009-04-16 21:25:12.000000000 +0200 ++++ unzip60/unix/configure 2009-11-18 11:22:14.598389194 +0100 +@@ -640,7 +640,24 @@ else + D_USE_BZ2="-DUSE_BZIP2" + L_BZ2="${BZLF} -lbz2" + else +- echo "-- bzip2 sources not found - no bzip2 support" ++ echo " Check if OS already has bzip2 library installed" ++ cat > conftest.c << _EOF_ ++#include "bzlib.h" ++int main() ++{ ++ bz_stream strm; ++ BZ2_bzCompressEnd(&strm); ++ return 0; ++} ++_EOF_ ++ $CC $CFLAGS -o conftest conftest.c -lbz2 > /dev/null 2>/dev/null ++ if test $? -eq 0; then ++ echo "-- OS supports bzip2 - linking in bzip2" ++ D_USE_BZ2="-DBZIP2_SUPPORT" ++ L_BZ2="${BZLF} -lbz2" ++ else ++ echo "-- Either bzlib.h or libbz2.a not found - no bzip2" ++ fi + fi + fi + diff --git a/packaging/unzip-6.0-close.patch b/packaging/unzip-6.0-close.patch new file mode 100644 index 0000000..9a238a9 --- /dev/null +++ b/packaging/unzip-6.0-close.patch @@ -0,0 +1,176 @@ +diff -up unzip60/extract.c.close unzip60/extract.c +--- unzip60/extract.c.close 2009-03-14 02:32:52.000000000 +0100 ++++ unzip60/extract.c 2009-11-19 08:17:23.481263496 +0100 +@@ -1924,24 +1924,21 @@ static int extract_or_test_member(__G) + + #ifdef VMS /* VMS: required even for stdout! (final flush) */ + if (!uO.tflag) /* don't close NULL file */ +- close_outfile(__G); ++ error = close_outfile(__G); + #else + #ifdef DLL + if (!uO.tflag && (!uO.cflag || G.redirect_data)) { + if (G.redirect_data) + FINISH_REDIRECT(); + else +- close_outfile(__G); ++ error = close_outfile(__G); + } + #else + if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */ +- close_outfile(__G); ++ error = close_outfile(__G); + #endif + #endif /* VMS */ + +- /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */ +- +- + if (G.disk_full) { /* set by flush() */ + if (G.disk_full > 1) { + #if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK)) +diff -up unzip60/unix/unix.c.close unzip60/unix/unix.c +--- unzip60/unix/unix.c.close 2009-01-24 00:31:26.000000000 +0100 ++++ unzip60/unix/unix.c 2009-11-19 08:33:25.568389171 +0100 +@@ -1096,10 +1096,41 @@ static int get_extattribs(__G__ pzt, z_u + #ifndef MTS + + /****************************/ ++/* Function CloseError() */ ++/***************************/ ++ ++int CloseError(__G) ++ __GDEF ++{ ++ int errval = PK_OK; ++ ++ if (fclose(G.outfile) < 0) { ++ switch (errno) { ++ case ENOSPC: ++ /* Do we need this on fileio.c? */ ++ Info(slide, 0x4a1, ((char *)slide, "%s: write error (disk full?). Continue? (y/n/^C) ", ++ FnFilter1(G.filename))); ++ fgets(G.answerbuf, 9, stdin); ++ if (*G.answerbuf == 'y') /* stop writing to this file */ ++ G.disk_full = 1; /* pass to next */ ++ else ++ G.disk_full = 2; /* no: exit program */ ++ ++ errval = PK_DISK; ++ break; ++ ++ default: ++ errval = PK_WARN; ++ } ++ } ++ return errval; ++} /* End of CloseError() */ ++ ++/****************************/ + /* Function close_outfile() */ + /****************************/ + +-void close_outfile(__G) /* GRR: change to return PK-style warning level */ ++int close_outfile(__G) + __GDEF + { + union { +@@ -1108,6 +1139,7 @@ void close_outfile(__G) /* GRR: chang + } zt; + ulg z_uidgid[2]; + int have_uidgid_flg; ++ int errval = PK_OK; + + have_uidgid_flg = get_extattribs(__G__ &(zt.t3), z_uidgid); + +@@ -1141,16 +1173,16 @@ void close_outfile(__G) /* GRR: chang + Info(slide, 0x201, ((char *)slide, + "warning: symbolic link (%s) failed: mem alloc overflow\n", + FnFilter1(G.filename))); +- fclose(G.outfile); +- return; ++ errval = CloseError(G.outfile, G.filename); ++ return errval ? errval : PK_WARN; + } + + if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) { + Info(slide, 0x201, ((char *)slide, + "warning: symbolic link (%s) failed: no mem\n", + FnFilter1(G.filename))); +- fclose(G.outfile); +- return; ++ errval = CloseError(G.outfile, G.filename); ++ return errval ? errval : PK_WARN; + } + slnk_entry->next = NULL; + slnk_entry->targetlen = ucsize; +@@ -1174,10 +1206,10 @@ void close_outfile(__G) /* GRR: chang + "warning: symbolic link (%s) failed\n", + FnFilter1(G.filename))); + free(slnk_entry); +- fclose(G.outfile); +- return; ++ errval = CloseError(G.outfile, G.filename); ++ return errval ? errval : PK_WARN; + } +- fclose(G.outfile); /* close "link" file for good... */ ++ errval = CloseError(G.outfile, G.filename); /* close "link" file for good... */ + slnk_entry->target[ucsize] = '\0'; + if (QCOND2) + Info(slide, 0, ((char *)slide, "-> %s ", +@@ -1188,7 +1220,7 @@ void close_outfile(__G) /* GRR: chang + else + G.slink_head = slnk_entry; + G.slink_last = slnk_entry; +- return; ++ return errval; + } + #endif /* SYMLINKS */ + +@@ -1201,7 +1233,7 @@ void close_outfile(__G) /* GRR: chang + #endif + + #if (defined(NO_FCHOWN)) +- fclose(G.outfile); ++ errval = CloseError(G.outfile, G.filename); + #endif + + /* if -X option was specified and we have UID/GID info, restore it */ +@@ -1227,7 +1259,7 @@ void close_outfile(__G) /* GRR: chang + } + + #if (!defined(NO_FCHOWN) && defined(NO_FCHMOD)) +- fclose(G.outfile); ++ errval = CloseError(G.outfile, G.filename); + #endif + + #if (!defined(NO_FCHOWN) && !defined(NO_FCHMOD)) +@@ -1239,7 +1271,7 @@ void close_outfile(__G) /* GRR: chang + if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr))) + perror("fchmod (file attributes) error"); + +- fclose(G.outfile); ++ errval = CloseError(G.outfile, G.filename); + #endif /* !NO_FCHOWN && !NO_FCHMOD */ + + /* skip restoring time stamps on user's request */ +@@ -1267,6 +1299,7 @@ void close_outfile(__G) /* GRR: chang + #endif + #endif /* NO_FCHOWN || NO_FCHMOD */ + ++ return errval; + } /* end function close_outfile() */ + + #endif /* !MTS */ +diff -up unzip60/unzpriv.h.close unzip60/unzpriv.h +--- unzip60/unzpriv.h.close 2009-04-20 01:59:26.000000000 +0200 ++++ unzip60/unzpriv.h 2009-11-19 08:19:08.610388618 +0100 +@@ -2604,7 +2604,7 @@ char *GetLoadPath OF((__GPRO)); + int SetFileSize OF((FILE *file, zusz_t filesize)); /* local */ + #endif + #ifndef MTS /* macro in MTS */ +- void close_outfile OF((__GPRO)); /* local */ ++ int close_outfile OF((__GPRO)); /* local */ + #endif + #ifdef SET_SYMLINK_ATTRIBS + int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry)); /* local */ diff --git a/packaging/unzip-6.0-exec-shield.patch b/packaging/unzip-6.0-exec-shield.patch new file mode 100644 index 0000000..74500aa --- /dev/null +++ b/packaging/unzip-6.0-exec-shield.patch @@ -0,0 +1,10 @@ +diff -up unzip60/crc_i386.S.exec-shield unzip60/crc_i386.S +--- unzip60/crc_i386.S.exec-shield 2007-01-07 06:02:58.000000000 +0100 ++++ unzip60/crc_i386.S 2009-11-18 11:16:39.630389312 +0100 +@@ -302,3 +302,6 @@ _crc32: /* ulg c + #endif /* i386 || _i386 || _I386 || __i386 */ + + #endif /* !USE_ZLIB && !CRC_TABLE_ONLY */ ++ ++.section .note.GNU-stack, "", @progbits ++.previous diff --git a/packaging/unzip-6.0-nostrip.patch b/packaging/unzip-6.0-nostrip.patch new file mode 100644 index 0000000..71c263f --- /dev/null +++ b/packaging/unzip-6.0-nostrip.patch @@ -0,0 +1,12 @@ +diff -up unzip60/unix/configure.nostrip unzip60/unix/configure +--- unzip60/unix/configure.nostrip 2009-11-30 10:18:09.000000000 +0100 ++++ unzip60/unix/configure 2009-11-30 10:21:08.354264213 +0100 +@@ -17,7 +17,7 @@ CFLAGSR=${CFLAGS} + IZ_BZIP2=${3} + CFLAGS="${CFLAGS} -I. -DUNIX" + LFLAGS1="" +-LFLAGS2="-s" ++LFLAGS2="" + LN="ln -s" + + CFLAGS_OPT='' diff --git a/packaging/unzip.spec b/packaging/unzip.spec new file mode 100644 index 0000000..e35b6f2 --- /dev/null +++ b/packaging/unzip.spec @@ -0,0 +1,56 @@ +#specfile originally created for Fedora, modified for Moblin Linux +Name: unzip +Version: 6.0 +Release: 9 +License: BSD +Summary: A utility for unpacking zip files +Url: http://www.info-zip.org/pub/infozip/UnZip.html +Group: Applications/Archiving +Source: ftp://ftp.info-zip.org/pub/infozip/src/unzip60.tar.gz +# Not sent to upstream. +Patch1: unzip-6.0-bzip2-configure.patch +# Upstream plans to do this in zip (hopefully also in unzip). +Patch2: unzip-6.0-exec-shield.patch +# Upstream plans to do similar thing. +Patch3: unzip-6.0-close.patch +# Details in rhbz#532380. +# Reported to upstream: http://www.info-zip.org/board/board.pl?m-1259575993/ +Patch4: unzip-6.0-attribs-overflow.patch +# Not sent to upstream, as it's Fedora/RHEL specific. +# Modify the configure script not to request the strip of binaries. +Patch5: unzip-6.0-nostrip.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +The unzip utility is used to list, test, or extract files from a zip +archive. Zip archives are commonly found on MS-DOS systems. The zip +utility, included in the zip package, creates zip archives. Zip and +unzip are both compatible with archives created by PKWARE(R)'s PKZIP +for MS-DOS, but the programs' options and default behaviors do differ +in some respects. + +Install the unzip package if you need to list, test or extract files from +a zip archive. + +%prep +%setup -q -n %{name}60 +%patch1 -p1 -b .bzip2-configure +%patch2 -p1 -b .exec-shield +%patch3 -p1 -b .close +%patch4 -p1 -b .attribs-overflow +%patch5 -p1 -b .nostrip +ln -s unix/Makefile Makefile + +%build +make CFLAGS="-D_LARGEFILE64_SOURCE" linux_noasm LF2="" %{?_smp_mflags} + +%install + +make prefix=%{buildroot}%{_prefix} MANDIR=%{buildroot}/%{_mandir}/man1 INSTALL="cp -p" install LF2="" + +%files +%defattr(-,root,root) +%doc README BUGS LICENSE +%{_bindir}/* +%doc %{_mandir}/*/* +