Basic support for update
authorJ. Ali Harlow <ali@juiblex.co.uk>
Thu Aug 13 07:14:51 2009 +0100 (2009-08-13)
changeset 3824e261a14a6bd
parent 381 d35581ea0c67
child 383 6e73f3f08309
Basic support for update
librazor/razor.c
librazor/razor.h
src/main.c
test/Makefile.am
test/update.sh
test/zip.spec
     1.1 --- a/librazor/razor.c	Thu Aug 13 07:08:45 2009 +0100
     1.2 +++ b/librazor/razor.c	Thu Aug 13 07:14:51 2009 +0100
     1.3 @@ -469,7 +469,8 @@
     1.4  
     1.5  /**
     1.6   * razor_package_remove:
     1.7 - * @set: a %razor_set
     1.8 + * @prev: The %razor_set before the current transaction
     1.9 + * @next: The %razor_set after the current transaction is applied
    1.10   * @package: a %razor_package
    1.11   * @root: the root into which the package is currently installed
    1.12   * @install_count: the value to pass to uninstall scripts
    1.13 @@ -477,8 +478,9 @@
    1.14   * Removes an installed package.
    1.15   **/
    1.16  RAZOR_EXPORT int
    1.17 -razor_package_remove(struct razor_set *set, struct razor_package *package,
    1.18 -		     const char *root, int install_count)
    1.19 +razor_package_remove(struct razor_set *prev, struct razor_set *next,
    1.20 +		     struct razor_package *package, const char *root,
    1.21 +		     int install_count)
    1.22  {
    1.23  	struct razor_file_iterator *fi;
    1.24  	struct razor_package_iterator *pi;
    1.25 @@ -491,16 +493,16 @@
    1.26  	const char *prefix;
    1.27  
    1.28  	environment_init(&env);
    1.29 -	link = list_first(&package->install_prefixes, &set->prefix_pool);
    1.30 +	link = list_first(&package->install_prefixes, &prev->prefix_pool);
    1.31  	for (i = 0; link; i++) {
    1.32 -		prefix = (const char *)set->string_pool.data + link->data;
    1.33 +		prefix = (const char *)prev->string_pool.data + link->data;
    1.34  		sprintf(buffer, "RPM_INSTALL_PREFIX%d", i);
    1.35  		environment_add_variable(&env, buffer, prefix);
    1.36  		link = list_next(link);
    1.37  	}
    1.38  	environment_set(&env);
    1.39  
    1.40 -	razor_package_get_details(set, package,
    1.41 +	razor_package_get_details(prev, package,
    1.42  				  RAZOR_DETAIL_PREUNPROG, &program,
    1.43  				  RAZOR_DETAIL_PREUN, &script,
    1.44  				  RAZOR_DETAIL_LAST);
    1.45 @@ -508,15 +510,15 @@
    1.46  	retval = razor_run_script(root, RAZOR_PROPERTY_PREUN, program, script,
    1.47  				  install_count);
    1.48  
    1.49 -	fi = razor_file_iterator_create(set, package, 1);
    1.50 +	fi = razor_file_iterator_create(prev, package, 1);
    1.51  
    1.52  	while (razor_file_iterator_next(fi, &name)) {
    1.53 -		pi = razor_package_iterator_create_for_file(set, name);
    1.54 +		pi = razor_package_iterator_create_for_file(next, name);
    1.55  		count = 0;
    1.56  		while (razor_package_iterator_next(pi, &p, RAZOR_DETAIL_LAST))
    1.57  			count++;
    1.58  		razor_package_iterator_destroy(pi);
    1.59 -		if (count <= 1) {
    1.60 +		if (count <= 0) {
    1.61  			snprintf(buffer, sizeof buffer, "%s%s", root, name);
    1.62  			if (razor_remove(buffer) && errno != ENOENT) {
    1.63  				perror(name);
    1.64 @@ -527,7 +529,7 @@
    1.65  
    1.66  	razor_file_iterator_destroy(fi);
    1.67  
    1.68 -	razor_package_get_details(set, package,
    1.69 +	razor_package_get_details(prev, package,
    1.70  				  RAZOR_DETAIL_POSTUNPROG, &program,
    1.71  				  RAZOR_DETAIL_POSTUN, &script,
    1.72  				  RAZOR_DETAIL_LAST);
    1.73 @@ -878,29 +880,38 @@
    1.74  
    1.75  RAZOR_EXPORT int
    1.76  razor_install_iterator_next(struct razor_install_iterator *ii,
    1.77 -			    struct razor_set **set,
    1.78  			    struct razor_package **package,
    1.79  			    enum razor_install_action *action,
    1.80  			    int *count)
    1.81  {
    1.82  	struct install_action *a;
    1.83 +	struct razor_package_iterator *pi;
    1.84 +	struct razor_package *pkg;
    1.85 +	const char *removing, *name;
    1.86 +
    1.87  	if (deque_empty(ii->order))
    1.88  		return 0;
    1.89  
    1.90  	a = (struct install_action *)ii->actions.data + deque_pop(ii->order);
    1.91 -	switch (a->action) {
    1.92 -	case RAZOR_INSTALL_ACTION_ADD:
    1.93 -		*set = ii->next;
    1.94 -		break;
    1.95 -	case RAZOR_INSTALL_ACTION_REMOVE:
    1.96 -		*set = ii->set;
    1.97 -		break;
    1.98 -	}
    1.99 -
   1.100  	*package = a->package;
   1.101  	*action = a->action;
   1.102  	*count = 0;
   1.103  
   1.104 +	if (a->action == RAZOR_INSTALL_ACTION_REMOVE) {
   1.105 +		razor_package_get_details(ii->set, a->package,
   1.106 +					  RAZOR_DETAIL_NAME, &removing,
   1.107 +					  RAZOR_DETAIL_LAST);
   1.108 +
   1.109 +		pi = razor_package_iterator_create(ii->next);
   1.110 +		while (razor_package_iterator_next(pi, &pkg,
   1.111 +						   RAZOR_DETAIL_NAME, &name,
   1.112 +						   RAZOR_DETAIL_LAST)) {
   1.113 +			if (!strcmp(name, removing))
   1.114 +				(*count)++;
   1.115 +		}
   1.116 +		razor_package_iterator_destroy(pi);
   1.117 +	}
   1.118 +
   1.119  	return 1;
   1.120  }
   1.121  
     2.1 --- a/librazor/razor.h	Thu Aug 13 07:08:45 2009 +0100
     2.2 +++ b/librazor/razor.h	Thu Aug 13 07:14:51 2009 +0100
     2.3 @@ -109,9 +109,9 @@
     2.4  razor_package_get_details(struct razor_set *set,
     2.5  			  struct razor_package *package, ...);
     2.6  int
     2.7 -razor_package_remove(struct razor_set *set, struct razor_package *package,
     2.8 -		     const char *root, int install_count);
     2.9 -
    2.10 +razor_package_remove(struct razor_set *prev, struct razor_set *next,
    2.11 +		     struct razor_package *package, const char *root,
    2.12 +		     int install_count);
    2.13  
    2.14  /**
    2.15   * SECTION:iterator
    2.16 @@ -226,7 +226,6 @@
    2.17  				  struct razor_set *next);
    2.18  
    2.19  int razor_install_iterator_next(struct razor_install_iterator *ii,
    2.20 -				struct razor_set **set,
    2.21  				struct razor_package **package,
    2.22  				enum razor_install_action *action,
    2.23  				int *count);
     3.1 --- a/src/main.c	Thu Aug 13 07:08:45 2009 +0100
     3.2 +++ b/src/main.c	Thu Aug 13 07:14:51 2009 +0100
     3.3 @@ -42,7 +42,6 @@
     3.4  static const char system_repo_filename[] = "system.rzdb";
     3.5  static const char next_repo_filename[] = "system-next.rzdb";
     3.6  static const char rawhide_repo_filename[] = "rawhide.rzdb";
     3.7 -static const char updated_repo_filename[] = "system-updated.rzdb";
     3.8  static const char *install_root = "";
     3.9  static const char *repo_filename = system_repo_filename;
    3.10  static const char *yum_url;
    3.11 @@ -549,50 +548,6 @@
    3.12  }
    3.13  
    3.14  static int
    3.15 -command_update(int argc, const char *argv[])
    3.16 -{
    3.17 -	struct razor_set *set, *upstream;
    3.18 -	struct razor_transaction *trans;
    3.19 -	int i, errors;
    3.20 -
    3.21 -	set = razor_root_open_read_only(install_root);
    3.22 -	if (set == NULL)
    3.23 -		return 1;
    3.24 -
    3.25 -	upstream = razor_set_open(rawhide_repo_filename);
    3.26 -	if (upstream == NULL)
    3.27 -		return 1;
    3.28 -
    3.29 -	trans = razor_transaction_create(set, upstream);
    3.30 -	if (argc == 0)
    3.31 -		razor_transaction_update_all(trans);
    3.32 -	for (i = 0; i < argc; i++) {
    3.33 -		if (mark_packages_for_update(trans, set, argv[i]) == 0) {
    3.34 -			fprintf(stderr, "no match for %s\n", argv[i]);
    3.35 -			razor_transaction_destroy(trans);
    3.36 -			return 1;
    3.37 -		}
    3.38 -	}
    3.39 -
    3.40 -	razor_transaction_resolve(trans);
    3.41 -	errors = razor_transaction_describe(trans);
    3.42 -	if (errors) {
    3.43 -		fprintf(stderr, "unresolved dependencies\n");
    3.44 -		razor_transaction_destroy(trans);
    3.45 -		return 1;
    3.46 -	}
    3.47 -
    3.48 -	set = razor_transaction_commit(trans);
    3.49 -	razor_set_write(set, updated_repo_filename, RAZOR_SECTION_ALL);
    3.50 -	razor_transaction_destroy(trans);
    3.51 -	razor_set_destroy(set);
    3.52 -	razor_set_destroy(upstream);
    3.53 -	printf("wrote system-updated.rzdb\n");
    3.54 -
    3.55 -	return 0;
    3.56 -}
    3.57 -
    3.58 -static int
    3.59  command_remove(int argc, const char *argv[])
    3.60  {
    3.61  	struct razor_root *root;
    3.62 @@ -659,7 +614,7 @@
    3.63  	struct razor_set *set, *updated;
    3.64  
    3.65  	set = razor_root_open_read_only(install_root);
    3.66 -	updated = razor_set_open(updated_repo_filename);
    3.67 +	updated = razor_set_open(rawhide_repo_filename);
    3.68  	if (set == NULL || updated == NULL)
    3.69  		return 1;
    3.70  
    3.71 @@ -756,19 +711,17 @@
    3.72  {
    3.73  	struct razor_install_iterator *ii;
    3.74  	struct razor_package *package;
    3.75 -	struct razor_set *set;
    3.76  	enum razor_install_action action;
    3.77  	const char *name, *version, *arch;
    3.78  	char file[PATH_MAX], url[256];
    3.79  	int errors = 0, count;
    3.80  
    3.81  	ii = razor_set_create_install_iterator(system, next);
    3.82 -	while (razor_install_iterator_next(ii, &set, &package,
    3.83 -					   &action, &count)) {
    3.84 +	while (razor_install_iterator_next(ii, &package, &action, &count)) {
    3.85  		if (action == RAZOR_INSTALL_ACTION_REMOVE)
    3.86  			continue;
    3.87  
    3.88 -		razor_package_get_details(set, package,
    3.89 +		razor_package_get_details(next, package,
    3.90  					  RAZOR_DETAIL_NAME, &name,
    3.91  					  RAZOR_DETAIL_VERSION, &version,
    3.92  					  RAZOR_DETAIL_ARCH, &arch,
    3.93 @@ -920,19 +873,18 @@
    3.94  {
    3.95  	struct razor_install_iterator *ii;
    3.96  	struct razor_package *package;
    3.97 -	struct razor_set *set;
    3.98  	enum razor_install_action action;
    3.99  	int retval = 0, count;
   3.100  
   3.101  	ii = razor_set_create_install_iterator(system, next);
   3.102 -	while (!retval && razor_install_iterator_next(ii, &set, &package,
   3.103 +	while (!retval && razor_install_iterator_next(ii, &package,
   3.104  						      &action, &count)) {
   3.105  		if (action == RAZOR_INSTALL_ACTION_ADD)
   3.106 -			retval = install_package(trans, set, package,
   3.107 +			retval = install_package(trans, next, package,
   3.108  						 relocations);
   3.109  		else if (action == RAZOR_INSTALL_ACTION_REMOVE)
   3.110 -			retval = razor_package_remove(set, package,
   3.111 -						      install_root, 0);
   3.112 +			retval = razor_package_remove(system, next, package,
   3.113 +						      install_root, count);
   3.114  	}
   3.115  	razor_install_iterator_destroy(ii);
   3.116  
   3.117 @@ -940,7 +892,7 @@
   3.118  }
   3.119  
   3.120  static int
   3.121 -command_install(int argc, const char *argv[])
   3.122 +command_install_or_update(int argc, const char *argv[], int do_update)
   3.123  {
   3.124  	struct razor_root *root;
   3.125  	struct razor_relocations *relocations=NULL;
   3.126 @@ -960,7 +912,8 @@
   3.127  			i++;
   3.128  			if (i >= argc || strchr(argv[i], '=') == NULL) {
   3.129  				fprintf(stderr,
   3.130 -				    "Usage: razor install [OPTION...] RPM\n");
   3.131 +				    "Usage: razor %s [OPTION...] RPM\n",
   3.132 +				    do_update ? "update" : "install");
   3.133  				fprintf(stderr, "Options:\n");
   3.134  				fprintf(stderr, "    [--no-dependencies]\n");
   3.135  				fprintf(stderr,
   3.136 @@ -983,10 +936,9 @@
   3.137  	system = razor_root_get_system_set(root);
   3.138  	upstream = razor_set_open(rawhide_repo_filename);
   3.139  	if (upstream == NULL) {
   3.140 -		fprintf(stderr, "couldn't open rawhide repo\n");
   3.141  		razor_root_close(root);
   3.142  		return 1;
   3.143 -	}		
   3.144 +	}
   3.145  
   3.146  	if (relocations) {
   3.147  		set = relocate_packages(upstream, relocations);
   3.148 @@ -996,10 +948,13 @@
   3.149  
   3.150  	trans = razor_transaction_create(system, upstream);
   3.151  
   3.152 +	if (i == argc && do_update)
   3.153 +		razor_transaction_update_all(trans);
   3.154  	for (; i < argc; i++) {
   3.155  		if (mark_packages_for_update(trans, upstream, argv[i]) == 0) {
   3.156  			fprintf(stderr, "no package matched %s\n", argv[i]);
   3.157  			razor_transaction_destroy(trans);
   3.158 +			razor_set_destroy(upstream);
   3.159  			razor_root_close(root);
   3.160  			return 1;
   3.161  		}
   3.162 @@ -1009,22 +964,26 @@
   3.163  		razor_transaction_resolve(trans);
   3.164  		if (razor_transaction_describe(trans) > 0) {
   3.165  			razor_transaction_destroy(trans);
   3.166 +			razor_set_destroy(upstream);
   3.167  			razor_root_close(root);
   3.168  			return 1;
   3.169  		}
   3.170  	}
   3.171  
   3.172 -	next = razor_transaction_commit(trans);
   3.173 -
   3.174  	if (mkdir("rpms", 0777) && errno != EEXIST) {
   3.175  		fprintf(stderr, "failed to create rpms directory.\n");
   3.176  		razor_transaction_destroy(trans);
   3.177 +		razor_set_destroy(upstream);
   3.178  		razor_root_close(root);
   3.179  		return 1;
   3.180  	}
   3.181  
   3.182 +	next = razor_transaction_commit(trans);
   3.183 +
   3.184  	if (download_packages(system, next) < 0) {
   3.185 +		razor_set_destroy(next);
   3.186  		razor_transaction_destroy(trans);
   3.187 +		razor_set_destroy(upstream);
   3.188  		razor_root_close(root);
   3.189                  return 1;
   3.190          }
   3.191 @@ -1043,6 +1002,18 @@
   3.192  }
   3.193  
   3.194  static int
   3.195 +command_update(int argc, const char *argv[])
   3.196 +{
   3.197 +	return command_install_or_update(argc, argv, 1);
   3.198 +}
   3.199 +
   3.200 +static int
   3.201 +command_install(int argc, const char *argv[])
   3.202 +{
   3.203 +	return command_install_or_update(argc, argv, 0);
   3.204 +}
   3.205 +
   3.206 +static int
   3.207  command_init(int argc, const char *argv[])
   3.208  {
   3.209  	return razor_root_create(install_root);
     4.1 --- a/test/Makefile.am	Thu Aug 13 07:08:45 2009 +0100
     4.2 +++ b/test/Makefile.am	Thu Aug 13 07:14:51 2009 +0100
     4.3 @@ -1,6 +1,6 @@
     4.4  ## Process this file with automake to produce Makefile.in
     4.5  
     4.6 -check_SCRIPTS = relocate named-root remove
     4.7 +check_SCRIPTS = relocate named-root remove update
     4.8  if HAVE_LUA
     4.9    check_SCRIPTS += lua
    4.10  endif
    4.11 @@ -15,25 +15,44 @@
    4.12  remove:	remove.sh primary.xml.gz
    4.13  	cp $(srcdir)/remove.sh remove
    4.14  
    4.15 +update:	update.sh base/repodata/primary.xml.gz updates/repodata/primary.xml.gz
    4.16 +	cp $(srcdir)/update.sh update
    4.17 +
    4.18  order:	order.sh primary.xml.gz
    4.19  	cp $(srcdir)/order.sh order
    4.20  
    4.21  lua:	lua.sh primary.xml.gz
    4.22  	cp $(srcdir)/lua.sh lua
    4.23  
    4.24 -primary.xml.gz:	zsh.spec zsh2.spec zip.spec zap.spec filesystem.spec Makefile
    4.25 -	rm -rf rpmbuild rpms repodata
    4.26 +base/repodata/primary.xml.gz:	zsh.spec zsh2.spec zip.spec zap.spec \
    4.27 +		filesystem.spec Makefile
    4.28 +	rm -rf rpmbuild base
    4.29  	mkdir -p rpmbuild/BUILD rpmbuild/RPMS
    4.30  	rpmbuild --define "_topdir `pwd`/rpmbuild" -bb $(srcdir)/zap.spec
    4.31 -	rpmbuild --define "_topdir `pwd`/rpmbuild" -bb $(srcdir)/zip.spec
    4.32 +	rpmbuild --define "_topdir `pwd`/rpmbuild" --define "_version 1" \
    4.33 +	  -bb $(srcdir)/zip.spec
    4.34  	rpmbuild --define "_topdir `pwd`/rpmbuild" -bb $(srcdir)/zsh.spec
    4.35  	rpmbuild --define "_topdir `pwd`/rpmbuild" -bb $(srcdir)/zsh2.spec
    4.36  	rpmbuild --define "_topdir `pwd`/rpmbuild" -bb $(srcdir)/filesystem.spec
    4.37 -	mkdir rpms
    4.38 -	mv rpmbuild/RPMS/noarch/*.rpm rpms
    4.39 +	mkdir -p base/rpms
    4.40 +	mv rpmbuild/RPMS/noarch/*.rpm base/rpms
    4.41  	rm -rf rpmbuild
    4.42 -	createrepo -o . rpms
    4.43 -	cp repodata/primary.xml.gz repodata/filelists.xml.gz .
    4.44 +	createrepo -o base base/rpms
    4.45 +
    4.46 +updates/repodata/primary.xml.gz:	zip.spec Makefile
    4.47 +	rm -rf rpmbuild updates
    4.48 +	mkdir -p rpmbuild/BUILD rpmbuild/RPMS
    4.49 +	rpmbuild --define "_topdir `pwd`/rpmbuild" --define "_version 2" \
    4.50 +	  -bb $(srcdir)/zip.spec
    4.51 +	mkdir -p updates/rpms
    4.52 +	mv rpmbuild/RPMS/noarch/*.rpm updates/rpms
    4.53 +	rm -rf rpmbuild
    4.54 +	createrepo -o updates updates/rpms
    4.55 +
    4.56 +primary.xml.gz:	base/repodata/primary.xml.gz
    4.57 +	cp base/repodata/primary.xml.gz base/repodata/filelists.xml.gz .
    4.58 +	rm -rf rpms
    4.59 +	ln -s base/rpms .
    4.60  
    4.61  TESTS = $(check_SCRIPTS)
    4.62  
    4.63 @@ -46,6 +65,7 @@
    4.64  	order.sh		\
    4.65  	lua.sh			\
    4.66  	remove.sh		\
    4.67 +	update.sh		\
    4.68  	named-root.sh		\
    4.69  	relocate.sh
    4.70  
    4.71 @@ -57,5 +77,4 @@
    4.72  
    4.73  clean-local :
    4.74  	rm -f *~
    4.75 -	rm -rf repodata rpms
    4.76 -
    4.77 +	rm -rf repodata rpms base updates
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/update.sh	Thu Aug 13 07:14:51 2009 +0100
     5.3 @@ -0,0 +1,89 @@
     5.4 +#!/bin/sh
     5.5 +fs_check_file()
     5.6 +{
     5.7 +    if [ ! -e "$RAZOR_ROOT$1" ]; then 
     5.8 +	echo $1: Not in filesystem >&2
     5.9 +	ls -R "$RAZOR_ROOT" >&2
    5.10 +	exit 1
    5.11 +    fi
    5.12 +}
    5.13 +fs_check_file_contents()
    5.14 +{
    5.15 +    fs_check_file "$1"
    5.16 +    if [ `cat "$RAZOR_ROOT$1"` != "$2" ]; then
    5.17 +	echo $1: Unexpected contents >&2
    5.18 +	cat "$RAZOR_ROOT$1" >&2
    5.19 +	exit 1
    5.20 +    fi
    5.21 +}
    5.22 +fs_check_no_file()
    5.23 +{
    5.24 +    if [ -e "$RAZOR_ROOT$1" ]; then 
    5.25 +	echo $1: Still in filesystem >&2
    5.26 +	exit 1
    5.27 +    fi
    5.28 +}
    5.29 +check_file()
    5.30 +{
    5.31 +    ../src/razor list-files | grep -x "$1" > /dev/null
    5.32 +    if [ $? -ne 0 ]; then
    5.33 +	echo $1: Not in database >&2
    5.34 +	../src/razor list-files >&2
    5.35 +	exit 1
    5.36 +    fi
    5.37 +    ../src/razor list-files "$1" | grep -x "$1" > /dev/null
    5.38 +    if [ $? -ne 0 ]; then
    5.39 +	echo $1: Not seen by patterned list >&2
    5.40 +	../src/razor list-files "$1" >&2
    5.41 +	exit 1
    5.42 +    fi
    5.43 +    pkgs=`../src/razor list-file-packages "$1"`
    5.44 +    if [ -z "$pkgs" ]; then
    5.45 +	echo $1: Not owned by any package >&2
    5.46 +	../src/razor list-file-packages "$1"
    5.47 +	exit 1
    5.48 +    fi
    5.49 +    for nevra in "$pkgs"; do
    5.50 +	name=`echo $nevra | sed 's/\-.*$//'`
    5.51 +	../src/razor list-package-files "$name" | grep -x "$1" > /dev/null
    5.52 +	if [ $? -ne 0 ]; then
    5.53 +	    echo $1: Not in database for package $name >&2
    5.54 +	    ../src/razor list-package-files "$name"
    5.55 +	    exit 1
    5.56 +	fi
    5.57 +    done
    5.58 +    fs_check_file $1
    5.59 +}
    5.60 +check_no_file()
    5.61 +{
    5.62 +    ../src/razor list-files | grep -x "$1" > /dev/null
    5.63 +    if [ $? -eq 0 ]; then
    5.64 +	echo $1: Still in database >&2
    5.65 +	exit 1
    5.66 +    fi
    5.67 +    fs_check_no_file $1
    5.68 +}
    5.69 +set_repository()
    5.70 +{
    5.71 +    cp $1/repodata/primary.xml.gz $1/repodata/filelists.xml.gz .
    5.72 +    rm -rf rpms
    5.73 +    ln -s $1/rpms .
    5.74 +}
    5.75 +export RAZOR_ROOT=`mktemp -dt` || exit 1
    5.76 +../src/razor init || exit 1
    5.77 +export YUM_URL="file://localhost/`pwd`"
    5.78 +set_repository base
    5.79 +../src/razor import-yum || exit 1
    5.80 +../src/razor install --relocate /usr=/opt zip || exit 1
    5.81 +fs_check_file_contents /opt/bin/zip zip-1-1
    5.82 +fs_check_file /opt/var/lib/zip/data.zap
    5.83 +trap "set_repository base" 0
    5.84 +set_repository updates
    5.85 +../src/razor import-yum || exit 1
    5.86 +../src/razor update --relocate /usr=/opt || exit 1
    5.87 +check_file /opt/bin/zip
    5.88 +fs_check_file_contents /opt/bin/zip zip-2-1
    5.89 +fs_check_file /opt/var/lib/zip/data.zap
    5.90 +../src/razor remove zip || exit 1
    5.91 +fs_check_no_file /opt/var/lib/zip/data.zap
    5.92 +rm -rf "$RAZOR_ROOT"
     6.1 --- a/test/zip.spec	Thu Aug 13 07:08:45 2009 +0100
     6.2 +++ b/test/zip.spec	Thu Aug 13 07:14:51 2009 +0100
     6.3 @@ -2,7 +2,7 @@
     6.4  Summary:   Test package
     6.5  Group:     Test
     6.6  License:   GPL
     6.7 -Version:   1
     6.8 +Version:   %{_version}
     6.9  Release:   1
    6.10  Source:    zip.tar
    6.11  BuildArch: noarch
    6.12 @@ -19,7 +19,7 @@
    6.13  
    6.14  %install
    6.15  mkdir -p $RPM_BUILD_ROOT/usr/bin
    6.16 -touch $RPM_BUILD_ROOT/usr/bin/zip
    6.17 +echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/usr/bin/zip
    6.18  
    6.19  %clean
    6.20