1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
** This C program generates the "VERSION.h" header file from information
** extracted out of the "manifest", "manifest.uuid", and "VERSION" files.
** Call this program with three arguments:
**
** ./a.out manifest.uuid manifest VERSION
**
** Note that the manifest.uuid and manifest files are generated by Fossil.
**
** The output becomes the "VERSION.h" file. The output is a C-language
** header that contains #defines for various properties of the build:
**
** MANIFEST_UUID These values are text strings that
** MANIFEST_VERSION identify the Fossil check-in to which
** the source tree belongs. They do not
** take into account any uncommitted edits.
**
** FOSSIL_BUILD_HASH A hexadecimal string that is a strong hash
** of the MANIFEST_UUID together with the
** current time of the build. We normally want
** this to be different on each build, as the
** value is used to expire ETag: fields in
** HTTP requests. But if you need to do
** repeatable byte-for-byte identical builds,
** add the -DFOSSIL_BUILD_EPOCH=n option.
**
** MANIFEST_DATE The date/time of the source-code check-in
** MANIFEST_YEAR in various formats.
** MANIFEST_NUMERIC_DATE
** MANIFEST_NUMERIC_TIME
**
** RELEASE_VERSION The version number (from the VERSION source
** RELEASE_VERSION_NUMBER file) in various format.
** RELEASE_RESOURCE_VERSION
**
** New #defines may be added in the future.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
+
+
+
+
+
|
fclose(u);
for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
*z = 0;
printf("#define MANIFEST_UUID \"%s\"\n",b);
printf("#define MANIFEST_VERSION \"[%10.10s]\"\n",b);
n = strlen(b);
if( n + 50 < sizeof(b) ){
#ifdef FOSSIL_BUILD_EPOCH
#define str(s) #s
sprintf(b+n, "%d", (int)strtoll(str(FOSSIL_BUILD_EPOCH), 0, 10));
#else
sprintf(b+n, "%d", (int)time(0));
#endif
hash(b,33,vx);
printf("#define FOSSIL_BUILD_HASH \"%s\"\n", vx);
}
m = open_for_reading(argv[2]);
while(b == fgets(b, sizeof(b)-1,m)){
if(0 == strncmp("D ",b,2)){
int k, n;
|