[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/ilgac ilgac.c,1.1,1.2
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/ilgac ilgac.c,1.1,1.2 |
Date: |
Wed, 26 Nov 2003 21:38:10 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/ilgac
In directory subversions:/tmp/cvs-serv12780/ilgac
Modified Files:
ilgac.c
Log Message:
Modify "ilgac" so that it can also install IL executables into the assembly
cache.
Index: ilgac.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilgac/ilgac.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ilgac.c 11 Nov 2003 00:37:09 -0000 1.1
--- ilgac.c 26 Nov 2003 21:38:08 -0000 1.2
***************
*** 120,129 ****
static void version(void);
static int getAssemblyVersion(const char *assembly, ILUInt16 *version,
! int reportErrors);
static int parseVersion(const char *str, ILUInt16 *version);
static char *stripAssemblyName(char *assembly);
static int installAssembly(const char *filename, const char *assembly,
! const ILUInt16 *version);
! static int uninstallAssembly(const char *assembly, const ILUInt16 *version);
static int listAssemblies(const char *assembly, const ILUInt16 *version);
--- 120,131 ----
static void version(void);
static int getAssemblyVersion(const char *assembly, ILUInt16 *version,
! int reportErrors, int
*imageType);
static int parseVersion(const char *str, ILUInt16 *version);
static char *stripAssemblyName(char *assembly);
+ static int imageTypeFromName(char *assembly);
static int installAssembly(const char *filename, const char *assembly,
! const ILUInt16 *version, int
imageType);
! static int uninstallAssembly(const char *assembly, const ILUInt16 *version,
! int imageType);
static int listAssemblies(const char *assembly, const ILUInt16 *version);
***************
*** 147,150 ****
--- 149,153 ----
char *sourceAssembly = 0;
ILUInt16 versionDetails[4] = {0, 0, 0, 0};
+ int type;
int state, opt;
char *param;
***************
*** 267,271 ****
/* Get the name and version information for the
assembly */
sourceAssembly = argv[1];
! if(!getAssemblyVersion(sourceAssembly, versionDetails,
1))
{
return 1;
--- 270,274 ----
/* Get the name and version information for the
assembly */
sourceAssembly = argv[1];
! if(!getAssemblyVersion(sourceAssembly, versionDetails,
1, &type))
{
return 1;
***************
*** 274,278 ****
/* Install the specified assembly into the cache */
! result = installAssembly(sourceAssembly, assembly,
versionDetails);
if(!result)
{
--- 277,282 ----
/* Install the specified assembly into the cache */
! result = installAssembly
! (sourceAssembly, assembly, versionDetails,
type);
if(!result)
{
***************
*** 307,314 ****
/* Assembly name and version supplied */
assembly = stripAssemblyName(argv[1]);
argv += 2;
argc -= 2;
}
! else if(!getAssemblyVersion(argv[1], versionDetails, 1))
{
/* Invalid assembly supplied */
--- 311,319 ----
/* Assembly name and version supplied */
assembly = stripAssemblyName(argv[1]);
+ type = imageTypeFromName(argv[1]);
argv += 2;
argc -= 2;
}
! else if(!getAssemblyVersion(argv[1], versionDetails, 1,
&type))
{
/* Invalid assembly supplied */
***************
*** 322,326 ****
--argc;
}
! result = uninstallAssembly(assembly, versionDetails);
if(!result)
{
--- 327,331 ----
--argc;
}
! result = uninstallAssembly(assembly, versionDetails,
type);
if(!result)
{
***************
*** 417,421 ****
*/
static int getAssemblyVersion(const char *assembly, ILUInt16 *version,
! int reportErrors)
{
ILContext *context;
--- 422,426 ----
*/
static int getAssemblyVersion(const char *assembly, ILUInt16 *version,
! int reportErrors, int
*imageType)
{
ILContext *context;
***************
*** 437,447 ****
}
! /* The assembly must be a DLL to be installed in the GAC */
! if(ILImageType(image) != IL_IMAGETYPE_DLL)
{
! fprintf(stderr, "%s: Image is not a DLL\n", assembly);
ILContextDestroy(context);
return 0;
}
/* Extract the version information from the assembly */
--- 442,457 ----
}
! /* The assembly must be a DLL or EXE to be installed in the GAC */
! if(ILImageType(image) != IL_IMAGETYPE_DLL &&
! ILImageType(image) != IL_IMAGETYPE_EXE)
{
! fprintf(stderr, "%s: image is not a DLL or EXE\n", assembly);
ILContextDestroy(context);
return 0;
}
+ if(imageType)
+ {
+ *imageType = ILImageType(image);
+ }
/* Extract the version information from the assembly */
***************
*** 518,521 ****
--- 528,538 ----
assembly = ILDupNString(assembly, len - 4);
}
+ else if(len > 4 && assembly[len - 4] == '.' &&
+ (assembly[len - 3] == 'e' || assembly[len - 3] == 'E')
&&
+ (assembly[len - 2] == 'x' || assembly[len - 2] == 'X')
&&
+ (assembly[len - 1] == 'e' || assembly[len - 1] == 'E'))
+ {
+ assembly = ILDupNString(assembly, len - 4);
+ }
}
return assembly;
***************
*** 523,526 ****
--- 540,562 ----
/*
+ * Determine the image type (DLL or EXE) from an assembly name.
+ */
+ static int imageTypeFromName(char *assembly)
+ {
+ int len = strlen(assembly);
+ if(len > 4 && assembly[len - 4] == '.' &&
+ (assembly[len - 3] == 'e' || assembly[len - 3] == 'E') &&
+ (assembly[len - 2] == 'x' || assembly[len - 2] == 'X') &&
+ (assembly[len - 1] == 'e' || assembly[len - 1] == 'E'))
+ {
+ return IL_IMAGETYPE_EXE;
+ }
+ else
+ {
+ return IL_IMAGETYPE_DLL;
+ }
+ }
+
+ /*
* Determine if we can use symlinks to manage the default versions.
*/
***************
*** 666,674 ****
*/
static int installAssembly(const char *filename, const char *assembly,
! const ILUInt16 *version)
{
char versionbuf[64];
char *path;
int error;
/* Make sure that the top-level cache directory exists */
--- 702,711 ----
*/
static int installAssembly(const char *filename, const char *assembly,
! const ILUInt16 *version, int
imageType)
{
char versionbuf[64];
char *path;
int error;
+ const char *extension;
/* Make sure that the top-level cache directory exists */
***************
*** 678,681 ****
--- 715,728 ----
}
+ /* Determine the extension to use */
+ if(imageType == IL_IMAGETYPE_EXE)
+ {
+ extension = "exe";
+ }
+ else
+ {
+ extension = "dll";
+ }
+
/* Get the name of the version sub-directory */
if(version[0] != 0 || version[1] != 0 || version[2] != 0 || version[3]
!= 0)
***************
*** 713,717 ****
/* Copy the assembly into place */
! path = BuildPath(cache, versionbuf, subdir, assembly, "dll");
if(!force && ILFileExists(path, (char **)0))
{
--- 760,764 ----
/* Copy the assembly into place */
! path = BuildPath(cache, versionbuf, subdir, assembly, extension);
if(!force && ILFileExists(path, (char **)0))
{
***************
*** 785,796 ****
if(subdir)
{
! link = BuildPath("..", versionbuf, subdir, assembly,
"dll");
}
else
{
! link = BuildPath(versionbuf, 0, 0, assembly, "dll");
}
! fullLink = BuildPath(cache, versionbuf, subdir, assembly,
"dll");
! path = BuildPath(cache, subdir, 0, assembly, "dll");
if(!force && ILFileExists(path, (char **)0))
{
--- 832,843 ----
if(subdir)
{
! link = BuildPath("..", versionbuf, subdir, assembly,
extension);
}
else
{
! link = BuildPath(versionbuf, 0, 0, assembly, extension);
}
! fullLink = BuildPath(cache, versionbuf, subdir, assembly,
extension);
! path = BuildPath(cache, subdir, 0, assembly, extension);
if(!force && ILFileExists(path, (char **)0))
{
***************
*** 836,844 ****
* Uninstall an assembly from the global cache.
*/
! static int uninstallAssembly(const char *assembly, const ILUInt16 *version)
{
char versionbuf[64];
char *path;
int error;
/* Get the name of the version sub-directory */
--- 883,893 ----
* Uninstall an assembly from the global cache.
*/
! static int uninstallAssembly(const char *assembly, const ILUInt16 *version,
! int imageType)
{
char versionbuf[64];
char *path;
int error;
+ const char *extension;
/* Get the name of the version sub-directory */
***************
*** 854,859 ****
}
/* Remove the main assembly instance */
! path = BuildPath(cache, versionbuf, subdir, assembly, "dll");
#ifndef IL_USE_SYMLINKS
if(!ILFileExists(path, (char **)0) && versionbuf[0] != '\0')
--- 903,918 ----
}
+ /* Determine the extension to use */
+ if(imageType == IL_IMAGETYPE_EXE)
+ {
+ extension = "exe";
+ }
+ else
+ {
+ extension = "dll";
+ }
+
/* Remove the main assembly instance */
! path = BuildPath(cache, versionbuf, subdir, assembly, extension);
#ifndef IL_USE_SYMLINKS
if(!ILFileExists(path, (char **)0) && versionbuf[0] != '\0')
***************
*** 861,869 ****
/* The assembly may have been installed as the default, so we
need to look at the default location and compare versions */
! char *path2 = BuildPath(cache, subdir, 0, assembly, "dll");
if(ILFileExists(path2, (char **)0))
{
ILUInt32 assemblyVersion[4];
! if(getAssemblyVersion(path2, assemblyVersion, 1))
{
if(version[0] == assemblyVersion[0] &&
--- 920,928 ----
/* The assembly may have been installed as the default, so we
need to look at the default location and compare versions */
! char *path2 = BuildPath(cache, subdir, 0, assembly, extension);
if(ILFileExists(path2, (char **)0))
{
ILUInt32 assemblyVersion[4];
! if(getAssemblyVersion(path2, assemblyVersion, 1, 0))
{
if(version[0] == assemblyVersion[0] &&
***************
*** 907,917 ****
if(subdir)
{
! link = BuildPath("..", versionbuf, subdir, assembly,
"dll");
}
else
{
! link = BuildPath(versionbuf, 0, 0, assembly, "dll");
}
! path = BuildPath(cache, subdir, 0, assembly, "dll");
len = readlink(path, contents, sizeof(contents) - 1);
if(len >= 0)
--- 966,976 ----
if(subdir)
{
! link = BuildPath("..", versionbuf, subdir, assembly,
extension);
}
else
{
! link = BuildPath(versionbuf, 0, 0, assembly, extension);
}
! path = BuildPath(cache, subdir, 0, assembly, extension);
len = readlink(path, contents, sizeof(contents) - 1);
if(len >= 0)
***************
*** 1080,1084 ****
else
{
! /* We are only interested in filenames that end in
".dll" */
len = strlen(name);
if(!(len > 4 && name[len - 4] == '.' &&
--- 1139,1143 ----
else
{
! /* We are only interested in files that end in ".dll"
or ".exe" */
len = strlen(name);
if(!(len > 4 && name[len - 4] == '.' &&
***************
*** 1087,1096 ****
(name[len - 1] == 'l' || name[len - 1] == 'L')))
{
! ILFree(combined);
! continue;
}
/* Retrieve the actual assembly version from the image
*/
! if(!getAssemblyVersion(combined, assemblyVersion, 0))
{
ILFree(combined);
--- 1146,1161 ----
(name[len - 1] == 'l' || name[len - 1] == 'L')))
{
! if(!(len > 4 && name[len - 4] == '.' &&
! (name[len - 3] == 'e' || name[len - 3] ==
'E') &&
! (name[len - 2] == 'x' || name[len - 2] ==
'X') &&
! (name[len - 1] == 'e' || name[len - 1] ==
'E')))
! {
! ILFree(combined);
! continue;
! }
}
/* Retrieve the actual assembly version from the image
*/
! if(!getAssemblyVersion(combined, assemblyVersion, 0, 0))
{
ILFree(combined);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/ilgac ilgac.c,1.1,1.2,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] pnet ChangeLog,1.2803,1.2804
- Next by Date:
[Dotgnu-pnet-commits] pnetlib/tools wrapper.sh.in, NONE, 1.1 .cvsignore, 1.3, 1.4
- Previous by thread:
[Dotgnu-pnet-commits] pnet ChangeLog,1.2803,1.2804
- Next by thread:
[Dotgnu-pnet-commits] pnetlib/tools wrapper.sh.in, NONE, 1.1 .cvsignore, 1.3, 1.4
- Index(es):