This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
[PATCH] setup.exe & different archives for the same version of the app
- To: Robert Collins <robert dot collins at itdomain dot com dot au>
- Subject: [PATCH] setup.exe & different archives for the same version of the app
- From: Pavel Tsekov <ptsekov at syntrex dot com>
- Date: Fri, 02 Nov 2001 15:32:32 +0100
- CC: Ronald Landheer <ronald at minisat dot com>, cygwin at cygwin dot com, cygwin-patches at cygwin dot com
- References: <NFBBIBMBMMAMDPDHMKEBKEBACBAA.ronald@minisat.com> <1004694386.6940.56.camel@lifelesswks>
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
--- /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},
--- /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");
--- /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