src/import-rpmdb.c
changeset 370 a3e288343fe7
parent 356 d842feb64ecb
child 372 6e93e5485947
     1.1 --- a/src/import-rpmdb.c	Thu Mar 12 20:52:12 2009 +0000
     1.2 +++ b/src/import-rpmdb.c	Thu Jul 02 11:31:03 2009 +0100
     1.3 @@ -1,6 +1,7 @@
     1.4  /*
     1.5   * Copyright (C) 2008  Kristian Høgsberg <krh@redhat.com>
     1.6   * Copyright (C) 2008  Red Hat, Inc
     1.7 + * Copyright (C) 2009  J. Ali Harlow <ali@juiblex.co.uk>
     1.8   *
     1.9   * This program is free software; you can redistribute it and/or modify
    1.10   * it under the terms of the GNU General Public License as published by
    1.11 @@ -79,6 +80,21 @@
    1.12  					    versions.list[i]);
    1.13  }
    1.14  
    1.15 +static void
    1.16 +add_script(struct razor_importer *importer,
    1.17 +	   uint32_t type_flags, Header h,
    1.18 +	   int32_t program_tag, int32_t body_tag)
    1.19 +{
    1.20 +	union rpm_entry program, body;
    1.21 +	int32_t type, count;
    1.22 +
    1.23 +	headerGetEntry(h, program_tag, &type, &program.p, &count);
    1.24 +	headerGetEntry(h, body_tag, &type, &body.p, &count);
    1.25 +
    1.26 +	razor_importer_add_script(importer, type_flags,
    1.27 +				  program.string, body.string);
    1.28 +}
    1.29 +
    1.30  struct razor_set *
    1.31  razor_set_create_from_rpmdb(void)
    1.32  {
    1.33 @@ -163,6 +179,12 @@
    1.34  			razor_importer_add_file(importer, filename);
    1.35  		}
    1.36  
    1.37 +		add_script(importer, RAZOR_PROPERTY_PREUN, h,
    1.38 +			   RPMTAG_PREUNPROG, RPMTAG_PREUN);
    1.39 +
    1.40 +		add_script(importer, RAZOR_PROPERTY_POSTUN, h,
    1.41 +			   RPMTAG_POSTUNPROG, RPMTAG_POSTUN);
    1.42 +
    1.43  		razor_importer_finish_package(importer);
    1.44  
    1.45  		printf("\rimporting %d", ++imported_count);