From 9797030306f98d5305a6e109ad9421598b2f9900 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 26 Jan 2011 18:42:28 +0100 Subject: [PATCH] xbps_register_pkg: also copy the provides object for virtual packages. --- lib/package_register.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/package_register.c b/lib/package_register.c index 5e18dc62..1fabd13c 100644 --- a/lib/package_register.c +++ b/lib/package_register.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2010 Juan Romero Pardines. + * Copyright (c) 2008-2011 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,7 +44,7 @@ int xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic) { prop_dictionary_t dict, pkgd; - prop_array_t array; + prop_array_t array, provides = NULL; const char *pkgname, *version, *desc, *pkgver; char *plist; int rv = 0; @@ -59,6 +59,7 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic) prop_dictionary_get_cstring_nocopy(pkgrd, "version", &version); prop_dictionary_get_cstring_nocopy(pkgrd, "short_desc", &desc); prop_dictionary_get_cstring_nocopy(pkgrd, "pkgver", &pkgver); + provides = prop_dictionary_get(pkgrd, "provides"); assert(pkgname != NULL); assert(version != NULL); @@ -99,7 +100,13 @@ xbps_register_pkg(prop_dictionary_t pkgrd, bool automatic) goto out; } } - + if (provides) { + if (!prop_dictionary_set(pkgd, "provides", provides)) { + prop_object_release(pkgd); + rv = EINVAL; + goto out; + } + } /* * Add the requiredby objects for dependent packages. */