mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-27 20:51:32 +02:00
9d208dd855
- pkg.h (enum flags): new flags QPKG_PROVIDED to indicate that the package is only a provision, not an installable package - fixup.h, fixup.c (complete_provisions): search for provisions that do not have a real package associated with them, create a package for them, and mark it as QPKG_PROVIDED - qpkg.c (do_fixups): invoke complete_provisions - pkg.h (struct pkg): add list of (virtual or real) packages a given package provides - pkg.c (new_pkg): initialize pkg->provides - pkg.c (free_pkg): deallocate pkg->provides - gobble.c (gobble_buf): parse the list of packages a package provides - TODO: updated status of Provides support
56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
/*
|
|
* fixup.c - Adjust things after parsing is done
|
|
*
|
|
* Written 2010 by Werner Almesberger
|
|
* Copyright 2010 Werner Almesberger
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "jrb.h"
|
|
|
|
#include "pkg.h"
|
|
#include "qpkg.h"
|
|
#include "fixup.h"
|
|
|
|
|
|
void sort_versions(void)
|
|
{
|
|
const struct jrb *n;
|
|
struct pkg **a, **b;
|
|
struct pkg *tmp;
|
|
|
|
for (n = jrb_first(packages->root); n != jrb_nil(packages->root);
|
|
n = jrb_next(n))
|
|
for (a = (struct pkg **) &n->val; *a; a = &(*a)->more)
|
|
for (b = &(*a)->more; *b;)
|
|
if (comp_versions((*a)->version,
|
|
(*b)->version) >= 0)
|
|
b = &(*b)->more;
|
|
else {
|
|
tmp = *a;
|
|
*a = *b;
|
|
*b = tmp;
|
|
tmp = (*a)->more;
|
|
(*a)->more = (*b)->more;
|
|
(*b)->more = tmp;
|
|
}
|
|
}
|
|
|
|
|
|
void complete_provisions(void)
|
|
{
|
|
struct jrb *n;
|
|
|
|
for (n = jrb_first(packages->root); n != jrb_nil(packages->root);
|
|
n = jrb_next(n))
|
|
if (!n->val)
|
|
new_pkg(n)->flags |= QPKG_PROVIDED;
|
|
}
|