38
38
For each source package check:
39
39
- if tracking is enabled and there is a .log or .changes file
40
40
for the given arch -> SKIP
41
- if there is a binary package for the given architecture -> SKIP
41
- if there is a binary package for the given architecture -> SKIP
42
42
- if the package's Architecture field excludes this arch -> SKIP
43
43
- if the package's Binary field only lists existing ones
44
44
(i.e. architecture all) -> SKIP
53
53
memset(found_binary, 0, sizeof(bool)*binary->count);
54
for( i = 0 ; i < tp->filekeys.count ; i++ ) {
54
for (i = 0 ; i < tp->filekeys.count ; i++) {
55
55
enum filetype ft = tp->filetypes[i];
56
56
const char *fk = tp->filekeys.values[i];
58
if( ft == ft_XTRA_DATA )
58
if (ft == ft_XTRA_DATA)
60
if( ft == ft_ALL_BINARY ) {
60
if (ft == ft_ALL_BINARY) {
63
63
/* determine which binary files are arch all
65
for( j = 0 ; j < binary->count ; j++ ) {
65
for (j = 0 ; j < binary->count ; j++) {
66
66
const char *b = binary->values[j];
67
67
size_t l = strlen(b);
69
if( strncmp(fk, b, l) == 0 &&
69
if (strncmp(fk, b, l) == 0 &&
71
71
found_binary[j] = true;
75
if( ft == ft_ARCH_BINARY ) {
75
if (ft == ft_ARCH_BINARY) {
76
76
const char *a = strrchr(fk, '_');
81
if( strncmp(a, archstring, archstringlen) != 0 ||
82
a[archstringlen] != '.' )
81
if (strncmp(a, archstring, archstringlen) != 0 ||
82
a[archstringlen] != '.')
84
84
/* found an .deb with this architecture,
85
85
so nothing is to be done */
86
86
return RET_NOTHING;
88
if( ft == ft_LOG || ft == ft_CHANGES ) {
88
if (ft == ft_LOG || ft == ft_CHANGES) {
89
89
const char *a = strrchr(fk, '_');
95
while( (e = strchr(a, '+')) != NULL ) {
96
if( (size_t)(e-a) != archstringlen ) {
95
while ((e = strchr(a, '+')) != NULL) {
96
if ((size_t)(e-a) != archstringlen) {
100
if( memcmp(a, archstring, archstringlen) != 0 ){
100
if (memcmp(a, archstring, archstringlen) != 0){
105
105
return RET_NOTHING;
107
107
e = strchr(a, '.');
110
if( (size_t)(e-a) != archstringlen ) {
110
if ((size_t)(e-a) != archstringlen) {
114
if( memcmp(a, archstring, archstringlen) != 0 ){
114
if (memcmp(a, archstring, archstringlen) != 0){
122
122
/* nothing for this architecture was found, check if is has any binary
123
123
packages that are lacking: */
124
for( i = 0 ; i < binary->count ; i++ ) {
125
if( !found_binary[i] ) {
124
for (i = 0 ; i < binary->count ; i++) {
125
if (!found_binary[i]) {
126
126
printf("%s %s %s\n",
127
127
sourcename, sourceversion,
138
138
/*@null@*/ const char *glob;
141
static retvalue check_source_needs_build(UNUSED(struct database *database), struct distribution *distribution, struct target *target, const char *sourcename, const char *control, void *data) {
141
static retvalue check_source_needs_build(struct distribution *distribution, struct target *target, const char *sourcename, const char *control, void *data) {
142
142
struct needbuild_data *d = data;
143
143
char *sourceversion;
144
144
struct strlist binary, architectures, filekeys;
149
if( d->glob != NULL && !globmatch(sourcename, d->glob) )
149
if (d->glob != NULL && !globmatch(sourcename, d->glob))
150
150
return RET_NOTHING;
152
152
r = target->getversion(control, &sourceversion);
155
155
r = chunk_getwordlist(control, "Architecture", &architectures);
157
157
bool skip = true;
159
for( i = 0 ; i < architectures.count ; i++ ) {
159
for (i = 0 ; i < architectures.count ; i++) {
160
160
const char *a = architectures.values[i];
161
if( strcmp(a, "any") == 0 ) {
161
if (strcmp(a, "any") == 0) {
165
if( strcmp(a, atoms_architectures[
166
d->architecture]) == 0 ) {
165
if (strcmp(a, atoms_architectures[
166
d->architecture]) == 0) {
171
171
strlist_done(&architectures);
173
173
free(sourceversion);
174
174
return RET_NOTHING;
177
177
r = chunk_getwordlist(control, "Binary", &binary);
178
if( !RET_IS_OK(r) ) {
179
179
free(sourceversion);
182
182
r = target->getfilekeys(control, &filekeys);
183
if( !RET_IS_OK(r) ) {
184
184
strlist_done(&binary);
185
185
free(sourceversion);
188
for( i = 0 ; i < filekeys.count ; i++ ) {
189
if( endswith(filekeys.values[i], ".dsc") ) {
188
for (i = 0 ; i < filekeys.count ; i++) {
189
if (endswith(filekeys.values[i], ".dsc")) {
190
190
dscfilename = filekeys.values[i];
194
if( dscfilename == NULL ) {
194
if (dscfilename == NULL) {
196
196
"Warning: source package '%s' in '%s' without dsc file!\n",
197
197
sourcename, target->identifier);
201
201
return RET_NOTHING;
204
if( d->tracks != NULL ) {
204
if (d->tracks != NULL) {
205
205
struct trackedpackage *tp;
207
207
r = tracking_get(d->tracks, sourcename, sourceversion, &tp);
208
if( RET_WAS_ERROR(r) ) {
208
if (RET_WAS_ERROR(r)) {
209
209
free(sourceversion);
210
210
strlist_done(&binary);
211
211
strlist_done(&filekeys);
215
215
r = tracked_source_needs_build(
216
216
d->architecture, sourcename,
217
217
sourceversion, dscfilename,
222
222
strlist_done(&filekeys);
225
fprintf(stderr, "Warning: %s's tracking data of %s (%s) is out of date. Run retrack to repair!\n", distribution->codename, sourcename, sourceversion);
226
"Warning: %s's tracking data of %s (%s) is out of date. Run retrack to repair!\n",
227
distribution->codename,
228
sourcename, sourceversion);
227
230
// TODO: implement without tracking
228
231
free(sourceversion);
235
retvalue find_needs_build(struct database *database, struct distribution *distribution, architecture_t architecture, const struct atomlist *onlycomponents, const char *glob) {
238
retvalue find_needs_build(struct distribution *distribution, architecture_t architecture, const struct atomlist *onlycomponents, const char *glob) {
236
239
retvalue result, r;
237
240
struct needbuild_data d;
239
242
d.architecture = architecture;
242
if( distribution->tracking == dt_NONE ) {
245
if (distribution->tracking == dt_NONE) {
244
247
"ERROR: '%s' has no source package Tracking enabled and\n"
245
248
"build-needing is currently only implemented for distributions where\n"
250
253
return RET_ERROR;
253
if( distribution->tracking != dt_NONE ) {
254
r = tracking_initialize(&d.tracks, database, distribution, true);
255
if( RET_WAS_ERROR(r) )
256
if (distribution->tracking != dt_NONE) {
257
r = tracking_initialize(&d.tracks, distribution, true);
258
if (RET_WAS_ERROR(r))
257
if( r == RET_NOTHING )
260
if (r == RET_NOTHING)
262
result = distribution_foreach_package_c(distribution, database,
265
result = distribution_foreach_package_c(distribution,
263
266
onlycomponents, architecture_source, pt_dsc,
264
267
check_source_needs_build, &d);