delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/02/09:33:07

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
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 <ptsekov AT syntrex DOT com>
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 <robert DOT collins AT itdomain DOT com DOT au>
CC: Ronald Landheer <ronald AT minisat DOT com>, 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: <NFBBIBMBMMAMDPDHMKEBKEBACBAA DOT ronald AT minisat DOT com> <1004694386 DOT 6940 DOT 56 DOT camel AT lifelesswks>

--------------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--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019