Port to razor 0.5.4 0.4.2
authorJ. Ali Harlow <ali@juiblex.co.uk>
Tue Feb 21 22:55:40 2012 +0000 (2012-02-21)
changeset 195cafc65a6183
parent 17 43df682785f5
child 20 ab5fda3263bf
child 21 4da45725031f
Port to razor 0.5.4
configure.ac
plover-gtk/packageset.c
plover/import-yum.c
plover/plover.h
plover/razor.c
setup/resources.rc.in
update/resources.rc.in
     1.1 --- a/configure.ac	Mon Jan 30 13:35:28 2012 +0000
     1.2 +++ b/configure.ac	Tue Feb 21 22:55:40 2012 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  #                                               -*- Autoconf -*-
     1.5  # Process this file with autoconf to produce a configure script.
     1.6  
     1.7 -AC_INIT([plover],[0.4.1],[ali@juiblex.co.uk])
     1.8 +AC_INIT([plover],[0.4.2],[ali@juiblex.co.uk])
     1.9  AC_PREREQ(2.59)
    1.10  AC_CONFIG_AUX_DIR([config])
    1.11  AC_CONFIG_SRCDIR([plover/plover.h])
    1.12 @@ -54,7 +54,7 @@
    1.13  #   increment CURRENT and set AGE and REVISION to 0.
    1.14  # - If the interface is the same as the previous version, increment REVISION.
    1.15  #
    1.16 -lt_current=1
    1.17 +lt_current=2
    1.18  lt_revision=0
    1.19  lt_age=0
    1.20  LIBPLOVER_LT_VERSION_INFO="$lt_current:$lt_revision:$lt_age"
    1.21 @@ -93,7 +93,7 @@
    1.22  ##################################################
    1.23  # Checks for libraries.
    1.24  ##################################################
    1.25 -PKG_CHECK_MODULES(RAZOR,[razor >= 0.5],[:],[RAZOR_LIBS=-lrazor])
    1.26 +PKG_CHECK_MODULES(RAZOR,[razor >= 0.5.4],[:],[RAZOR_LIBS=-lrazor])
    1.27  PKG_CHECK_MODULES(EXPAT,[expat],[:],[EXPAT_LIBS=-lexpat])
    1.28  PKG_CHECK_MODULES(ZLIB,[zlib],[:],[ZLIB_LIBS=-lz])
    1.29  PKG_CHECK_MODULES(GIO,[gio-2.0])
    1.30 @@ -117,7 +117,7 @@
    1.31  PKG_CONFIG="$save_PKG_CONFIG"
    1.32  save_LIBS="$LIBS"
    1.33  AC_SEARCH_LIBS([crypt],[crypt])
    1.34 -SETUP_LIBS="$SETUP_LIBS $RAZOR_LIBS -llua-posix $LIBS"
    1.35 +SETUP_LIBS="-llua-posix $SETUP_LIBS $RAZOR_LIBS $LIBS"
    1.36  SETUP_CFLAGS="$SETUP_CFLAGS $RAZOR_CFLAGS"
    1.37  AC_SUBST(SETUP_LIBS)
    1.38  AC_SUBST(SETUP_CFLAGS)
     2.1 --- a/plover-gtk/packageset.c	Mon Jan 30 13:35:28 2012 +0000
     2.2 +++ b/plover-gtk/packageset.c	Tue Feb 21 22:55:40 2012 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (C) 2010, 2011  J. Ali Harlow <ali@juiblex.co.uk>
     2.6 + * Copyright (C) 2010-2012  J. Ali Harlow <ali@juiblex.co.uk>
     2.7   *
     2.8   * This program is free software; you can redistribute it and/or modify
     2.9   * it under the terms of the GNU General Public License as published by
    2.10 @@ -32,7 +32,6 @@
    2.11  G_DEFINE_TYPE(PloverPackageSet,plover_package_set,G_TYPE_OBJECT);
    2.12  
    2.13  typedef struct _PloverPackageSetPrivate {
    2.14 -    struct razor_atomic *atomic;
    2.15      struct razor_root *root;
    2.16      struct razor_set *set;
    2.17      GSList *packages;
    2.18 @@ -56,8 +55,6 @@
    2.19      PloverPackageSetPrivate *priv=PLOVER_PACKAGE_SET_GET_PRIVATE(obj);
    2.20      if (priv->root)
    2.21  	razor_root_close(priv->root);
    2.22 -    if (priv->atomic)
    2.23 -	razor_atomic_destroy(priv->atomic);
    2.24      if (G_OBJECT_CLASS(plover_package_set_parent_class)->finalize)
    2.25  	G_OBJECT_CLASS(plover_package_set_parent_class)->finalize(obj);
    2.26  }
    2.27 @@ -102,14 +99,15 @@
    2.28  {
    2.29      PloverPackageSet *set;
    2.30      PloverPackageSetPrivate *priv;
    2.31 +    struct razor_error *error=NULL;
    2.32      set=plover_package_set_new();
    2.33      priv=PLOVER_PACKAGE_SET_GET_PRIVATE(set);
    2.34 -    priv->atomic=razor_atomic_open("Read root package set");
    2.35 -    priv->root=razor_root_open(root,priv->atomic);
    2.36 +    priv->root=razor_root_open(root,&error);
    2.37      if (!priv->root)
    2.38      {
    2.39 -	g_set_error(err,PLOVER_RAZOR_ERROR,PLOVER_RAZOR_ERROR_FAILED,
    2.40 -	  "Failed to open %s as razor root",root);
    2.41 +	g_set_error_literal(err,PLOVER_RAZOR_ERROR,PLOVER_RAZOR_ERROR_FAILED,
    2.42 +	  razor_error_get_msg(error));
    2.43 +	razor_error_free(error);
    2.44  	g_object_unref(set);
    2.45  	return NULL;
    2.46      }
    2.47 @@ -135,7 +133,7 @@
    2.48  #endif
    2.49      gchar *s;
    2.50      struct razor_set *reloc;
    2.51 -    struct razor_atomic *atomic;
    2.52 +    struct razor_error *error=NULL;
    2.53      PloverPackageSet *set;
    2.54      PloverPackageSetPrivate *priv;
    2.55      set=plover_package_set_new();
    2.56 @@ -176,14 +174,12 @@
    2.57  #endif
    2.58      if (priv->set && relocations)
    2.59      {
    2.60 -	atomic=razor_atomic_open("Relocate packages");
    2.61 -	reloc=plover_relocate_packages(priv->set,atomic,base,relocations);
    2.62 -	if (!reloc)
    2.63 -	    g_set_error(err,PLOVER_RAZOR_ERROR,PLOVER_RAZOR_ERROR_FAILED,
    2.64 -	      razor_atomic_get_error_msg(atomic));
    2.65 -	razor_atomic_destroy(atomic);
    2.66 +	reloc=plover_relocate_packages(priv->set,base,relocations,&error);
    2.67  	if (!reloc)
    2.68  	{
    2.69 +	    g_set_error_literal(err,PLOVER_RAZOR_ERROR,
    2.70 +	      PLOVER_RAZOR_ERROR_FAILED,razor_error_get_msg(error));
    2.71 +	    razor_error_free(error);
    2.72  	    g_object_unref(set);
    2.73  	    return NULL;
    2.74  	}
     3.1 --- a/plover/import-yum.c	Mon Jan 30 13:35:28 2012 +0000
     3.2 +++ b/plover/import-yum.c	Tue Feb 21 22:55:40 2012 +0000
     3.3 @@ -183,11 +183,7 @@
     3.4  			else if (strcmp(atts[i], "flags") == 0)
     3.5  				relation = yum_to_razor_relation(atts[i + 1]);
     3.6  			else if (strcmp(atts[i], "pre") == 0)
     3.7 -				pre =
     3.8 -					RAZOR_PROPERTY_PRE |
     3.9 -					RAZOR_PROPERTY_POST |
    3.10 -					RAZOR_PROPERTY_PREUN |
    3.11 -					RAZOR_PROPERTY_POSTUN;
    3.12 +				pre = RAZOR_PROPERTY_PRE;
    3.13  		}
    3.14  
    3.15  		if (n == NULL) {
     4.1 --- a/plover/plover.h	Mon Jan 30 13:35:28 2012 +0000
     4.2 +++ b/plover/plover.h	Tue Feb 21 22:55:40 2012 +0000
     4.3 @@ -40,14 +40,14 @@
     4.4  struct razor_set *plover_razor_set_create_from_yum(const char *base);
     4.5  
     4.6  struct razor_set *plover_relocate_packages(struct razor_set *set,
     4.7 -  struct razor_atomic *atomic,const char *base,
     4.8 -  struct razor_relocations *relocations);
     4.9 +  const char *base,struct razor_relocations *relocations,
    4.10 +  struct razor_error **error);
    4.11  int plover_run_transaction(struct razor_transaction *trans,
    4.12    struct razor_install_iterator *ii,const char *base,const char *install_root,
    4.13    struct razor_set *system,struct razor_set *next,struct razor_atomic *atomic,
    4.14    struct razor_relocations *relocations,enum razor_stage_type stage);
    4.15  int plover_commit_transaction(struct razor_transaction *trans,const char *base,
    4.16 -  const char *install_root,struct razor_root *root,struct razor_atomic *atomic,
    4.17 +  const char *install_root,struct razor_root *root,
    4.18    struct razor_relocations *relocations);
    4.19  int plover_install(const char *base,const char *prefix,char **pkgs);
    4.20  int plover_update(const char *base,const char *prefix,char **pkgs);
     5.1 --- a/plover/razor.c	Mon Jan 30 13:35:28 2012 +0000
     5.2 +++ b/plover/razor.c	Tue Feb 21 22:55:40 2012 +0000
     5.3 @@ -1,7 +1,7 @@
     5.4  /*
     5.5   * Copyright (C) 2008  Kristian Høgsberg <krh@redhat.com>
     5.6   * Copyright (C) 2008  Red Hat, Inc
     5.7 - * Copyright (C) 2009, 2011  J. Ali Harlow <ali@juiblex.co.uk>
     5.8 + * Copyright (C) 2009, 2011, 2012  J. Ali Harlow <ali@juiblex.co.uk>
     5.9   *
    5.10   * This program is free software; you can redistribute it and/or modify
    5.11   * it under the terms of the GNU General Public License as published by
    5.12 @@ -39,8 +39,8 @@
    5.13  }
    5.14  
    5.15  struct razor_set *plover_relocate_packages(struct razor_set *set,
    5.16 -  struct razor_atomic *atomic,const char *base,
    5.17 -  struct razor_relocations *relocations)
    5.18 +  const char *base,struct razor_relocations *relocations,
    5.19 +  struct razor_error **error)
    5.20  {
    5.21      struct razor_importer *importer;
    5.22      struct razor_property_iterator *prop_iter;
    5.23 @@ -63,7 +63,7 @@
    5.24  	s=rpm_filename(name,version,arch);
    5.25  	file=plover_strconcat(base,"/rpms/",s,NULL);
    5.26  	free(s);
    5.27 -	rpm=razor_rpm_open(file,atomic);
    5.28 +	rpm=razor_rpm_open(file,error);
    5.29  	free(file);
    5.30  	if (!rpm)
    5.31  	{
    5.32 @@ -96,6 +96,10 @@
    5.33      return new;
    5.34  }
    5.35  
    5.36 +/*
    5.37 + * Returns 0 on success, -1 on failure and 1 if a RAZOR_INSTALL_ACTION_COMMIT
    5.38 + * is met (in which case the action is consumed).
    5.39 + */
    5.40  int plover_run_transaction(struct razor_transaction *trans,
    5.41    struct razor_install_iterator *ii,const char *base,const char *install_root,
    5.42    struct razor_set *system,struct razor_set *next,struct razor_atomic *atomic,
    5.43 @@ -104,10 +108,10 @@
    5.44      struct razor_package *package;
    5.45      enum razor_install_action action;
    5.46      struct razor_rpm *rpm;
    5.47 +    struct razor_error *error=NULL;
    5.48      const char *name,*version,*arch;
    5.49      char *s,*file;
    5.50 -    int count;
    5.51 -    razor_install_iterator_rewind(ii);
    5.52 +    int r,count;
    5.53      switch(stage)
    5.54      {
    5.55  	case RAZOR_STAGE_SCRIPTS_PRE:
    5.56 @@ -131,12 +135,12 @@
    5.57  	      RAZOR_DETAIL_LAST);
    5.58  	    if (stage==RAZOR_STAGE_FILES)
    5.59  		printf("  Removing : %s ",name);
    5.60 -	    razor_package_remove(system,next,atomic,package,install_root,
    5.61 +	    r=razor_package_remove(system,next,atomic,package,install_root,
    5.62  	      count,stage);
    5.63  	    if (stage==RAZOR_STAGE_FILES)
    5.64  		printf("\n");
    5.65  	}
    5.66 -	else
    5.67 +	else if (action==RAZOR_INSTALL_ACTION_ADD)
    5.68  	{
    5.69  	    razor_package_get_details(next,package,RAZOR_DETAIL_NAME,&name,
    5.70  	      RAZOR_DETAIL_VERSION,&version,RAZOR_DETAIL_ARCH,&arch,
    5.71 @@ -144,56 +148,102 @@
    5.72  	    s=rpm_filename(name,version,arch);
    5.73  	    file=plover_strconcat(base,"/rpms/",s,NULL);
    5.74  	    free(s);
    5.75 -	    rpm=razor_rpm_open(file,atomic);
    5.76 +	    rpm=razor_rpm_open(file,&error);
    5.77  	    free(file);
    5.78  	    if (!rpm)
    5.79 +	    {
    5.80 +		razor_atomic_abort(atomic,razor_error_get_msg(error));
    5.81 +		razor_error_free(error);
    5.82  		return -1;
    5.83 +	    }
    5.84  	    if (stage==RAZOR_STAGE_FILES)
    5.85  		printf("  Installing : %s ",name);
    5.86  	    if (relocations)
    5.87  		razor_rpm_set_relocations(rpm,relocations);
    5.88  	    razor_transaction_fixup_package(trans,package,rpm);
    5.89 -	    razor_rpm_install(rpm,atomic,install_root,1,stage);
    5.90 +	    r=razor_rpm_install(rpm,atomic,install_root,1,stage);
    5.91  	    razor_rpm_close(rpm);
    5.92  	    if (stage==RAZOR_STAGE_FILES)
    5.93  		printf("\n");
    5.94  	}
    5.95 +	else if (action==RAZOR_INSTALL_ACTION_COMMIT)
    5.96 +	    return 1;
    5.97 +	else
    5.98 +	    r=0;
    5.99  	if (razor_atomic_in_error_state(atomic))
   5.100  	    return -1;
   5.101 +	else if (r)
   5.102 +	{
   5.103 +	    razor_package_get_details(next,package,RAZOR_DETAIL_NAME,&name,
   5.104 +	      RAZOR_DETAIL_VERSION,&version,RAZOR_DETAIL_ARCH,&arch,
   5.105 +	      RAZOR_DETAIL_LAST);
   5.106 +	    /*
   5.107 +	     * If a pre or preun script fails, then we should
   5.108 +	     * treat that as a fatal error. post and postun
   5.109 +	     * script failures are treated as warnings. Be
   5.110 +	     * nice and tell the user _which_ script failed.
   5.111 +	     */
   5.112 +	    fprintf(stderr,
   5.113 +	      "%s: %s(%s-%s.%s) scriptlet failed, exit status %d\n",
   5.114 +	      stage==RAZOR_STAGE_SCRIPTS_PRE?"error":"warning",
   5.115 +	      action==RAZOR_INSTALL_ACTION_ADD?"%pre":"%preun",
   5.116 +	      name,version,arch,r);
   5.117 +	    if (stage==RAZOR_STAGE_SCRIPTS_PRE)
   5.118 +		return -1;
   5.119 +	}
   5.120      }
   5.121      return 0;
   5.122  }
   5.123  
   5.124 -/*
   5.125 - * Note: plover_commit_transaction() takes ownership of root which should
   5.126 - * not be used after it returns.
   5.127 - */
   5.128  int plover_commit_transaction(struct razor_transaction *trans,const char *base,
   5.129 -  const char *install_root,struct razor_root *root,struct razor_atomic *atomic,
   5.130 +  const char *install_root,struct razor_root *root,
   5.131    struct razor_relocations *relocations)
   5.132  {
   5.133 -    int retval;
   5.134 -    struct razor_set *next,*system;
   5.135 +    int r,retval;
   5.136 +    size_t pos;
   5.137 +    struct razor_set *system,*next,*set;
   5.138      struct razor_install_iterator *ii;
   5.139 +    struct razor_atomic *atomic;
   5.140      razor_transaction_resolve(trans);
   5.141      if (razor_transaction_describe(trans)>0)
   5.142 +	return -1;
   5.143 +    next=razor_transaction_commit(trans);
   5.144 +    system=razor_set_ref(razor_root_get_system_set(root));
   5.145 +    ii=razor_set_create_install_iterator(system,next);
   5.146 +    do
   5.147      {
   5.148 -	razor_root_close(root);
   5.149 -	return -1;
   5.150 -    }
   5.151 -    next=razor_transaction_commit(trans);
   5.152 -    system=razor_root_get_system_set(root);
   5.153 -    ii=razor_set_create_install_iterator(system,next);
   5.154 -    plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
   5.155 -      relocations,RAZOR_STAGE_SCRIPTS_PRE);
   5.156 -    plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
   5.157 -      relocations,RAZOR_STAGE_FILES);
   5.158 -    razor_root_update(root,next);
   5.159 -    razor_root_commit(root);
   5.160 -    retval=razor_atomic_commit(atomic);
   5.161 -    if (!retval)
   5.162 -	plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
   5.163 -	  relocations,RAZOR_STAGE_SCRIPTS_POST);
   5.164 +	pos=razor_install_iterator_tell(ii);
   5.165 +	atomic=razor_atomic_open("package transaction");
   5.166 +	r=plover_run_transaction(trans,ii,base,install_root,system,next,atomic,
   5.167 +	  relocations,RAZOR_STAGE_SCRIPTS_PRE);
   5.168 +	if (r<0)
   5.169 +	    fprintf(stderr,"Transaction aborted\n");
   5.170 +	else
   5.171 +	{
   5.172 +	    razor_install_iterator_seek(ii,pos);
   5.173 +	    r=plover_run_transaction(trans,ii,base,install_root,system,next,
   5.174 +	      atomic,relocations,RAZOR_STAGE_FILES);
   5.175 +	    if (r==1)
   5.176 +	    {
   5.177 +		set=razor_install_iterator_commit_set(ii);
   5.178 +		razor_root_update(root,set,atomic);
   5.179 +		razor_set_unref(set);
   5.180 +	    }
   5.181 +	    else if (!r)
   5.182 +		razor_root_update(root,next,atomic);
   5.183 +	    retval=razor_atomic_commit(atomic);
   5.184 +	    if (retval)
   5.185 +		fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.186 +	    else
   5.187 +	    {
   5.188 +		razor_install_iterator_seek(ii,pos);
   5.189 +		plover_run_transaction(trans,ii,base,install_root,system,next,
   5.190 +		  atomic,relocations,RAZOR_STAGE_SCRIPTS_POST);
   5.191 +	    }
   5.192 +	}
   5.193 +	razor_atomic_destroy(atomic);
   5.194 +    } while(!retval && r==1);
   5.195 +    razor_set_unref(system);
   5.196      razor_set_unref(next);
   5.197      razor_install_iterator_destroy(ii);
   5.198      return retval;
   5.199 @@ -226,11 +276,11 @@
   5.200      int i,retval;
   5.201      char *s;
   5.202      char *install_root;
   5.203 -    struct razor_root *root;
   5.204      struct razor_set *system,*set,*upstream;
   5.205      struct razor_transaction *trans;
   5.206      struct razor_relocations *relocations;
   5.207 -    struct razor_atomic *atomic;
   5.208 +    struct razor_root *root;
   5.209 +    struct razor_error *error=NULL;
   5.210      install_root=getenv("RAZOR_ROOT");
   5.211      if (!install_root)
   5.212  	install_root="";
   5.213 @@ -241,37 +291,23 @@
   5.214      }
   5.215      else
   5.216  	relocations=NULL;
   5.217 -    atomic=razor_atomic_open("Install packages");
   5.218 -    /*
   5.219 -     * Calling razor_root_open() on a system that hasn't yet had
   5.220 -     * razor_root_create() run generates a confusing error message
   5.221 -     * on stderr. Avoid this by trying to open it R/O first which
   5.222 -     * fails without generating any error.
   5.223 -     */
   5.224 -    set=razor_root_open_read_only(install_root,atomic);
   5.225 -    if (set)
   5.226 -	razor_set_unref(set);
   5.227 -    else
   5.228 -	razor_root_create(install_root);
   5.229 -    root=razor_root_open(install_root,atomic);
   5.230 +    root=razor_root_open(install_root,NULL);
   5.231      if (!root)
   5.232      {
   5.233 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.234 -	razor_atomic_destroy(atomic);
   5.235 -	if (relocations)
   5.236 -	    razor_relocations_destroy(relocations);
   5.237 -	return -1;
   5.238 +	if (razor_root_create(install_root,&error))
   5.239 +	    root=NULL;
   5.240 +	else
   5.241 +	    root=razor_root_open(install_root,&error);
   5.242 +	if (!root)
   5.243 +	{
   5.244 +	    fprintf(stderr,"%s\n",razor_error_get_msg(error));
   5.245 +	    razor_error_free(error);
   5.246 +	    if (relocations)
   5.247 +		razor_relocations_destroy(relocations);
   5.248 +	    return -1;
   5.249 +	}
   5.250      }
   5.251      system=razor_root_get_system_set(root);
   5.252 -    if (!system)
   5.253 -    {
   5.254 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.255 -	razor_root_close(root);
   5.256 -	razor_atomic_destroy(atomic);
   5.257 -	if (relocations)
   5.258 -	    razor_relocations_destroy(relocations);
   5.259 -	return -1;
   5.260 -    }
   5.261      s=plover_strconcat(base,"/repodata",NULL);
   5.262      if (s)
   5.263      {
   5.264 @@ -280,13 +316,14 @@
   5.265  	    perror(s);
   5.266      }
   5.267      else
   5.268 +    {
   5.269 +	fprintf(stderr,"Not enough memory\n");
   5.270  	retval=-1;
   5.271 +    }
   5.272      free(s);
   5.273      if (retval<0)
   5.274      {
   5.275 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.276  	razor_root_close(root);
   5.277 -	razor_atomic_destroy(atomic);
   5.278  	if (relocations)
   5.279  	    razor_relocations_destroy(relocations);
   5.280  	return -1;
   5.281 @@ -294,16 +331,19 @@
   5.282      set=plover_razor_set_create_from_yum(base);
   5.283      if (set)
   5.284      {
   5.285 -	upstream=plover_relocate_packages(set,atomic,base,relocations);
   5.286 +	upstream=plover_relocate_packages(set,base,relocations,&error);
   5.287 +	if (!upstream)
   5.288 +	{
   5.289 +	    fprintf(stderr,"%s\n",razor_error_get_msg(error));
   5.290 +	    razor_error_free(error);
   5.291 +	}
   5.292  	razor_set_unref(set);
   5.293      }
   5.294      else
   5.295  	upstream=NULL;
   5.296      if (!upstream)
   5.297      {
   5.298 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.299  	razor_root_close(root);
   5.300 -	razor_atomic_destroy(atomic);
   5.301  	if (relocations)
   5.302  	    razor_relocations_destroy(relocations);
   5.303  	return -1;
   5.304 @@ -319,16 +359,10 @@
   5.305  	    break;
   5.306  	}
   5.307      if (!retval)
   5.308 -    {
   5.309 -	retval=plover_commit_transaction(trans,base,install_root,root,atomic,
   5.310 +	retval=plover_commit_transaction(trans,base,install_root,root,
   5.311  	  relocations);
   5.312 -	if (retval)
   5.313 -	    fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.314 -    }
   5.315 -    else
   5.316 -	razor_root_close(root);
   5.317      razor_transaction_destroy(trans);
   5.318 -    razor_atomic_destroy(atomic);
   5.319 +    razor_root_close(root);
   5.320      if (relocations)
   5.321  	razor_relocations_destroy(relocations);
   5.322      return retval;
   5.323 @@ -338,11 +372,11 @@
   5.324  {
   5.325      int i,retval;
   5.326      char *install_root,*s;
   5.327 -    struct razor_root *root;
   5.328      struct razor_set *system,*set,*upstream;
   5.329      struct razor_transaction *trans;
   5.330      struct razor_relocations *relocations;
   5.331 -    struct razor_atomic *atomic;
   5.332 +    struct razor_root *root;
   5.333 +    struct razor_error *error=NULL;
   5.334      install_root=getenv("RAZOR_ROOT");
   5.335      if (!install_root)
   5.336  	install_root="";
   5.337 @@ -353,36 +387,16 @@
   5.338      }
   5.339      else
   5.340  	relocations=NULL;
   5.341 -    atomic=razor_atomic_open("Update packages");
   5.342 -    set=razor_root_open_read_only(install_root,atomic);
   5.343 -    if (!set)
   5.344 +    root=razor_root_open(install_root,&error);
   5.345 +    if (!root)
   5.346      {
   5.347 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.348 -	razor_atomic_destroy(atomic);
   5.349 +	fprintf(stderr,"%s\n",razor_error_get_msg(error));
   5.350 +	razor_error_free(error);
   5.351  	if (relocations)
   5.352  	    razor_relocations_destroy(relocations);
   5.353  	return 0;
   5.354      }
   5.355 -    razor_set_unref(set);
   5.356 -    root=razor_root_open(install_root,atomic);
   5.357 -    if (!root)
   5.358 -    {
   5.359 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.360 -	razor_atomic_destroy(atomic);
   5.361 -	if (relocations)
   5.362 -	    razor_relocations_destroy(relocations);
   5.363 -	return -1;
   5.364 -    }
   5.365      system=razor_root_get_system_set(root);
   5.366 -    if (!system)
   5.367 -    {
   5.368 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.369 -	razor_root_close(root);
   5.370 -	razor_atomic_destroy(atomic);
   5.371 -	if (relocations)
   5.372 -	    razor_relocations_destroy(relocations);
   5.373 -	return -1;
   5.374 -    }
   5.375      s=plover_strconcat(base,"/repodata",NULL);
   5.376      if (s)
   5.377      {
   5.378 @@ -391,13 +405,14 @@
   5.379  	    perror(s);
   5.380      }
   5.381      else
   5.382 +    {
   5.383 +	fprintf(stderr,"Not enough memory");
   5.384  	retval=-1;
   5.385 +    }
   5.386      free(s);
   5.387      if (retval)
   5.388      {
   5.389 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.390  	razor_root_close(root);
   5.391 -	razor_atomic_destroy(atomic);
   5.392  	if (relocations)
   5.393  	    razor_relocations_destroy(relocations);
   5.394  	return -1;
   5.395 @@ -405,16 +420,19 @@
   5.396      set=plover_razor_set_create_from_yum(base);
   5.397      if (set)
   5.398      {
   5.399 -	upstream=plover_relocate_packages(set,atomic,base,relocations);
   5.400 +	upstream=plover_relocate_packages(set,base,relocations,&error);
   5.401 +	if (!upstream)
   5.402 +	{
   5.403 +	    fprintf(stderr,"%s\n",razor_error_get_msg(error));
   5.404 +	    razor_error_free(error);
   5.405 +	}
   5.406  	razor_set_unref(set);
   5.407      }
   5.408      else
   5.409  	upstream=NULL;
   5.410      if (!upstream)
   5.411      {
   5.412 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.413  	razor_root_close(root);
   5.414 -	razor_atomic_destroy(atomic);
   5.415  	if (relocations)
   5.416  	    razor_relocations_destroy(relocations);
   5.417  	return -1;
   5.418 @@ -433,18 +451,13 @@
   5.419  	}
   5.420      else
   5.421  	razor_transaction_update_all(trans);
   5.422 -    if (!retval) {
   5.423 -	retval=plover_commit_transaction(trans,base,install_root,root,atomic,
   5.424 +    if (!retval)
   5.425 +	retval=plover_commit_transaction(trans,base,install_root,root,
   5.426  	  relocations);
   5.427 -	if (retval)
   5.428 -	    fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.429 -    }
   5.430 -    else
   5.431 -	razor_root_close(root);
   5.432      razor_transaction_destroy(trans);
   5.433 +    razor_root_close(root);
   5.434      if (relocations)
   5.435  	razor_relocations_destroy(relocations);
   5.436 -    razor_atomic_destroy(atomic);
   5.437      return retval;
   5.438  }
   5.439  
   5.440 @@ -473,37 +486,21 @@
   5.441  {
   5.442      int i,retval=0;
   5.443      char *install_root;
   5.444 -    struct razor_root *root;
   5.445      struct razor_set *system,*set,*upstream;
   5.446      struct razor_transaction *trans;
   5.447 -    struct razor_atomic *atomic;
   5.448 +    struct razor_root *root;
   5.449 +    struct razor_error *error=NULL;
   5.450      install_root=getenv("RAZOR_ROOT");
   5.451      if (!install_root)
   5.452  	install_root="";
   5.453 -    atomic=razor_atomic_open("Remove packages");
   5.454 -    set=razor_root_open_read_only(install_root,atomic);
   5.455 -    if (!set)
   5.456 +    root=razor_root_open(install_root,&error);
   5.457 +    if (!root)
   5.458      {
   5.459 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.460 -	razor_atomic_destroy(atomic);
   5.461 +	fprintf(stderr,"%s\n",razor_error_get_msg(error));
   5.462 +	razor_error_free(error);
   5.463  	return 0;
   5.464      }
   5.465 -    razor_set_unref(set);
   5.466 -    root=razor_root_open(install_root,atomic);
   5.467 -    if (!root)
   5.468 -    {
   5.469 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.470 -	razor_atomic_destroy(atomic);
   5.471 -	return -1;
   5.472 -    }
   5.473      system=razor_root_get_system_set(root);
   5.474 -    if (!system)
   5.475 -    {
   5.476 -	fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.477 -	razor_root_close(root);
   5.478 -	razor_atomic_destroy(atomic);
   5.479 -	return -1;
   5.480 -    }
   5.481      upstream=razor_set_create_without_root();
   5.482      trans=razor_transaction_create(system,upstream);
   5.483      razor_set_unref(upstream);
   5.484 @@ -520,16 +517,9 @@
   5.485      else
   5.486  	plover_mark_packages_for_removal(trans,system,NULL);
   5.487      if (!retval)
   5.488 -    {
   5.489 -	retval=
   5.490 -	  plover_commit_transaction(trans,NULL,install_root,root,atomic,NULL);
   5.491 -	if (retval)
   5.492 -	    fprintf(stderr,"%s\n",razor_atomic_get_error_msg(atomic));
   5.493 -    }
   5.494 -    else
   5.495 -	razor_root_close(root);
   5.496 +	retval=plover_commit_transaction(trans,NULL,install_root,root,NULL);
   5.497      razor_transaction_destroy(trans);
   5.498 -    razor_atomic_destroy(atomic);
   5.499 +    razor_root_close(root);
   5.500      return retval;
   5.501  }
   5.502  
   5.503 @@ -543,7 +533,6 @@
   5.504      const char *name;
   5.505      char *install_root;
   5.506      struct razor_set *set;
   5.507 -    struct razor_atomic *atomic;
   5.508      struct razor_package *package;
   5.509      struct razor_package_iterator *pi;
   5.510      struct razor_file_iterator *fi;
   5.511 @@ -553,8 +542,7 @@
   5.512      install_root=getenv("RAZOR_ROOT");
   5.513      if (!install_root)
   5.514  	install_root="";
   5.515 -    atomic=razor_atomic_open("Query packages");
   5.516 -    set=razor_root_open_read_only(install_root,atomic);
   5.517 +    set=razor_root_open_read_only(install_root,NULL);
   5.518      if (set)
   5.519      {
   5.520  	pi=razor_package_iterator_create(set);
   5.521 @@ -573,6 +561,5 @@
   5.522  	razor_package_iterator_destroy(pi);
   5.523  	razor_set_unref(set);
   5.524      }
   5.525 -    razor_atomic_destroy(atomic);
   5.526      return matches;
   5.527  }
     6.1 --- a/setup/resources.rc.in	Mon Jan 30 13:35:28 2012 +0000
     6.2 +++ b/setup/resources.rc.in	Tue Feb 21 22:55:40 2012 +0000
     6.3 @@ -20,7 +20,7 @@
     6.4  		VALUE "FileVersion","@PACKAGE_VERSION@"
     6.5  		VALUE "InternalName","setup"
     6.6  		VALUE "LegalCopyright",
     6.7 -		  "Copyright (c) 2009,2011 J. Ali Harlow et al"
     6.8 +		  "Copyright (c) 2009,2011,2012 J. Ali Harlow et al"
     6.9  		VALUE "OriginalFilename","setup.exe"
    6.10  		VALUE "ProductName","plover"
    6.11  		VALUE "ProductVersion","@PACKAGE_VERSION@"
     7.1 --- a/update/resources.rc.in	Mon Jan 30 13:35:28 2012 +0000
     7.2 +++ b/update/resources.rc.in	Tue Feb 21 22:55:40 2012 +0000
     7.3 @@ -20,7 +20,7 @@
     7.4  		VALUE "FileVersion","@PACKAGE_VERSION@"
     7.5  		VALUE "InternalName","update"
     7.6  		VALUE "LegalCopyright",
     7.7 -		  "Copyright (c) 2009,2011 J. Ali Harlow et al"
     7.8 +		  "Copyright (c) 2009,2011,2012 J. Ali Harlow et al"
     7.9  		VALUE "OriginalFilename","update.exe"
    7.10  		VALUE "ProductName","plover"
    7.11  		VALUE "ProductVersion","@PACKAGE_VERSION@"