Port to razor 0.5.4 0.4.2
authorJ. Ali Harlow <ali@juiblex.co.uk>
Tue, 21 Feb 2012 22:55:40 +0000 (22:55 +0000)
committerJ. Ali Harlow <ali@juiblex.co.uk>
Tue, 21 Feb 2012 22:55:40 +0000 (22:55 +0000)
configure.ac
plover-gtk/packageset.c
plover/import-yum.c
plover/plover.h
plover/razor.c
setup/resources.rc.in
update/resources.rc.in

index 03a93e4..562f842 100644 (file)
@@ -1,7 +1,7 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([plover],[0.4.1],[ali@juiblex.co.uk])
+AC_INIT([plover],[0.4.2],[ali@juiblex.co.uk])
 AC_PREREQ(2.59)
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_SRCDIR([plover/plover.h])
@@ -54,7 +54,7 @@ AC_SUBST(HOST_CPU,$host_cpu)
 #   increment CURRENT and set AGE and REVISION to 0.
 # - If the interface is the same as the previous version, increment REVISION.
 #
-lt_current=1
+lt_current=2
 lt_revision=0
 lt_age=0
 LIBPLOVER_LT_VERSION_INFO="$lt_current:$lt_revision:$lt_age"
@@ -93,7 +93,7 @@ AC_CHECK_HEADERS([winhttp.h],[],[],
 ##################################################
 # Checks for libraries.
 ##################################################
-PKG_CHECK_MODULES(RAZOR,[razor >= 0.5],[:],[RAZOR_LIBS=-lrazor])
+PKG_CHECK_MODULES(RAZOR,[razor >= 0.5.4],[:],[RAZOR_LIBS=-lrazor])
 PKG_CHECK_MODULES(EXPAT,[expat],[:],[EXPAT_LIBS=-lexpat])
 PKG_CHECK_MODULES(ZLIB,[zlib],[:],[ZLIB_LIBS=-lz])
 PKG_CHECK_MODULES(GIO,[gio-2.0])
@@ -117,7 +117,7 @@ PKG_CHECK_MODULES(SETUP,[whelk])
 PKG_CONFIG="$save_PKG_CONFIG"
 save_LIBS="$LIBS"
 AC_SEARCH_LIBS([crypt],[crypt])
-SETUP_LIBS="$SETUP_LIBS $RAZOR_LIBS -llua-posix $LIBS"
+SETUP_LIBS="-llua-posix $SETUP_LIBS $RAZOR_LIBS $LIBS"
 SETUP_CFLAGS="$SETUP_CFLAGS $RAZOR_CFLAGS"
 AC_SUBST(SETUP_LIBS)
 AC_SUBST(SETUP_CFLAGS)
index ea8881c..e310641 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010, 2011  J. Ali Harlow <ali@juiblex.co.uk>
+ * Copyright (C) 2010-2012  J. Ali Harlow <ali@juiblex.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -32,7 +32,6 @@
 G_DEFINE_TYPE(PloverPackageSet,plover_package_set,G_TYPE_OBJECT);
 
 typedef struct _PloverPackageSetPrivate {
-    struct razor_atomic *atomic;
     struct razor_root *root;
     struct razor_set *set;
     GSList *packages;
@@ -56,8 +55,6 @@ static void plover_package_set_finalize(GObject *obj)
     PloverPackageSetPrivate *priv=PLOVER_PACKAGE_SET_GET_PRIVATE(obj);
     if (priv->root)
        razor_root_close(priv->root);
-    if (priv->atomic)
-       razor_atomic_destroy(priv->atomic);
     if (G_OBJECT_CLASS(plover_package_set_parent_class)->finalize)
        G_OBJECT_CLASS(plover_package_set_parent_class)->finalize(obj);
 }
@@ -102,14 +99,15 @@ PloverPackageSet *plover_package_set_new_from_installed(const char *root,
 {
     PloverPackageSet *set;
     PloverPackageSetPrivate *priv;
+    struct razor_error *error=NULL;
     set=plover_package_set_new();
     priv=PLOVER_PACKAGE_SET_GET_PRIVATE(set);
-    priv->atomic=razor_atomic_open("Read root package set");
-    priv->root=razor_root_open(root,priv->atomic);
+    priv->root=razor_root_open(root,&error);
     if (!priv->root)
     {
-       g_set_error(err,PLOVER_RAZOR_ERROR,PLOVER_RAZOR_ERROR_FAILED,
-         "Failed to open %s as razor root",root);
+       g_set_error_literal(err,PLOVER_RAZOR_ERROR,PLOVER_RAZOR_ERROR_FAILED,
+         razor_error_get_msg(error));
+       razor_error_free(error);
        g_object_unref(set);
        return NULL;
     }
@@ -135,7 +133,7 @@ PloverPackageSet *plover_package_set_new_from_repository(const char *base,
 #endif
     gchar *s;
     struct razor_set *reloc;
-    struct razor_atomic *atomic;
+    struct razor_error *error=NULL;
     PloverPackageSet *set;
     PloverPackageSetPrivate *priv;
     set=plover_package_set_new();
@@ -176,14 +174,12 @@ PloverPackageSet *plover_package_set_new_from_repository(const char *base,
 #endif
     if (priv->set && relocations)
     {
-       atomic=razor_atomic_open("Relocate packages");
-       reloc=plover_relocate_packages(priv->set,atomic,base,relocations);
-       if (!reloc)
-           g_set_error(err,PLOVER_RAZOR_ERROR,PLOVER_RAZOR_ERROR_FAILED,
-             razor_atomic_get_error_msg(atomic));
-       razor_atomic_destroy(atomic);
+       reloc=plover_relocate_packages(priv->set,base,relocations,&error);
        if (!reloc)
        {
+           g_set_error_literal(err,PLOVER_RAZOR_ERROR,
+             PLOVER_RAZOR_ERROR_FAILED,razor_error_get_msg(error));
+           razor_error_free(error);
            g_object_unref(set);
            return NULL;
        }
index 73634e2..7ef59fc 100644 (file)
@@ -183,11 +183,7 @@ yum_primary_start_element(void *data, const char *name, const char **atts)
                        else if (strcmp(atts[i], "flags") == 0)
                                relation = yum_to_razor_relation(atts[i + 1]);
                        else if (strcmp(atts[i], "pre") == 0)
-                               pre =
-                                       RAZOR_PROPERTY_PRE |
-                                       RAZOR_PROPERTY_POST |
-                                       RAZOR_PROPERTY_PREUN |
-                                       RAZOR_PROPERTY_POSTUN;
+                               pre = RAZOR_PROPERTY_PRE;
                }
 
                if (n == NULL) {
index f2e4293..f2ae8db 100644 (file)
@@ -40,14 +40,14 @@ char *plover_get_program_directory(const char *argv0);
 struct razor_set *plover_razor_set_create_from_yum(const char *base);
 
 struct razor_set *plover_relocate_packages(struct razor_set *set,
-  struct razor_atomic *atomic,const char *base,
-  struct razor_relocations *relocations);
+  const char *base,struct razor_relocations *relocations,
+  struct razor_error **error);
 int plover_run_transaction(struct razor_transaction *trans,
   struct razor_install_iterator *ii,const char *base,const char *install_root,
   struct razor_set *system,struct razor_set *next,struct razor_atomic *atomic,
   struct razor_relocations *relocations,enum razor_stage_type stage);
 int plover_commit_transaction(struct razor_transaction *trans,const char *base,
-  const char *install_root,struct razor_root *root,struct razor_atomic *atomic,
+  const char *install_root,struct razor_root *root,
   struct razor_relocations *relocations);
 int plover_install(const char *base,const char *prefix,char **pkgs);
 int plover_update(const char *base,const char *prefix,char **pkgs);
index 772d36b..9e93d2e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2008  Kristian Høgsberg <krh@redhat.com>
  * Copyright (C) 2008  Red Hat, Inc
- * Copyright (C) 2009, 2011  J. Ali Harlow <ali@juiblex.co.uk>
+ * Copyright (C) 2009, 2011, 2012  J. Ali Harlow <ali@juiblex.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -39,8 +39,8 @@ static char *rpm_filename(const char *name,const char *version,const char *arch)
 }
 
 struct razor_set *plover_relocate_packages(struct razor_set *set,
-  struct razor_atomic *atomic,const char *base,
-  struct razor_relocations *relocations)
+  const char *base,struct razor_relocations *relocations,
+  struct razor_error **error)
 {
     struct razor_importer *importer;
     struct razor_property_iterator *prop_iter;
@@ -63,7 +63,7 @@ struct razor_set *plover_relocate_packages(struct razor_set *set,
        s=rpm_filename(name,version,arch);
        file=plover_strconcat(base,"/rpms/",s,NULL);
        free(s);
-       rpm=razor_rpm_open(file,atomic);
+       rpm=razor_rpm_open(file,error);
        free(file);
        if (!rpm)
        {
@@ -96,6 +96,10 @@ struct razor_set *plover_relocate_packages(struct razor_set *set,
     return new;
 }
 
+/*
+ * Returns 0 on success, -1 on failure and 1 if a RAZOR_INSTALL_ACTION_COMMIT
+ * is met (in which case the action is consumed).
+ */
 int plover_run_transaction(struct razor_transaction *trans,
   struct razor_install_iterator *ii,const char *base,const char *install_root,
   struct razor_set *system,struct razor_set *next,struct razor_atomic *atomic,
@@ -104,10 +108,10 @@ int plover_run_transaction(struct razor_transaction *trans,
     struct razor_package *package;
     enum razor_install_action action;
     struct razor_rpm *rpm;
+    struct razor_error *error=NULL;
     const char *name,*version,*arch;
     char *s,*file;
-    int count;
-    razor_install_iterator_rewind(ii);
+    int r,count;
     switch(stage)
     {
        case RAZOR_STAGE_SCRIPTS_PRE:
@@ -131,12 +135,12 @@ int plover_run_transaction(struct razor_transaction *trans,
              RAZOR_DETAIL_LAST);
            if (stage==RAZOR_STAGE_FILES)
                printf("  Removing : %s ",name);
-           razor_package_remove(system,next,atomic,package,install_root,
+           r=razor_package_remove(system,next,atomic,package,install_root,
              count,stage);
            if (stage==RAZOR_STAGE_FILES)
                printf("\n");
        }
-       else
+       else if (action==RAZOR_INSTALL_ACTION_ADD)
        {
            razor_package_get_details(next,package,RAZOR_DETAIL_NAME,&name,
              RAZOR_DETAIL_VERSION,&version,RAZOR_DETAIL_ARCH,&arch,
@@ -144,56 +148,102 @@ int plover_run_transaction(struct razor_transaction *trans,
            s=rpm_filename(name,version,arch);
            file=plover_strconcat(base,"/rpms/",s,NULL);
            free(s);
-           rpm=razor_rpm_open(file,atomic);
+           rpm=razor_rpm_open(file,&error);
            free(file);
            if (!rpm)
+           {
+               razor_atomic_abort(atomic,razor_error_get_msg(error));
+               razor_error_free(error);
                return -1;
+           }
            if (stage==RAZOR_STAGE_FILES)
                printf("  Installing : %s ",name);
            if (relocations)
                razor_rpm_set_relocations(rpm,relocations);
            razor_transaction_fixup_package(trans,package,rpm);
-           razor_rpm_install(rpm,atomic,install_root,1,stage);
+           r=razor_rpm_install(rpm,atomic,install_root,1,stage);
            razor_rpm_close(rpm);
            if (stage==RAZOR_STAGE_FILES)
                printf("\n");
        }
+       else if (action==RAZOR_INSTALL_ACTION_COMMIT)
+           return 1;
+       else
+           r=0;
        if (razor_atomic_in_error_state(atomic))
            return -1;
+       else if (r)
+       {
+           razor_package_get_details(next,package,RAZOR_DETAIL_NAME,&name,
+             RAZOR_DETAIL_VERSION,&version,RAZOR_DETAIL_ARCH,&arch,
+             RAZOR_DETAIL_LAST);
+           /*
+            * If a pre or preun script fails, then we should
+            * treat that as a fatal error. post and postun
+            * script failures are treated as warnings. Be
+            * nice and tell the user _which_ script failed.
+            */
+           fprintf(stderr,
+             "%s: %s(%s-%s.%s) scriptlet failed, exit status %d\n",
+             stage==RAZOR_STAGE_SCRIPTS_PRE?"error":"warning",
+             action==RAZOR_INSTALL_ACTION_ADD?"%pre":"%preun",
+             name,version,arch,r);
+           if (stage==RAZOR_STAGE_SCRIPTS_PRE)
+               return -1;
+       }
     }
     return 0;
 }
 
-/*
- * Note: plover_commit_transaction() takes ownership of root which should
- * not be used after it returns.
- */
 int plover_commit_transaction(struct razor_transaction *trans,const char *base,
-  const char *install_root,struct razor_root *root,struct razor_atomic *atomic,
+  const char *install_root,struct razor_root *root,
   struct razor_relocations *relocations)
 {
-    int retval;
-    struct razor_set *next,*system;
+    int r,retval;
+    size_t pos;
+    struct razor_set *system,*next,*set;
     struct razor_install_iterator *ii;
+    struct razor_atomic *atomic;
     razor_transaction_resolve(trans);
     if (razor_transaction_describe(trans)>0)
-    {
-       razor_root_close(root);
        return -1;
-    }
     next=razor_transaction_commit(trans);
-    system=razor_root_get_system_set(root);
+    system=razor_set_ref(razor_root_get_system_set(root));
     ii=razor_set_create_install_iterator(system,next);
-    plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
-      relocations,RAZOR_STAGE_SCRIPTS_PRE);
-    plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
-      relocations,RAZOR_STAGE_FILES);
-    razor_root_update(root,next);
-    razor_root_commit(root);
-    retval=razor_atomic_commit(atomic);
-    if (!retval)
-       plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
-         relocations,RAZOR_STAGE_SCRIPTS_POST);
+    do
+    {
+       pos=razor_install_iterator_tell(ii);
+       atomic=razor_atomic_open("package transaction");
+       r=plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
+         relocations,RAZOR_STAGE_SCRIPTS_PRE);
+       if (r<0)
+           fprintf(stderr,"Transaction aborted\n");
+       else
+       {
+           razor_install_iterator_seek(ii,pos);
+           r=plover_run_transaction(trans,ii,base,install_root,system,next,
+             atomic,relocations,RAZOR_STAGE_FILES);
+           if (r==1)
+           {
+               set=razor_install_iterator_commit_set(ii);
+               razor_root_update(root,set,atomic);
+               razor_set_unref(set);
+           }
+           else if (!r)
+               razor_root_update(root,next,atomic);
+           retval=razor_atomic_commit(atomic);
+           if (retval)
+               fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
+           else
+           {
+               razor_install_iterator_seek(ii,pos);
+               plover_run_transaction(trans,ii,base,install_root,system,next,
+                 atomic,relocations,RAZOR_STAGE_SCRIPTS_POST);
+           }
+       }
+       razor_atomic_destroy(atomic);
+    } while(!retval && r==1);
+    razor_set_unref(system);
     razor_set_unref(next);
     razor_install_iterator_destroy(ii);
     return retval;
@@ -226,11 +276,11 @@ int plover_install(const char *base,const char *prefix,char **pkgs)
     int i,retval;
     char *s;
     char *install_root;
-    struct razor_root *root;
     struct razor_set *system,*set,*upstream;
     struct razor_transaction *trans;
     struct razor_relocations *relocations;
-    struct razor_atomic *atomic;
+    struct razor_root *root;
+    struct razor_error *error=NULL;
     install_root=getenv("RAZOR_ROOT");
     if (!install_root)
        install_root="";
@@ -241,37 +291,23 @@ int plover_install(const char *base,const char *prefix,char **pkgs)
     }
     else
        relocations=NULL;
-    atomic=razor_atomic_open("Install packages");
-    /*
-     * Calling razor_root_open() on a system that hasn't yet had
-     * razor_root_create() run generates a confusing error message
-     * on stderr. Avoid this by trying to open it R/O first which
-     * fails without generating any error.
-     */
-    set=razor_root_open_read_only(install_root,atomic);
-    if (set)
-       razor_set_unref(set);
-    else
-       razor_root_create(install_root);
-    root=razor_root_open(install_root,atomic);
+    root=razor_root_open(install_root,NULL);
     if (!root)
     {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_atomic_destroy(atomic);
-       if (relocations)
-           razor_relocations_destroy(relocations);
-       return -1;
+       if (razor_root_create(install_root,&error))
+           root=NULL;
+       else
+           root=razor_root_open(install_root,&error);
+       if (!root)
+       {
+           fprintf(stderr,"%s\n",razor_error_get_msg(error));
+           razor_error_free(error);
+           if (relocations)
+               razor_relocations_destroy(relocations);
+           return -1;
+       }
     }
     system=razor_root_get_system_set(root);
-    if (!system)
-    {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_root_close(root);
-       razor_atomic_destroy(atomic);
-       if (relocations)
-           razor_relocations_destroy(relocations);
-       return -1;
-    }
     s=plover_strconcat(base,"/repodata",NULL);
     if (s)
     {
@@ -280,13 +316,14 @@ int plover_install(const char *base,const char *prefix,char **pkgs)
            perror(s);
     }
     else
+    {
+       fprintf(stderr,"Not enough memory\n");
        retval=-1;
+    }
     free(s);
     if (retval<0)
     {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
        razor_root_close(root);
-       razor_atomic_destroy(atomic);
        if (relocations)
            razor_relocations_destroy(relocations);
        return -1;
@@ -294,16 +331,19 @@ int plover_install(const char *base,const char *prefix,char **pkgs)
     set=plover_razor_set_create_from_yum(base);
     if (set)
     {
-       upstream=plover_relocate_packages(set,atomic,base,relocations);
+       upstream=plover_relocate_packages(set,base,relocations,&error);
+       if (!upstream)
+       {
+           fprintf(stderr,"%s\n",razor_error_get_msg(error));
+           razor_error_free(error);
+       }
        razor_set_unref(set);
     }
     else
        upstream=NULL;
     if (!upstream)
     {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
        razor_root_close(root);
-       razor_atomic_destroy(atomic);
        if (relocations)
            razor_relocations_destroy(relocations);
        return -1;
@@ -319,16 +359,10 @@ int plover_install(const char *base,const char *prefix,char **pkgs)
            break;
        }
     if (!retval)
-    {
-       retval=plover_commit_transaction(trans,base,install_root,root,atomic,
+       retval=plover_commit_transaction(trans,base,install_root,root,
          relocations);
-       if (retval)
-           fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-    }
-    else
-       razor_root_close(root);
     razor_transaction_destroy(trans);
-    razor_atomic_destroy(atomic);
+    razor_root_close(root);
     if (relocations)
        razor_relocations_destroy(relocations);
     return retval;
@@ -338,11 +372,11 @@ int plover_update(const char *base,const char *prefix,char **pkgs)
 {
     int i,retval;
     char *install_root,*s;
-    struct razor_root *root;
     struct razor_set *system,*set,*upstream;
     struct razor_transaction *trans;
     struct razor_relocations *relocations;
-    struct razor_atomic *atomic;
+    struct razor_root *root;
+    struct razor_error *error=NULL;
     install_root=getenv("RAZOR_ROOT");
     if (!install_root)
        install_root="";
@@ -353,36 +387,16 @@ int plover_update(const char *base,const char *prefix,char **pkgs)
     }
     else
        relocations=NULL;
-    atomic=razor_atomic_open("Update packages");
-    set=razor_root_open_read_only(install_root,atomic);
-    if (!set)
-    {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_atomic_destroy(atomic);
-       if (relocations)
-           razor_relocations_destroy(relocations);
-       return 0;
-    }
-    razor_set_unref(set);
-    root=razor_root_open(install_root,atomic);
+    root=razor_root_open(install_root,&error);
     if (!root)
     {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_atomic_destroy(atomic);
+       fprintf(stderr,"%s\n",razor_error_get_msg(error));
+       razor_error_free(error);
        if (relocations)
            razor_relocations_destroy(relocations);
-       return -1;
+       return 0;
     }
     system=razor_root_get_system_set(root);
-    if (!system)
-    {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_root_close(root);
-       razor_atomic_destroy(atomic);
-       if (relocations)
-           razor_relocations_destroy(relocations);
-       return -1;
-    }
     s=plover_strconcat(base,"/repodata",NULL);
     if (s)
     {
@@ -391,13 +405,14 @@ int plover_update(const char *base,const char *prefix,char **pkgs)
            perror(s);
     }
     else
+    {
+       fprintf(stderr,"Not enough memory");
        retval=-1;
+    }
     free(s);
     if (retval)
     {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
        razor_root_close(root);
-       razor_atomic_destroy(atomic);
        if (relocations)
            razor_relocations_destroy(relocations);
        return -1;
@@ -405,16 +420,19 @@ int plover_update(const char *base,const char *prefix,char **pkgs)
     set=plover_razor_set_create_from_yum(base);
     if (set)
     {
-       upstream=plover_relocate_packages(set,atomic,base,relocations);
+       upstream=plover_relocate_packages(set,base,relocations,&error);
+       if (!upstream)
+       {
+           fprintf(stderr,"%s\n",razor_error_get_msg(error));
+           razor_error_free(error);
+       }
        razor_set_unref(set);
     }
     else
        upstream=NULL;
     if (!upstream)
     {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
        razor_root_close(root);
-       razor_atomic_destroy(atomic);
        if (relocations)
            razor_relocations_destroy(relocations);
        return -1;
@@ -433,18 +451,13 @@ int plover_update(const char *base,const char *prefix,char **pkgs)
        }
     else
        razor_transaction_update_all(trans);
-    if (!retval) {
-       retval=plover_commit_transaction(trans,base,install_root,root,atomic,
+    if (!retval)
+       retval=plover_commit_transaction(trans,base,install_root,root,
          relocations);
-       if (retval)
-           fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-    }
-    else
-       razor_root_close(root);
     razor_transaction_destroy(trans);
+    razor_root_close(root);
     if (relocations)
        razor_relocations_destroy(relocations);
-    razor_atomic_destroy(atomic);
     return retval;
 }
 
@@ -473,37 +486,21 @@ int plover_remove(char **pkgs)
 {
     int i,retval=0;
     char *install_root;
-    struct razor_root *root;
     struct razor_set *system,*set,*upstream;
     struct razor_transaction *trans;
-    struct razor_atomic *atomic;
+    struct razor_root *root;
+    struct razor_error *error=NULL;
     install_root=getenv("RAZOR_ROOT");
     if (!install_root)
        install_root="";
-    atomic=razor_atomic_open("Remove packages");
-    set=razor_root_open_read_only(install_root,atomic);
-    if (!set)
-    {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_atomic_destroy(atomic);
-       return 0;
-    }
-    razor_set_unref(set);
-    root=razor_root_open(install_root,atomic);
+    root=razor_root_open(install_root,&error);
     if (!root)
     {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_atomic_destroy(atomic);
-       return -1;
+       fprintf(stderr,"%s\n",razor_error_get_msg(error));
+       razor_error_free(error);
+       return 0;
     }
     system=razor_root_get_system_set(root);
-    if (!system)
-    {
-       fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-       razor_root_close(root);
-       razor_atomic_destroy(atomic);
-       return -1;
-    }
     upstream=razor_set_create_without_root();
     trans=razor_transaction_create(system,upstream);
     razor_set_unref(upstream);
@@ -520,16 +517,9 @@ int plover_remove(char **pkgs)
     else
        plover_mark_packages_for_removal(trans,system,NULL);
     if (!retval)
-    {
-       retval=
-         plover_commit_transaction(trans,NULL,install_root,root,atomic,NULL);
-       if (retval)
-           fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
-    }
-    else
-       razor_root_close(root);
+       retval=plover_commit_transaction(trans,NULL,install_root,root,NULL);
     razor_transaction_destroy(trans);
-    razor_atomic_destroy(atomic);
+    razor_root_close(root);
     return retval;
 }
 
@@ -543,7 +533,6 @@ int plover_installed_files_match_prefix(const char *prefix)
     const char *name;
     char *install_root;
     struct razor_set *set;
-    struct razor_atomic *atomic;
     struct razor_package *package;
     struct razor_package_iterator *pi;
     struct razor_file_iterator *fi;
@@ -553,8 +542,7 @@ int plover_installed_files_match_prefix(const char *prefix)
     install_root=getenv("RAZOR_ROOT");
     if (!install_root)
        install_root="";
-    atomic=razor_atomic_open("Query packages");
-    set=razor_root_open_read_only(install_root,atomic);
+    set=razor_root_open_read_only(install_root,NULL);
     if (set)
     {
        pi=razor_package_iterator_create(set);
@@ -573,6 +561,5 @@ int plover_installed_files_match_prefix(const char *prefix)
        razor_package_iterator_destroy(pi);
        razor_set_unref(set);
     }
-    razor_atomic_destroy(atomic);
     return matches;
 }
index edf67c0..ce69c18 100644 (file)
@@ -20,7 +20,7 @@ VS_VERSION_INFO VERSIONINFO
                VALUE "FileVersion","@PACKAGE_VERSION@"
                VALUE "InternalName","setup"
                VALUE "LegalCopyright",
-                 "Copyright (c) 2009,2011 J. Ali Harlow et al"
+                 "Copyright (c) 2009,2011,2012 J. Ali Harlow et al"
                VALUE "OriginalFilename","setup.exe"
                VALUE "ProductName","plover"
                VALUE "ProductVersion","@PACKAGE_VERSION@"
index 9313b10..aa0e5a8 100644 (file)
@@ -20,7 +20,7 @@ VS_VERSION_INFO VERSIONINFO
                VALUE "FileVersion","@PACKAGE_VERSION@"
                VALUE "InternalName","update"
                VALUE "LegalCopyright",
-                 "Copyright (c) 2009,2011 J. Ali Harlow et al"
+                 "Copyright (c) 2009,2011,2012 J. Ali Harlow et al"
                VALUE "OriginalFilename","update.exe"
                VALUE "ProductName","plover"
                VALUE "ProductVersion","@PACKAGE_VERSION@"