14 #define mySKIPSPACE(s) { while (*(s) && isspace(*(s))) (s)++; }
15 #define mySKIPNONSPACE(s) { while (*(s) && !isspace(*(s))) (s)++; }
17 #define CVS_RCSID "$""Log: "
18 #define CVS_REVISION "Revision "
61 time_t timezone_offset;
62 char *
p, * pe, *
q, ** idx;
63 char * date = strcpy(
alloca(strlen(datestr) + 1), datestr);
64 static char * days[] =
65 {
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
NULL };
66 static char * months[] =
67 {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
68 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
NULL };
69 static char lengths[] =
70 { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
72 memset(&time, 0,
sizeof(time));
78 if (*p ==
'\0')
return -1;
80 for (idx = days; *idx &&
strcmp(*idx, p); idx++)
82 if (*idx ==
NULL)
return -1;
86 if (*p ==
'\0')
return -1;
88 for (idx = months; *idx &&
strcmp(*idx, p); idx++)
90 if (*idx ==
NULL)
return -1;
91 time.tm_mon = idx - months;
95 if (*p ==
'\0')
return -1;
101 time.tm_mday = strtol(p, &q, 10);
102 if (!(q && *q ==
'\0'))
return -1;
103 if (time.tm_mday < 0 || time.tm_mday > lengths[time.tm_mon])
return -1;
107 if (*p ==
'\0')
return -1;
109 time.tm_year = strtol(p, &q, 10);
110 if (!(q && *q ==
'\0'))
return -1;
111 if (time.tm_year < 1990 || time.tm_year >= 3000)
return -1;
112 time.tm_year -= 1900;
114 *secs = mktime(&time);
115 if (*secs == -1)
return -1;
119 timezone_offset = mktime(gmtime(secs)) - *secs;
123 *secs += timezone_offset;
129 extern time_t
get_date(
const char *
p,
void * now);
144 char *date, *
name, *text;
149 static time_t last = 0;
150 static int oneshot = 0;
158 long res = strtol(t, &te, 0);
159 if (res >= 0 && *te ==
'\0') {
180 _(
"%%changelog entries must start with *\n"));
186 while(*s && *s !=
'\n') s++;
199 for (i = 0; i < 4; i++) {
208 if (lastTime && lastTime < time) {
210 _(
"%%changelog not in descending chronological order\n"));
223 while (*s !=
'\0') s++;
224 while (s > name && isspace(*s))
243 }
while (*s && (*(s-1) !=
'\n' || *s !=
'*'));
251 if (numchangelog && (s = strstr(text,
CVS_RCSID))) {
253 while(*s && *s !=
'\n') s++;
266 if (i++ == numchangelog) {
270 while(*s && *s !=
'\n') s++;
280 while ((s > text) && (*s ==
'\n' ||
xisspace(*s))) {
291 || (last < 1000 && nentries < (
int)last)
292 || (last > 1000 && time >= last))
311 #if defined(RPM_VENDOR_MANDRIVA)
327 #if defined(RPM_VENDOR_MANDRIVA)
void addChangelogEntry(Header h, time_t time, const char *name, const char *text)
Add changelog entry to header.
rpmlog(RPMLOG_ERR,"%s\n", buf)
char * xstrdup(const char *str)
rpmiob rpmiobFree(rpmiob iob)
Destroy a I/O buffer instance.
rpmiob rpmiobAppend(rpmiob iob, const char *s, size_t nl)
Append string to I/O buffer.
enum rpmRC_e rpmRC
RPM return codes.
Yet Another syslog(3) API clone.
memset(_r, 0, sizeof(*_r))
rpmParseState isPart(Spec spec)
Check line for section separator, return next parser state.
time_t get_date(const char *p, void *now)
static int xisspace(int c)
int parseChangelog(Spec spec)
Parse %changelog section of a spec file.
The structure used to store values parsed from a spec file.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
static int dateToTimet(const char *datestr, time_t *secs)
Parse date string to seconds.
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
return strcmp(ame->name, bme->name)
This is the only module users of librpmbuild should need to include.
#define mySKIPNONSPACE(s)
enum rpmParseState_e rpmParseState
static rpmRC addChangelog(Header h, rpmiob iob)
Add changelog section to header.
int readLine(Spec spec, rpmStripFlags strip)
Read next line from spec file.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
const char * xstrtolocale(const char *str)
Force encoding of string.