aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wydawca.h')
-rw-r--r--src/wydawca.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/wydawca.h b/src/wydawca.h
index 2307bad..94b7ee3 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -1,208 +1,222 @@
/* wydawca - automatic release submission daemon
Copyright (C) 2007, 2008, 2009, 2010 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/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <syslog.h>
#include <getopt.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <pwd.h>
#include <grp.h>
#include <signal.h>
#include <limits.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <time.h>
#include <sysexits.h>
+#include <fnmatch.h>
+#include <regex.h>
#include <mailutils/types.h>
#include <mailutils/url.h>
#include <mailutils/errno.h>
-#include "error.h"
-#include "xalloc.h"
-#include "backupfile.h"
#include "grecs.h"
#include "wordsplit.h"
#define SP(s) ((s) ? (s) : "NONE")
#define WYDAWCA_EX_AGAIN 1
/* The range of directive versions we accept (major * 100 + minor) */
#define MIN_DIRECTIVE_VERSION 101
#define MAX_DIRECTIVE_VERSION 101
/* Default modes for mkdir and creat commands: rely on the umask value */
#define MKDIR_PERMISSIONS 0777
#define CREAT_PERMISSIONS 0666
#define SUF_SIG ".sig"
#define SUF_SIG_LEN (sizeof (SUF_SIG) - 1)
#define SUF_DIR ".directive.asc"
#define SUF_DIR_LEN (sizeof (SUF_DIR) - 1)
#define __cat2__(a,b) a ## b
#define __cat3__(a,b,c) a ## b ## c
#define NITEMS(a) (sizeof(a)/sizeof((a)[0]))
enum dictionary_id {
project_uploader_dict, /* Contains names, gpg-keys, emails and
real names of the project uploaders */
project_owner_dict, /* Contains names and emails of the project
owners */
dictionary_count
};
enum dictionary_type
{
dictionary_none, /* Undefined or no dictionary */
dictionary_sql, /* Use SQL database */
dictionary_builtin, /* Use built-in facilities */
dictionary_external /* Invoke an external program */
};
struct dictionary
{
enum dictionary_id id;
enum dictionary_type type; /* Dictionary type */
char *query; /* Query template */
int parmc; /* Number of entries in paramv */
char **parmv; /* Parameters. The semantics differs
depending on type. For SQL:
0 - Identifier of the SQL struct
to use; */
int init_passed; /* Initialization count */
char *result; /* Result storage */
size_t result_size; /* Size of result */
unsigned ncol; /* Number of columns per row */
unsigned nrow; /* Number of rows */
void *storage;
};
+enum backup_type
+ {
+ no_backups, /* Don't make backups */
+ simple_backups, /* Make only simple backups */
+ numbered_existing_backups,/* Make numbered backups for files that already
+ have such backups and simple backups for the
+ rest */
+ numbered_backups, /* Make only numbered backups */
+ };
+
+extern char const *simple_backup_suffix;
+
+char *find_backup_file_name (char const *, enum backup_type);
+
+
/* Archive types */
enum archive_type
{
archive_none, /* No archivation requested */
archive_directory, /* Archive by moving files to a separate directory
hierarchy */
archive_tar /* Archive by appending to a tar file (tar -r) */
};
struct archive_descr
{
enum archive_type type; /* Archivation type */
char *name; /* Directory name if type==archive_directory,
archive file name if type==archive_tar */
enum backup_type backup_type; /* Requested backup type if
type == archive_directory */
};
/* Type of file in a triplet */
enum file_type
{
file_dist, /* Something to be distributed */
file_signature, /* Detached signature (.sig) */
file_directive, /* Directive (.directive.asc) */
};
#define FILE_TYPE_COUNT (file_directive+1)
/* Part of a triplet */
struct file_info
{
enum file_type type; /* Part type */
char *name; /* File name */
unsigned root_len; /* Length of root part in name */
struct stat sb;
};
struct uploader_info
{
struct uploader_info *next;
char *name;
char *realname;
char *email;
char *gpg_key;
char *fpr;
};
/* File triplet */
struct file_triplet
{
char *name; /* Triplet base name */
struct file_info file[FILE_TYPE_COUNT]; /* Components */
const struct spool *spool; /* Owning spool */
char *relative_dir; /* Directory relative to spool->dest_dir */
char **directive; /* Decoded directive pairs (key: value\0) */
char *blurb; /* Block of directives: directive[i] points here */
char *tmp; /* Temporary storage */
size_t tmpsize; /* Size of memory allocated in tmp */
struct txtacc *acc; /* Text accumulator for string allocation */
/* User data */
size_t uploader_count;
struct uploader_info *uploader_list;
struct uploader_info *uploader;
/* Special data for template formatting */
char *project; /* Triplet project name (if known) */
int check_result; /* Result of external check */
char *check_diag; /* External check diagnostics */
};
/* Macros to access owner UID and GID. */
/* The directive file is always present in the triplet */
#define TRIPLET_UID(t) ((t)->file[file_directive].sb.st_uid)
/* GID is filled in after the triplet is finalized and verified */
#define TRIPLET_GID(t) ((t)->file[file_directive].sb.st_gid)
struct virt_tab
{
int (*test_url) (mu_url_t url, grecs_locus_t *loc);
int (*move_file) (struct file_triplet *trp, enum file_type file_id);
int (*archive_file) (struct file_triplet *trp, const char *file_name);
int (*symlink_file) (struct file_triplet *trp,
const char *wanted_src,
const char *wanted_dst);
int (*rmsymlink_file)(struct file_triplet *trp, const char *file_name);
};
/* An upload spool. This structure contains all data necessary for releasing
files from source to destination */
struct spool
{
char *tag;
struct grecs_list *aliases;
char *url; /* Download URL */

Return to:

Send suggestions and report system problems to the System administrator.