upgradelist.h 1.88 KB
Newer Older
1 2
#ifndef __MIRRORER_UPGRADELIST_H
#define __MIRRORER_UPGRADELIST_H
3

4
#ifndef __MIRRORER_PACKAGES_H
5
#include "packages.h"
6
#endif
7 8 9 10 11
#ifndef __MIRRORER_APTMETHOD_H
#include "aptmethod.h"
#endif
#ifndef __MIRRORER_DOWNLOADCACHE_H
#include "downloadcache.h"
12
#endif
13 14 15 16 17

/* Things for making decisions what to upgrade and what not */

typedef enum { UD_NO, UD_UPGRADE, UD_HOLD } upgrade_decision;

18
typedef upgrade_decision upgrade_decide_function(void *privdata, const char *package,const char *old_version,const char *new_version,const char *newcontrolchunk);
19

20
upgrade_decision ud_always(void *privdata, const char *p,const char *ov,const char *nv,const char *nc);
21 22 23

/* The main part: */

24 25
struct target;
struct upgradelist;
26

27
retvalue upgradelist_initialize(struct upgradelist **ul,struct target *target,const char *dbdir,upgrade_decide_function *decide,void *decide_data);
28
retvalue upgradelist_free(struct upgradelist *upgrade);
29

30
void upgradelist_dump(struct upgradelist *upgrade);
31
retvalue upgradelist_listmissing(struct upgradelist *upgrade,filesdb files);
32

33
/* Take all items in 'filename' into account, and remember them coming from 'method' */
34
retvalue upgradelist_update(struct upgradelist *upgrade,struct aptmethod *method,const char *filename,upgrade_decide_function *predecide,void *decide_data,int force);
35

36 37 38
/* mark all packages as deleted, so they will vanis unless readded or reholded */
retvalue upgradelist_deleteall(struct upgradelist *upgrade);

39 40 41 42
//TODO add a function to reduce data-load by removing anything not needed
//any longer. (perhaps with a flag to remove all packages that are no
//longer available upstream)

43 44
/* request all wanted files refering the methods given before */
retvalue upgradelist_enqueue(struct upgradelist *upgrade,struct downloadcache *cache,filesdb filesdb,int force);
45

46
retvalue upgradelist_install(struct upgradelist *upgrade,const char *dbdir,filesdb files,DB *references,int force);
47 48

#endif