aboutsummaryrefslogtreecommitdiff
path: root/include/wydawca/wydawca.h
blob: bc5a5a57d2258ad20a9a3e27038c617d4c2d4eb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* wydawca - automatic release submission daemon
   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2017, 2019
   Sergey Poznyakoff

   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 3 of the License, or (at your
   option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program. If not, see <http://www.gnu.org/licenses/>. */

#define wy_s_cat2(a,b) a ## b
#define wy_s_cat3(a,b,c) a ## b ## c

#define WY_EXPORT(module,name) wy_s_cat3(module,_LTX_wy_,name)
#define wy_notify WY_EXPORT(WY_MODULE,notify)
#define wy_help WY_EXPORT(WY_MODULE,help)
#define wy_open WY_EXPORT(WY_MODULE,open)
#define wy_config WY_EXPORT(WY_MODULE,config)
#define wy_flush WY_EXPORT(WY_MODULE,flush)

/* Global variables */

extern int wy_dry_run;	/* Dry run indicator */
extern int wy_debug_level;	/* Debugging level */
extern char *wy_gpg_homedir;
extern const char *wy_version;
extern int wy_log_to_stderr;	/* Log to stderr instead of the syslog */
extern int wy_log_facility;	/* Syslog facility to use if !wy_log_to_stderr */
extern char *wy_syslog_tag;	/* Syslog tag */

/* Logging and debugging */
#ifndef WY_PRINTFLIKE
# define WY_PRINTFLIKE(fmt,narg) __attribute__ ((__format__ (__printf__, fmt, narg)))
#endif

void wy_log(int prio, char *fmt, ...) WY_PRINTFLIKE(2, 3);
void wy_dbg(char *fmt, ...) WY_PRINTFLIKE(1, 2);
#define wy_debug(l,c) do {				\
		if (wy_debug_level >= (l))		\
			wy_dbg c;			\
	} while(0)

/* Wydawca events */
enum wy_event {
	wy_ev_success,
	wy_ev_bad_ownership,
	wy_ev_bad_directive_signature,
	wy_ev_bad_detached_signature,
	wy_ev_check_fail,
	wy_ev_statistics,
	WY_N_EVENT
};

const char *wy_event_str(enum wy_event evt);


struct wy_user {
	struct wy_user *next;
	char *name;
	char *realname;
	char *email;
	char *gpg_key;
	char *fpr;
};

typedef struct wy_triplet *wy_triplet_t;

const char *wy_triplet_project(wy_triplet_t trp);
struct wy_user *wy_triplet_get_uploaders(wy_triplet_t trp);
struct wy_user *wy_triplet_get_admins(wy_triplet_t trp);
struct wy_user *wy_triplet_get_uploader(wy_triplet_t trp);

struct wy_metadef {
	char *kw;
	char *value;
	const char *(*expand) (struct wy_metadef *, void *);
	char *storage;
	void *data;
};

char *wy_expand_stats(const char *tmpl);
char *wy_triplet_expand_param(const char *tmpl, struct wy_triplet const *trp,
			      struct wy_metadef *xmeta);

int wy_stat_mask_p(unsigned long mask);

Return to:

Send suggestions and report system problems to the System administrator.