Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3BE2AE80.EAF3FC24@syntrex.com> Date: Fri, 02 Nov 2001 15:32:32 +0100 From: Pavel Tsekov X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: Robert Collins CC: Ronald Landheer , cygwin AT cygwin DOT com, cygwin-patches AT cygwin DOT com Subject: [PATCH] setup.exe & different archives for the same version of the app References: <1004694386 DOT 6940 DOT 56 DOT camel AT lifelesswks> Content-Type: multipart/mixed; boundary="------------FE74C3022BA9BB06BE24E37C" --------------FE74C3022BA9BB06BE24E37C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Robert Collins wrote: > > On Fri, 2001-11-02 at 20:32, Ronald Landheer wrote: > > > I agree that it's bad practice on the maintainers behalf, but I think > > Setup should be able to handle it anyway: either it should not offer a > > package it won't be able to unpack, or it should be able to unpack > > anything it offers (regardless of whether it's .gz or .bz2, and > > regardless of where it happens to live: if found & offered, make good > > the offer). > > Granted. I just have no motivation to fix it, but if you have the time, > or someone else does, I won't object to patches that address this > cleanly. See the applied patch :) Hope this will fix the problem :) * install.cc (install_one): Checks for the existence of the tarball based on a set of well-known package extensions. * filemanip.h (known_file_types): Declaration of a new global variable, containing a set of known file extensions for packages handled by setup.exe. * choose.cc (known_file_types): A new global variable, containing a set of known file extensions for packages handled by setup.exe --------------FE74C3022BA9BB06BE24E37C Content-Type: text/plain; charset=us-ascii; name="choose.cc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="choose.cc.diff" --- /tmp/choose.cc Fri Nov 2 15:13:20 2001 +++ choose.cc Fri Nov 2 15:15:37 2001 @@ -71,6 +71,12 @@ static HDC bitmap_dc; static view *chooser = NULL; static trusts deftrust = TRUST_UNKNOWN; +char *known_file_types[] = { + "tar.gz", + "tar.bz2", + 0 +}; + static struct _header pkg_headers[] = { {"Current", 7, 0, 0}, {"New", 3, 0, 0}, --------------FE74C3022BA9BB06BE24E37C Content-Type: text/plain; charset=us-ascii; name="install.cc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="install.cc.diff" --- /tmp/install.cc Fri Nov 2 15:01:21 2001 +++ install.cc Fri Nov 2 15:06:24 2001 @@ -300,17 +300,27 @@ install_one (Package *pkg, bool isSrc) char name[strlen (pkg->name) + strlen (extra) + 1]; strcat (strcpy (name, pkg->name), extra); - - char *basef = base (file); - SetWindowText (ins_pkgname, basef); - if (!exists (file)) - file = basef; - if (!exists (file)) + char file_buf[MAX_PATH + 1]; + int file_exists = 0; + int ext = find_tar_ext(file) + 1; + strncpy (file_buf, file, ext); + filebuf[ext] = '\0'; + file = (char *) &file_buf; + char *basef = base (file); + + for (int c = 0; !file_exists && known_file_types[c]; c++) + { + strcpy ((char *) &file_buf[ext], known_file_types[c]); + file_exists = exists (file) || exists (basef); + } + if (!file_exists) { note (IDS_ERR_OPEN_READ, file, "No such file"); return 1; } + else + SetWindowText (ins_pkgname, basef); gzFile lst = gzopen (cygpath ("/etc/setup/", name, ".lst.gz", 0), "wb9"); --------------FE74C3022BA9BB06BE24E37C Content-Type: text/plain; charset=us-ascii; name="filemanip.h.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="filemanip.h.diff" --- /tmp/filemanip.h Fri Nov 2 15:11:50 2001 +++ filemanip.h Fri Nov 2 14:42:53 2001 @@ -13,6 +13,8 @@ * */ +extern char *known_file_types[]; + extern int find_tar_ext (const char *path); typedef struct --------------FE74C3022BA9BB06BE24E37C Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --------------FE74C3022BA9BB06BE24E37C--