upgradelist.h 1.89 KB
Newer Older
Bernhard Link's avatar
Bernhard Link committed
1 2
#ifndef REPREPRO_UPGRADELIST_H
#define REPREPRO_UPGRADELIST_H
3

Bernhard Link's avatar
Bernhard Link committed
4
#ifndef REPREPRO_PACKAGES_H
5
#include "packages.h"
6
#endif
Bernhard Link's avatar
Bernhard Link committed
7
#ifndef REPREPRO_APTMETHOD_H
8 9
#include "aptmethod.h"
#endif
Bernhard Link's avatar
Bernhard Link committed
10
#ifndef REPREPRO_DOWNLOADCACHE_H
11
#include "downloadcache.h"
12
#endif
13 14 15

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

16
typedef enum { UD_ERROR, UD_NO, UD_UPGRADE, UD_HOLD } upgrade_decision;
17

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);
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,references refs,int force, bool_t ignoredelete, struct strlist *dereferencedfilekeys);
47 48

#endif