Re: libdebian-installer - introduced changes
[Bastian Blank]
> di_log and di_logf prototypes was source compatible.
>
> the decision is, change 5 packages in the one direction or 5 in the
> other.
I do not quite follow you here. What do you mean?
But in any case, I believe strongly that it is a good idea to _always_
rename functions when their prototype change, and would very much like
this to happen in the new libdebian-installer.
I suggest renaming the new di_log() to di_logmsg() (and the new
di_logv() to di_logmsgv() or something similar), and perhaps make
wrappers using the old name. I include a patch to do that.
I suggest doing the same for the other functions changing the
prototype as well. I did not quite understand which one that is based
on your summary.
And I still believe it would be nice if you could make a small
document in CVS listing the changes done in libd-i, and the packages
affected, so the people willing to assist in this transition do not
have to search through the mailing list, but can look at a document in
CVS.
Index: include/debian-installer/log.h
===================================================================
RCS file: /cvs/debian-boot/debian-installer/libdebian-installer/include/debian-installer/log.h,v
retrieving revision 1.2
diff -u -3 -p -u -r1.2 log.h
--- include/debian-installer/log.h 29 Sep 2003 14:08:48 -0000 1.2
+++ include/debian-installer/log.h 2 Oct 2003 21:57:42 -0000
@@ -58,8 +58,11 @@ typedef void di_log_handler (di_log_leve
*/
#define di_warning(format...) di_log (DI_LOG_LEVEL_WARNING, format)
-void di_log (di_log_level_flags log_level, const char *format, ...) __attribute__ ((format(printf,2,3)));
-void di_logv (di_log_level_flags log_level, const char *format, va_list args);
+void di_logmsg (di_log_level_flags log_level, const char *format, ...) __attribute__ ((format(printf,2,3)));
+void di_logmsgv (di_log_level_flags log_level, const char *format, va_list args);
+
+void di_log (const char *msg);
+void di_logf (const char *format, ...);
unsigned int di_log_set_handler (di_log_level_flags log_levels, di_log_handler *log_func, void *user_data);
Index: src/exec.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/libdebian-installer/src/exec.c,v
retrieving revision 1.6
diff -u -3 -p -u -r1.6 exec.c
--- src/exec.c 2 Oct 2003 14:27:06 -0000 1.6
+++ src/exec.c 2 Oct 2003 21:57:42 -0000
@@ -77,7 +77,7 @@ int di_exec_full (const char *path, cons
}
else if (pid < 0)
{
- di_log (DI_LOG_LEVEL_WARNING, "fork failed");
+ di_logmsg (DI_LOG_LEVEL_WARNING, "fork failed");
return -1;
}
else
@@ -182,7 +182,7 @@ int di_exec_prepare_chroot (pid_t pid __
*/
int di_exec_io_log (const char *buf, size_t len __attribute__ ((unused)), void *user_data __attribute__ ((unused)))
{
- di_log (DI_LOG_LEVEL_OUTPUT, buf);
+ di_logmsg (DI_LOG_LEVEL_OUTPUT, "%s", buf);
return 0;
}
Index: src/log.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/libdebian-installer/src/log.c,v
retrieving revision 1.4
diff -u -3 -p -u -r1.4 log.c
--- src/log.c 30 Sep 2003 19:22:07 -0000 1.4
+++ src/log.c 2 Oct 2003 21:57:42 -0000
@@ -197,16 +197,16 @@ unsigned int di_log_set_handler (di_log_
return handler_id;
}
-void di_log (di_log_level_flags log_level, const char *format, ...)
+void di_logmsg (di_log_level_flags log_level, const char *format, ...)
{
va_list args;
va_start (args, format);
- di_logv (log_level, format, args);
+ di_logmsgv (log_level, format, args);
va_end (args);
}
-void di_logv (di_log_level_flags log_level, const char *format, va_list args)
+void di_logmsgv (di_log_level_flags log_level, const char *format, va_list args) {
char buf[1024];
int fatal = log_level & DI_LOG_FATAL_MASK;
@@ -223,3 +223,15 @@ void di_logv (di_log_level_flags log_lev
exit (1);
}
+void di_log(const char *msg)
+{
+ di_logmsg(DI_LOG_LEVEL_WARNING, "%s", msg);
+}
+
+void di_logf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start (ap, fmt);
+ di_logmsgv (DI_LOG_LEVEL_WARNING, format, ap);
+ va_end(ap);
+}
Index: src/packages.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/libdebian-installer/src/packages.c,v retrieving revision 1.7
diff -u -3 -p -u -r1.7 packages.c
--- src/packages.c 30 Sep 2003 19:22:07 -0000 1.7
+++ src/packages.c 2 Oct 2003 21:57:43 -0000
@@ -170,7 +170,7 @@ static void resolve_dependencies_recurse
switch (package->type)
{
case di_package_type_real_package:
- di_log (DI_LOG_LEVEL_DEBUG, "consider package %s on %p\n", package->package, package);
+ di_logmsg (DI_LOG_LEVEL_DEBUG, "consider package %s on %p\n", package->package, package);
for (node = package->depends.head; node; node = node->next)
{
di_package_dependency *d = node->data;
@@ -179,14 +179,14 @@ static void resolve_dependencies_recurse
{
#if 1
if (!shutup && package->priority > d->ptr->priority)
- di_log (DI_LOG_LEVEL_INFO, "broken dependency: %s to %s", package->package, d->ptr->package);
+ di_logmsg (DI_LOG_LEVEL_INFO, "broken dependency: %s to %s", package->package, d->ptr->package);
#endif
resolve_dependencies_recurse (install, d->ptr, package, allocator, resolver, shutup);
}
}
if (dependend_package)
- di_log (DI_LOG_LEVEL_DEBUG, "install %s, dependency from %s", package->package, dependend_package->package);
+ di_logmsg (DI_LOG_LEVEL_DEBUG, "install %s, dependency from %s", package->package, dependend_package->package);
if (install)
di_slist_append_chunk (install, package, allocator->slist_node_mem_chunk);
@@ -212,12 +212,12 @@ static void resolve_dependencies_recurse
resolve_dependencies_recurse (install, best_provide, package, allocator, resolver, shutup);
if (dependend_package && best_provide)
- di_log (DI_LOG_LEVEL_DEBUG, "search for package resolving %s, dependency from %s", package->package, dependend_package->package);
+ di_logmsg (DI_LOG_LEVEL_DEBUG, "search for package resolving %s, dependency from %s", package->package, dependend_package->package);
break;
case di_package_type_non_existent:
if (!shutup)
- di_log (DI_LOG_LEVEL_WARNING, "package %s don't exists", package->package);
+ di_logmsg (DI_LOG_LEVEL_WARNING, "package %s don't exists", package->package);
break;
}
}
Reply to: