target.h 2.09 KB
Newer Older
1 2 3 4 5 6
#ifndef __MIRRORER_TARGET_H
#define __MIRRORER_TARGET_H

#ifndef __MIRRORER_STRLIST_H
#include "strlist.h"
#endif
7 8 9
#ifndef __MIRRORER_NAMES_H
#include "names.h"
#endif
10 11 12
#ifndef __MIRRORER_PACKAGES_H
#include "packages.h"
#endif
13

14
struct target;
15

16 17 18 19
typedef retvalue get_name(struct target *,const char *,char **);
typedef retvalue get_version(struct target *,const char *,char **);
typedef retvalue get_installdata(struct target *,const char *,const char *,const char *,char **,struct strlist *,struct strlist *,struct strlist *);
typedef retvalue get_filekeys(struct target *,const char *,const char *,struct strlist *);
20

21
struct target {
22 23 24 25
	char *codename;
	char *component;
	char *architecture;
	char *identifier;
26
	char *directory;
27 28
	int compressions[ic_max+1];
	const char *indexfile;
29 30 31
	get_name *getname;
	get_version *getversion;
	get_installdata *getinstalldata;
32
	get_filekeys *getfilekeys;
33
	/* the next one in the list of targets of a distribution */
34
	struct target *next;
35 36
	/* is initialized as soon as needed: */
	packagesdb packages;
37 38
};

39 40 41
retvalue target_initialize_binary(const char *codename,const char *component,const char *architecture,struct target **target);
retvalue target_initialize_source(const char *codename,const char *component,struct target **target);
void target_free(struct target *target);
42

43

44
retvalue target_printmd5sums(const struct target *target,const char *distdir,FILE *out,int force);
45 46

/* This opens up the database, if db != NULL, *db will be set to it.. */
47
retvalue target_initpackagesdb(struct target *target, const char *dbdir, packagesdb *db);
48 49 50

/* The following calls can only be called if target_initpackagesdb was called before: */

51 52 53 54
retvalue target_addpackage(struct target *target,DB *references,filesdb files,const char *name,const char *version,const char *control,const struct strlist *filekeys,const struct strlist *md5sums,int force,int downgrade);
retvalue target_export(struct target *target,const char *distdir, int force);
retvalue target_check(struct target *target,filesdb filesdb,DB *referencesdb,int force);
retvalue target_rereference(struct target *target,DB *referencesdb,int force);
55

56
#endif