Fixed the packages struct so that rpm names are no longer hardcoded and added

the archive type.  Added a test option to do dry runs with nothing actually
being installed.
This commit is contained in:
J Shane Culpepper 2000-04-19 23:09:10 +00:00
parent f1614ccd12
commit 24ef8c77df
6 changed files with 41 additions and 21 deletions

View file

@ -1,3 +1,14 @@
2000-04-19 Shane Culpepper <pepper@eazel.com>
* components/services/install/eazel-install-lib-xml.c
* components/services/install/eazel-install-lib-debug.c
* components/services/install/eazel-install-lib-rpm.c
* components/services/install/eazel-install-lib.h
* components/services/install/eazel-install.c
Tweaked the packages struct so that rpm names are no longer
hardcoded. Added a the option to do dry runs without actually
installing anything. Good for testing.
2000-04-19 John Sullivan <sullivan@eazel.com>
* libnautilus-extensions/nautilus-icon-container.c:

View file

@ -77,11 +77,11 @@ dump_install_options (InstallOptions* iopts) {
void
dump_package_list (PackageData* pkg) {
g_print ("***Begin pkg dump***\n");
g_print ("rpm_name = %s\n", pkg->rpm_name);
g_print ("name = %s\n", pkg->name);
g_print ("summary = %s\n", pkg->summary);
g_print ("version = %s\n", pkg->version);
g_print ("srcfile = %d\n", pkg->srcfile);
g_print ("minor = %s\n", pkg->minor);
g_print ("archtype = %s\n", pkg->archtype);
g_print ("bytesize = %d\n", pkg->bytesize);
g_print ("summary = %s\n", pkg->summary);
g_print ("***End pkg dump***\n");
} /* end dump_package_list */

View file

@ -79,7 +79,11 @@ install_new_packages (InstallOptions* iopts) {
retval = 0;
tmpbuf = g_strdup_printf ("%s/%s", iopts->rpm_storage_dir, pack->rpm_name);
tmpbuf = g_strdup_printf ("%s/%s-%s-%s.%s.rpm", iopts->rpm_storage_dir,
pack->name,
pack->version,
pack->minor,
pack->archtype);
pkg[0] = tmpbuf;
pkg[1] = NULL;
g_print ("Installing %s\n", pack->summary);
@ -144,7 +148,10 @@ uninstall_packages (InstallOptions* iopts) {
retval = 0;
tmpbuf = g_strdup_printf ("%s/%s", iopts->rpm_storage_dir, pack->rpm_name);
tmpbuf = g_strdup_printf ("%s/%s-%s-%s", iopts->rpm_storage_dir,
pack->name,
pack->version,
pack->minor);
pkg[0] = tmpbuf;
pkg[1] = NULL;
g_print ("Uninstalling %s\n", pack->summary);

View file

@ -180,22 +180,15 @@ parse_package (xmlNode* package) {
xmlNode* dep;
PackageData* rv;
char* tmp;
rv = g_new0 (PackageData, 1);
rv->rpm_name = g_strdup (xml_get_value (package, "RPM_NAME"));
rv->name = g_strdup (xml_get_value (package, "NAME"));
rv->summary = g_strdup (xml_get_value (package, "SUMMARY"));
rv->version = g_strdup (xml_get_value (package, "VERSION"));
tmp = xml_get_value (package, "SOURCE");
if (tmp[0] == 't' || tmp[0] == 'T') {
rv->srcfile = TRUE;
}
else if (tmp[0] == 'f' || tmp[0] == 'F') {
rv->srcfile = FALSE;
}
rv->minor = g_strdup (xml_get_value (package, "MINOR"));
rv->archtype = g_strdup (xml_get_value (package, "ARCH"));
rv->bytesize = atoi (xml_get_value (package, "BYTESIZE"));
rv->summary = g_strdup (xml_get_value (package, "SUMMARY"));
/* Dependency Lists */
rv->SoftDepends = NULL;
@ -223,7 +216,6 @@ parse_package (xmlNode* package) {
/* For debugging only
dump_package_list (rv);
*/
g_free(tmp);
return rv;
} /* end parse package */

View file

@ -82,12 +82,12 @@ struct _CategoryData {
};
struct _PackageData {
char* rpm_name;
char* name;
char* summary;
char* version;
gboolean srcfile;
char* minor;
char* archtype;
int bytesize;
char* summary;
GList* SoftDepends;
GList* HardDepends;
};

View file

@ -39,6 +39,7 @@ show_usage (int exitcode, char* error) {
" -l --local : use local file\n"
" -w --http : use http\n"
" -f --ftp : use ftp\n"
" -t --test : dry run - don't actually install\n"
" -u --uninstall : uninstall the package list\n");
if (error) {
@ -77,7 +78,7 @@ int
main (int argc, char* argv[]) {
char opt;
gboolean retval;
gboolean USE_LOCAL, USE_HTTP, USE_FTP, UNINSTALL_MODE;
gboolean USE_LOCAL, USE_HTTP, USE_FTP, UNINSTALL_MODE, TEST_MODE;
InstallOptions *iopts;
poptContext pctx;
char* config_file;
@ -88,6 +89,7 @@ main (int argc, char* argv[]) {
{ "local", 'l', 0, NULL, 'l'},
{ "http", 'w', 0, NULL, 'w' },
{ "ftp", 'f', 0, NULL, 'f' },
{ "test", 't', 0, NULL, 't' },
{ "uninstall", 'u', 0, NULL, 'u' },
{ NULL, '\0', 0, NULL, 0 }
};
@ -96,6 +98,7 @@ main (int argc, char* argv[]) {
USE_LOCAL = FALSE;
USE_HTTP = FALSE;
USE_FTP = FALSE;
TEST_MODE = FALSE;
UNINSTALL_MODE = FALSE;
config_file = g_strdup ("/etc/eazel/services/eazel-services-config.xml");
@ -123,6 +126,9 @@ main (int argc, char* argv[]) {
case 'f':
USE_FTP = TRUE;
break;
case 't':
TEST_MODE = TRUE;
break;
case 'u':
UNINSTALL_MODE = TRUE;
break;
@ -175,6 +181,10 @@ main (int argc, char* argv[]) {
exit (1);
}
if (TEST_MODE == TRUE) {
iopts->mode_test = TRUE;
}
if (UNINSTALL_MODE == TRUE) {
iopts->mode_uninstall = TRUE;