[packagekit] packagekit: Branch 'master' - 3 commits

Ken VanDine ken at vandine.org
Sat Sep 8 04:55:00 PDT 2007


Richard,

Did you IP address change again?  I can't pull again...

Thanks,
--Ken

On 9/7/07, Richard Hughes <hughsient at kemper.freedesktop.org> wrote:
>  configure.ac            |   36 +++++++++++++-----------------------
>  etc/Makefile.am         |    5 ++++-
>  src/Makefile.am         |    2 ++
>  src/pk-main.c           |   27 +++++++++++++++++----------
>  tools/backend-change.sh |    2 +-
>  5 files changed, 37 insertions(+), 35 deletions(-)
>
> New commits:
> diff-tree f91b89193b0a4603160257858a97c8dca6437cdc (from 8accd01eb434f743b8e2f1bb92aff70e207ac9d3)
> Author: Richard Hughes <richard at hughsie.com>
> Date:   Sat Sep 8 01:21:47 2007 +0100
>
>     get DefaultBackend from the config file
>
> diff --git a/configure.ac b/configure.ac
> index fec4f96..d326064 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -156,33 +156,29 @@ AC_SUBST(DBUS_SYS_DIR)
>  AC_SUBST(DBUS_SERVICES_DIR)
>
>  dnl ---------------------------------------------------------------------------
> -dnl - Compile time choice of backend
> +dnl - Compile time default choice of backend
>  dnl ---------------------------------------------------------------------------
>  AC_ARG_WITH([backend],
> -           AS_HELP_STRING([--with-backend=<option>],
> +           AS_HELP_STRING([--with-default-backend=<option>],
>                            [Default backend to use dummy,apt,yum,conary (dummy)]))
>  # default to a sane option for the installed tool
> -if test x$with_backend = x; then
> +if test x$with_default_backend = x; then
>      if test -f /usr/bin/yum ; then
> -        with_backend=yum
> +        with_default_backend=yum
>      elif test -f /usr/bin/apt-get ; then
> -        with_backend=apt
> +        with_default_backend=apt
>      elif test -f /usr/bin/conary ; then
> -        with_backend=conary
> +        with_default_backend=conary
>      elif test -f /usr/bin/box-repos ; then
> -        with_backend=box
> +        with_default_backend=box
>      else
> -        with_backend=dummy
> +        with_default_backend=dummy
>          AC_DEFINE(IGNORE_POLKIT, "err...", [if we should disable polkit])
>      fi
>  fi
>
> -# remove when we have the config file parsing working
> -AC_DEFINE(BACKEND_PREFIX, "$with_backend", [backend prefix])
> -AC_SUBST(BACKEND_PREFIX, "$with_backend")
> -
> -AC_DEFINE(DEFAULT_BACKEND, "$with_backend", [backend prefix])
> -AC_SUBST(DEFAULT_BACKEND, "$with_backend")
> +AC_DEFINE(DEFAULT_BACKEND, "$with_default_backend", [default backend prefix])
> +AC_SUBST(DEFAULT_BACKEND, "$with_default_backend")
>
>  AC_DEFUN([APT_BACKEND],
>  [
> @@ -348,6 +344,6 @@ echo "
>          datadir:                   ${datadir}
>          compiler:                  ${CC}
>          cflags:                    ${CFLAGS}
> -        Backend:                   ${with_backend}
> +        Default backend:           ${with_default_backend}
>  "
>
> diff --git a/src/pk-main.c b/src/pk-main.c
> index 020886b..b83ce01 100644
> --- a/src/pk-main.c
> +++ b/src/pk-main.c
> @@ -161,13 +161,6 @@ main (int argc, char *argv[])
>                 { NULL}
>         };
>
> -       if (backend == NULL) {
> -               backend = g_strdup (BACKEND_PREFIX);
> -               pk_debug ("using default backend %s", backend);
> -       } else {
> -               pk_debug ("trying to use backend %s", backend);
> -       }
> -
>         if (! g_thread_supported ()) {
>                 g_thread_init (NULL);
>         }
> @@ -209,11 +202,16 @@ main (int argc, char *argv[])
>          * 'it works from the command line but not service activation' bugs */
>         clearenv ();
>
> -       /* use the config file */
> +       /* get values from the config file */
>         conf = pk_conf_new ();
>         exit_idle_time = pk_conf_get_int (conf, "ShutdownTimeout");
>         pk_debug ("daemon shutdown set to %i seconds", exit_idle_time);
>
> +       if (backend == NULL) {
> +               backend = pk_conf_get_string (conf, "DefaultBackend");
> +               pk_debug ("using default backend %s", backend);
> +       }
> +
>         /* create a new engine object */
>         engine = pk_engine_new ();
>         pk_engine_use_backend (engine, backend);
> @@ -243,6 +241,7 @@ main (int argc, char *argv[])
>         g_main_loop_unref (loop);
>         g_object_unref (conf);
>         g_object_unref (engine);
> +       g_free (backend);
>
>  unref_program:
>         return 0;
> diff --git a/tools/backend-change.sh b/tools/backend-change.sh
> index 4c0338f..64f3705 100755
> --- a/tools/backend-change.sh
> +++ b/tools/backend-change.sh
> @@ -1,5 +1,5 @@
>  make clean
> -./autogen.sh --prefix=/home/hughsie/.root --with-backend=$1 --enable-tests
> +./autogen.sh --prefix=/home/hughsie/.root --with-default-backend=$1 --enable-tests
>  make
>  make install
>
> diff-tree 8accd01eb434f743b8e2f1bb92aff70e207ac9d3 (from 9c25389eb623f8a5f2be360e4c95c590cf7dd524)
> Author: Richard Hughes <richard at hughsie.com>
> Date:   Sat Sep 8 01:09:27 2007 +0100
>
>     Use ShutdownTimeout from the config file
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index da3a95e..5ecd794 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -44,6 +44,8 @@ packagekitd_SOURCES =                                 \
>         pk-backend-internal.h                           \
>         pk-backend.c                                    \
>         pk-backend.h                                    \
> +       pk-conf.c                                       \
> +       pk-conf.h                                       \
>         pk-spawn.c                                      \
>         pk-spawn.h                                      \
>         pk-engine.h                                     \
> diff --git a/src/pk-main.c b/src/pk-main.c
> index 5fa9c33..020886b 100644
> --- a/src/pk-main.c
> +++ b/src/pk-main.c
> @@ -31,10 +31,11 @@
>  #include <dbus/dbus-glib-lowlevel.h>
>
>  #include <pk-debug.h>
> +#include "pk-conf.h"
>  #include "pk-engine.h"
>  #include "pk-interface.h"
>
> -#define PK_MAIN_EXIT_IDLE_TIME 60 /* seconds */
> +static guint exit_idle_time;
>
>  /**
>   * pk_object_register:
> @@ -115,7 +116,7 @@ pk_main_timeout_check_cb (PkEngine *engi
>         guint idle;
>         idle = pk_engine_get_seconds_idle (engine);
>         pk_debug ("idle is %i", idle);
> -       if (idle > PK_MAIN_EXIT_IDLE_TIME) {
> +       if (idle > exit_idle_time) {
>                 pk_warning ("exit!!");
>                 exit (0);
>         }
> @@ -137,6 +138,7 @@ main (int argc, char *argv[])
>         gboolean timed_exit = FALSE;
>         gboolean immediate_exit = FALSE;
>         gchar *backend = NULL;
> +       PkConf *conf = NULL;
>         PkEngine *engine = NULL;
>         GError *error = NULL;
>         GOptionContext *context;
> @@ -207,6 +209,11 @@ main (int argc, char *argv[])
>          * 'it works from the command line but not service activation' bugs */
>         clearenv ();
>
> +       /* use the config file */
> +       conf = pk_conf_new ();
> +       exit_idle_time = pk_conf_get_int (conf, "ShutdownTimeout");
> +       pk_debug ("daemon shutdown set to %i seconds", exit_idle_time);
> +
>         /* create a new engine object */
>         engine = pk_engine_new ();
>         pk_engine_use_backend (engine, backend);
> @@ -225,7 +232,7 @@ main (int argc, char *argv[])
>         }
>
>         /* only poll every 10 seconds when we are alive */
> -       if (disable_timer == FALSE) {
> +       if (exit_idle_time != 0 && disable_timer == FALSE) {
>                 g_timeout_add_seconds (5, (GSourceFunc) pk_main_timeout_check_cb, engine);
>         }
>
> @@ -234,6 +241,7 @@ main (int argc, char *argv[])
>         }
>
>         g_main_loop_unref (loop);
> +       g_object_unref (conf);
>         g_object_unref (engine);
>
>  unref_program:
> diff-tree 9c25389eb623f8a5f2be360e4c95c590cf7dd524 (from a6523dedb467c945e5ac1189c658908c66fc80de)
> Author: Richard Hughes <richard at hughsie.com>
> Date:   Sat Sep 8 00:15:19 2007 +0100
>
>     make the default backend xonfigure bit work
>
> diff --git a/configure.ac b/configure.ac
> index 620573c..fec4f96 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -160,7 +160,7 @@ dnl - Compile time choice of backend
>  dnl ---------------------------------------------------------------------------
>  AC_ARG_WITH([backend],
>             AS_HELP_STRING([--with-backend=<option>],
> -                          [Backend to use dummy,apt,yum,conary (dummy)]))
> +                          [Default backend to use dummy,apt,yum,conary (dummy)]))
>  # default to a sane option for the installed tool
>  if test x$with_backend = x; then
>      if test -f /usr/bin/yum ; then
> @@ -173,22 +173,16 @@ if test x$with_backend = x; then
>          with_backend=box
>      else
>          with_backend=dummy
> +        AC_DEFINE(IGNORE_POLKIT, "err...", [if we should disable polkit])
>      fi
>  fi
>
> -# we need this for the spawn code
> -if test x$with_backend = xyum; then
> -    AC_DEFINE(BACKEND_PREFIX, "yum", [backend prefix])
> -elif test x$with_backend = xapt; then
> -    AC_DEFINE(BACKEND_PREFIX, "apt", [backend prefix])
> -elif test x$with_backend = xconary; then
> -    AC_DEFINE(BACKEND_PREFIX, "conary", [backend prefix])
> -elif test x$with_backend = xbox; then
> -    AC_DEFINE(BACKEND_PREFIX, "box", [backend prefix])
> -else
> -    AC_DEFINE(IGNORE_POLKIT, "err...", [if we should disable polkit])
> -    AC_DEFINE(BACKEND_PREFIX, "dummy", [backend prefix])
> -fi
> +# remove when we have the config file parsing working
> +AC_DEFINE(BACKEND_PREFIX, "$with_backend", [backend prefix])
> +AC_SUBST(BACKEND_PREFIX, "$with_backend")
> +
> +AC_DEFINE(DEFAULT_BACKEND, "$with_backend", [backend prefix])
> +AC_SUBST(DEFAULT_BACKEND, "$with_backend")
>
>  AC_DEFUN([APT_BACKEND],
>  [
> diff --git a/etc/Makefile.am b/etc/Makefile.am
> index ba80a91..7a6d86d 100644
> --- a/etc/Makefile.am
> +++ b/etc/Makefile.am
> @@ -5,9 +5,12 @@ conf_in_files = PackageKit.conf.in
>  conf_DATA = $(conf_in_files:.conf.in=.conf)
>
>  $(conf_DATA): $(conf_in_files) Makefile
> -       @sed -e "s|\@defaultbackend\@|BACKEND_PREFIX|" $< > $@
> +       @sed -e "s|\@defaultbackend\@|$(DEFAULT_BACKEND)|" $< > $@
>
>  EXTRA_DIST =                                           \
>         $(conf_in_files)                                \
>         $(NULL)
>
> +DISTCLEANFILES =                                       \
> +       PackageKit.conf
> +
> _______________________________________________
> PackageKit mailing list
> PackageKit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/packagekit
>


-- 
Ken VanDine
http://ken.vandine.org



More information about the PackageKit mailing list