summaryrefslogtreecommitdiffstats
path: root/libopkg/pkg.c
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-10 00:00:59 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-10 00:00:59 (EST)
commitdc23bec5af327cff093dc471441124944c39cc9c (patch)
tree83adfb0244b66655373d56167e2d26923dc1f96a /libopkg/pkg.c
parent6e59ec90af245ddf2d2534981fa0eb7804a8686d (diff)
Remove opkg_internal_use_only and fix associated assumptions RE pkg->provides.
It appears that the opkg_internal_use_only provides string was introduced to bandaid over problems with assuming that the pkg->provides, pkg->provides_str and pkg->provides_count are all the same length. As each pkg provides itself, the pkg->provides array was one longer than the str and count fields. Most of the uses of pkg->provides did not take this into account. This behaviour has been changed. pkg->provides is now pkg->provides_count long and it is pkg->provides_str which is shorter by one. Associated dead code has also been removed. git-svn-id: http://opkg.googlecode.com/svn/trunk@277 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/pkg.c')
-rw-r--r--libopkg/pkg.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index 3b1f21b..13415c7 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -417,8 +417,10 @@ int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status)
oldpkg->provides_count = newpkg->provides_count;
newpkg->provides_count = 0;
- oldpkg->provides = newpkg->provides;
- newpkg->provides = NULL;
+ if (!oldpkg->provides) {
+ oldpkg->provides = newpkg->provides;
+ newpkg->provides = NULL;
+ }
}
if (!oldpkg->conflicts_str) {
@@ -546,7 +548,6 @@ void set_flags_from_control(opkg_conf_t *conf, pkg_t *pkg){
void pkg_formatted_field(FILE *fp, pkg_t *pkg, const char *field)
{
int i;
- int flag_provide_false = 0;
if (strlen(field) < PKG_MINIMUM_FIELD_NAME_LEN) {
goto UNKNOWN_FMT_FIELD;
@@ -655,23 +656,11 @@ void pkg_formatted_field(FILE *fp, pkg_t *pkg, const char *field)
fprintf(fp, "Priority: %s\n", pkg->priority);
} else if (strcasecmp(field, "Provides") == 0) {
if (pkg->provides_count) {
- /* Here we check if the opkg_internal_use_only is used, and we discard it.*/
- for ( i=0; i < pkg->provides_count; i++ ){
- if (strstr(pkg->provides_str[i],"opkg_internal_use_only")!=NULL) {
- memset (pkg->provides_str[i],'\x0',strlen(pkg->provides_str[i])); /* Pigi clear my trick flag, just in case */
- flag_provide_false = 1;
- }
- }
- if ( !flag_provide_false || /* Pigi there is not my trick flag */
- ((flag_provide_false) && (pkg->provides_count > 1))){ /* Pigi There is, but we also have others Provides */
- fprintf(fp, "Provides:");
- for(i = 0; i < pkg->provides_count; i++) {
- if (strlen(pkg->provides_str[i])>0) {
- fprintf(fp, "%s %s", i == 1 ? "" : ",", pkg->provides_str[i]);
- }
- }
- fprintf(fp, "\n");
+ fprintf(fp, "Provides:");
+ for(i = 0; i < pkg->provides_count-1; i++) {
+ fprintf(fp, "%s %s", i == 0 ? "" : ",", pkg->provides_str[i]);
}
+ fprintf(fp, "\n");
}
} else {
goto UNKNOWN_FMT_FIELD;