blob: 22d09bd22d63968b76d5e97568f4d22ec2fff442 (
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
|
/*
* Copyright (c) 2007, Novell Inc.
*
* This program is licensed under the BSD license, read LICENSE.BSD
* for further information
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "pool.h"
#include "repo_solv.h"
#include "repo_write.h"
#include "attr_store.h"
#include "attr_store_p.h"
int
main(int argc, char **argv)
{
Repo *repo;
Pool *pool;
int i;
FILE *fp;
if (argc == 1)
{
printf ("%s repo.solv one.attr [more.attr ...] > out.solv\n", argv[0]);
exit (1);
}
if ((fp = fopen (argv[1], "r")) == 0)
{
perror (argv[1]);
exit (1);
}
pool = pool_create ();
repo = repo_create (pool, argv[1]);
repo_add_solv (repo, fp);
fclose (fp);
for (i = 2; i < argc; i++)
{
if ((fp = fopen (argv[i], "r")) == 0)
{
perror (argv[1]);
exit (1);
}
Attrstore *s = attr_store_read (fp, pool);
fclose (fp);
/* XXX We should probably use the basename here.
And calculate the SHA1 sum of the file and store it. */
repo_add_attrstore (repo, s, argv[i]);
}
repo_write(repo, stdout);
pool_free(pool);
exit(0);
}
|