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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
|
#!/bin/bash
# Copyright (C) 2013, Rafael Laboissiere <rafael@laboissiere.net>
#
# 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.
#
# On Debian systems, the complete text of the GNU General Public License
# version 3 can be found in the /usr/share/common-licenses/GPL-3 file.
set -u
TESTTYPE=base
test_dir=$(readlink -f "${0%/*}")
. "$test_dir/lib_test_uscan"
SUFFIX="1"
if command -v dpkg-vendor >/dev/null; then
VENDER="$(dpkg-vendor --query Vendor 2>/dev/null|tr 'A-Z' 'a-z')"
case "$VENDER" in
debian) SUFFIX="1" ;;
*) SUFFIX="0${VENDER}1" ;;
esac
fi
if test "${1:-}" = --installed; then
COMMAND="uscan --no-conf --compression=xz"
shift
else
top_srcdir=$(readlink -f "${0%/*}/..")
make -C "$top_srcdir/scripts" uscan mk-origtargz uupdate debchange
PATH="$top_srcdir/scripts:$PATH"
export PATH
PERL5LIB="$top_srcdir/lib"
export PERL5LIB
COMMAND="uscan --no-conf --compression=xz"
fi
COMMANDDEHS="$COMMAND --dehs"
# comment out for debug
#COMMAND="$COMMAND --debug"
tearDown(){
killHttpServer
echo
}
trap tearDown EXIT
containsName(){
echo "$1" | grep -qF "$2"
echo $?
}
validXML(){
echo "$1" | perl -ne 's/<[^\/].*?>.*?<\/.*>//g;$open++ if/<[^\/].*?>/;$open-- if/<\/.*>/;if(!$open and /^\s+\w/){$false++}}{exit ($false || $open) ? 1 : 0'
echo $?
}
. "$test_dir/shunit2-helper-functions.sh"
# The following tests do the following: (1) create a minimal Debian package
# directory, containing minimal files debian/{changelog,watch,copyright},
# (2) create a minimal repository, containing a tarball (built on the fly),
# (3) start an HTTP server that works offline, using the SimpleHTTPServer
# module of Python, and (4) run uscan inside that minimal universe.
# The following function tests the --repack feature
helperTestRepack() {
from_ext="$1"
to_comp="$2"
file_output="$3"
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
mkdir -p "$TEMP_PKG_DIR"/$PKG/debian/source
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/watch
version=3
http://localhost:$PORT/$PKG-(\d).$from_ext
END
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/changelog
$PKG (0-1) unstable; urgency=low
* Initial release
-- Joe Developer <jd@debian.org> Mon, 02 Nov 2013 22:21:31 -0100
END
echo -n '3.0 (quilt)' > "$TEMP_PKG_DIR"/$PKG/debian/source/format
mkdir -p "$TEMP_PKG_DIR"/repo/foo
touch "$TEMP_PKG_DIR"/repo/foo/content
if [ "$from_ext" = "tar.zstd" ]
then
( cd "$TEMP_PKG_DIR"/repo ;
tar --zstd -cf $PKG-1.$from_ext $PKG/* )
else
( cd "$TEMP_PKG_DIR"/repo ;
tar -caf $PKG-1.$from_ext $PKG/* )
fi
OUTPUT=$( cd "$TEMP_PKG_DIR"/$PKG ; $COMMANDDEHS --repack --compression=$to_comp )
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
TARBALL=${PKG}_1.orig.tar.$to_comp
if [ "$from_ext" != "tar.$to_comp" ]
then
assertFalse 'unrepacked tarball still present' "[ -f "$TEMP_PKG_DIR"/${PKG}_1.orig.$from_ext ]"
fi
assertTrue 'pristine tarball is not created' "[ -f "$TEMP_PKG_DIR"/$TARBALL ]"
assertNotNull "pristine tarball is not $to_comp-compressed" \
"$( file -L "$TEMP_PKG_DIR"/$TARBALL | grep "$file_output" )"
CONTENTS="$(tar atf "$TEMP_PKG_DIR"/$TARBALL)"
assertTrue 'file contents missing' \
$(containsName "$CONTENTS" content)
assertTrue "malfored target in dehs output: $OUTPUT" $(validXML "$OUTPUT")
assertTrue "malfored target in dehs output: $OUTPUT" \
$(containsName "$OUTPUT" "<target>$TARBALL</target>")
}
testRepackGZ_XZ() { helperTestRepack "tar.gz" "xz" "XZ compressed data" ; }
testRepackGZ_BZ2() { helperTestRepack "tar.gz" "bz2" "bzip2 compressed data" ; }
testRepackBZ2_GZ() { helperTestRepack "tar.bz2" "gz" "gzip compressed data" ; }
testRepackGZ_GZ() { helperTestRepack "tar.gz" "gz" "gzip compressed data" ; }
testRepackXZ_XZ() { helperTestRepack "tar.xz" "xz" "XZ compressed data" ; }
testRepackTGZ_XZ() { helperTestRepack "tgz" "xz" "XZ compressed data" ; }
testRepackTGZ_XZ() { helperTestRepack "tgz" "xz" "XZ compressed data" ; }
testRepackLZ_XZ() { helperTestRepack "tar.lzma" "xz" "XZ compressed data" ; }
testRepackZST_XZ() { helperTestRepack "tar.zst" "xz" "XZ compressed data" ; }
testRepackZSTD_XZ() { helperTestRepack "tar.zstd" "xz" "XZ compressed data" ; }
# The following function tests the --repack feature, with a zip file
testRepackZip_XZ() {
to_comp=xz
file_output="XZ compressed data"
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
mkdir -p "$TEMP_PKG_DIR"/$PKG/debian/source
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/watch
version=3
http://localhost:$PORT/$PKG-(\d).zip
END
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/changelog
$PKG (0-1) unstable; urgency=low
* Initial release
-- Joe Developer <jd@debian.org> Mon, 02 Nov 2013 22:21:31 -0100
END
echo -n '3.0 (quilt)' > "$TEMP_PKG_DIR"/$PKG/debian/source/format
mkdir -p "$TEMP_PKG_DIR"/repo/foo
touch "$TEMP_PKG_DIR"/repo/foo/content
( cd "$TEMP_PKG_DIR"/repo ;
zip -q -r $PKG-1.zip * )
OUTPUT=$( (cd "$TEMP_PKG_DIR"/$PKG ; $COMMANDDEHS --repack --compression=$to_comp) )
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
TARBALL=${PKG}_1.orig.tar.$to_comp
assertTrue 'unrepacked zipfile present' "[ -f "$TEMP_PKG_DIR"/${PKG}-1.zip ]"
assertTrue 'pristine tarball is not created' "[ -f "$TEMP_PKG_DIR"/$TARBALL ]"
assertNotNull "pristine tarball is not $to_comp-compressed" \
"$( file -L "$TEMP_PKG_DIR"/$TARBALL | grep "$file_output" )"
CONTENTS="$(tar atf "$TEMP_PKG_DIR"/$TARBALL)"
assertTrue 'file contents missing' \
$(containsName "$CONTENTS" content)
assertTrue "malfored target in dehs output: $OUTPUT" $(validXML "$OUTPUT")
assertTrue "malfored target in dehs output: $OUTPUT" \
$(containsName "$OUTPUT" "<target>$TARBALL</target>")
}
# The following function tests the Files-Excluded feature of uscan, which
# allows the selective exclusion of files from the upstream tarball before
# repacking it.
helperCreateRepo () {
mkdir -p $PKG/debian
cat <<END > $PKG/debian/watch
version=3
${OPTS:-}http://localhost:$PORT/$PKG-(\d).tar.gz debian ${SCRIPT:-}
END
cat <<END > $PKG/debian/changelog
$PKG (0+dfsg1-$SUFFIX) unstable; urgency=low
* Initial release
-- Joe Developer <jd@debian.org> Mon, 02 Nov 2013 22:21:31 -0100
END
cat <<'END' > $PKG/debian/copyright
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files-Excluded: exclude-this
exclude-dir
.*
*/js/jquery.js
;?echo?baz;?#
END
if [ -n "${SRCFORMAT:-}" ]; then
mkdir -p $PKG/debian/source
echo "$SRCFORMAT" > $PKG/debian/source/format
fi
mkdir -p repo
touch repo/include-this
touch repo/exclude-this
touch repo/.hidden
mkdir -p "repo/; echo baz; #/"
mkdir -p repo/exclude-dir
touch repo/exclude-dir/file
mkdir -p repo/exclude-dir/subdir
touch repo/exclude-dir/subdir/file2
mkdir -p repo/docs/html/js/
touch repo/docs/html/js/jquery.js
}
helperTestContent() {
assertTrue 'file that must be present is excluded in the tarball' \
$(containsName "$CONTENTS" include-this)
assertFalse 'file that must be excluded is present in the tarball' \
$(containsName "$CONTENTS" exclude-this)
assertFalse "dir that must be excluded is present in the tarball" \
$(containsName "$CONTENTS" exclude-dir)
assertFalse "subdir that must be excluded is present in the tarball" \
$(containsName "$CONTENTS" subdir)
assertFalse "non-root-file that must be excluded is present in the tarball" \
$(containsName "$CONTENTS" jquery.js)
assertFalse "hidden file that must be excluded is present in the zip file" \
$(containsName "$CONTENTS" .hidden)
assertFalse "path with whitespace that must be excluded is present" \
$(containsName "$CONTENTS" "; echo baz; #/")
}
testFileExclusion() {
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
(
cd "$TEMP_PKG_DIR"
OPTS="opts=repacksuffix=+dfsg1,dversionmangle=s/@DEB_EXT@// "
SCRIPT="uupdate"
SRCFORMAT="3.0 (quilt)"
helperCreateRepo
cd repo
tar cfz $PKG-1.tar.gz * .hidden )
(cd "$TEMP_PKG_DIR"/$PKG ; $COMMAND)
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
TARBALL=${PKG}_1+dfsg1.orig.tar.xz
assertTrue 'downloaded tarfile not present' "[ -f "$TEMP_PKG_DIR"/${PKG}-1.tar.gz ]"
assertTrue 'pristine tarball is not created' "[ -f "$TEMP_PKG_DIR"/$TARBALL ]"
assertFalse 'pristine tarball is a symlink (nothing repacked?)' "[ -L "$TEMP_PKG_DIR"/$TARBALL ]"
assertNotNull 'pristine tarball is not XZ-compressed' \
"$( file "$TEMP_PKG_DIR"/$TARBALL | grep -i 'XZ compressed data' )"
CONTENTS="$(tar atf "$TEMP_PKG_DIR"/$TARBALL)"
helperTestContent
# check uupdate
assertTrue 'pristine tarball is not extracted' "[ -f "$TEMP_PKG_DIR"/${PKG}-1+dfsg1/debian/changelog ]"
DVERSION=`dpkg-parsechangelog -l"$TEMP_PKG_DIR"/${PKG}-1+dfsg1/debian/changelog -SVersion`
assertEquals "uscan: Version should be 1+dfsg1-$SUFFIX but $DVERSION" "$DVERSION" "1+dfsg1-$SUFFIX"
}
# the same, but run from a separate directory (no way for uupdate, just download)
testFileExclusionSeparateDir() {
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
(
cd "$TEMP_PKG_DIR"
SCRIPT=""
OPTS="opts=repacksuffix=+dfsg1,dversionmangle=auto "
helperCreateRepo
cd repo
tar cfz $PKG-1.tar.gz * .hidden )
mkdir "$TEMP_PKG_DIR"/otherdir
(
cd "$TEMP_PKG_DIR"/otherdir;
$COMMAND --package $PKG --force-download --upstream-version 1 \
--watchfile ../$PKG/debian/watch --copyright-file ../$PKG/debian/copyright
)
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
TARBALL=${PKG}_1+dfsg1.orig.tar.xz
assertTrue 'downloaded tarfile not present' "[ -f "$TEMP_PKG_DIR"/${PKG}-1.tar.gz ]"
assertTrue 'pristine tarball is not created' "[ -f "$TEMP_PKG_DIR"/$TARBALL ]"
assertFalse 'pristine tarball is a symlink (nothing repacked?)' "[ -L "$TEMP_PKG_DIR"/$TARBALL ]"
assertNotNull 'pristine tarball is not XZ-compressed' \
"$( file "$TEMP_PKG_DIR"/$TARBALL | grep -i 'XZ compressed data' )"
CONTENTS="$(tar atf "$TEMP_PKG_DIR"/$TARBALL)"
helperTestContent
}
# The same, for a zip file that is being repacked
testFileExclusionZipToTar() {
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
(
cd "$TEMP_PKG_DIR"
SRCFORMAT="3.0 (quilt)"
helperCreateRepo
cat <<END > $PKG/debian/watch
version=3
opts=repacksuffix=+dfsg1,dversionmangle=s/@DEB_EXT@// http://localhost:$PORT/$PKG-(\d).zip debian uupdate
END
cd repo
zip -q -r $PKG-1.zip * .hidden )
(cd "$TEMP_PKG_DIR"/$PKG ; $COMMAND --repack)
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
TARBALL=${PKG}_1+dfsg1.orig.tar.xz
assertTrue 'unrepacked zipfile not present' "[ -f "$TEMP_PKG_DIR"/${PKG}-1.zip ]"
assertTrue 'pristine tarball is not created' "[ -f "$TEMP_PKG_DIR"/$TARBALL ]"
assertNotNull 'pristine tarball is not xz-compressed' \
"$( file "$TEMP_PKG_DIR"/$TARBALL | grep 'XZ compressed data' )"
CONTENTS="$(tar atf "$TEMP_PKG_DIR"/$TARBALL)"
helperTestContent
# check uupdate
assertTrue 'pristine tarball is not extracted' "[ -f "$TEMP_PKG_DIR"/${PKG}-1+dfsg1/debian/changelog ]"
DVERSION=`dpkg-parsechangelog -l"$TEMP_PKG_DIR"/${PKG}-1+dfsg1/debian/changelog -SVersion`
assertEquals "uscan: Version should be 1+dfsg1-$SUFFIX but $DVERSION" "$DVERSION" "1+dfsg1-$SUFFIX"
}
testPlainMode() {
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
mkdir -p "$TEMP_PKG_DIR"/$PKG/debian
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/watch
version=4
opts="searchmode=plain" \
http://localhost:$PORT/src.json http://localhost:$PORT/foo-(\d).zip
END
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/changelog
$PKG (0-1) unstable; urgency=low
* Initial release
-- Joe Developer <jd@debian.org> Mon, 02 Nov 2013 22:21:31 -0100
END
mkdir -p "$TEMP_PKG_DIR"/repo/foo
touch "$TEMP_PKG_DIR"/repo/foo/content
( cd "$TEMP_PKG_DIR"/repo ;
zip -q -r $PKG-1.zip *;
cat > src.json <<END
{"1.0":{"tarball":"http://localhost:$PORT/foo-1.zip"}}
END
)
OUTPUT=$( (cd "$TEMP_PKG_DIR"/$PKG ; $COMMANDDEHS) )
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
TARBALL=${PKG}_1.orig.tar.$to_comp
assertTrue 'unrepacked zipfile present' "[ -f "$TEMP_PKG_DIR"/${PKG}-1.zip ]"
}
testLinksWithRelativeBase() {
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
to_comp=xz
mkdir -p "$TEMP_PKG_DIR"/$PKG/debian
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/watch
version=4
http://localhost:$PORT/foo/index.html foo-([\d\.]+).zip
END
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/changelog
$PKG (0-1) unstable; urgency=low
* Initial release
-- Joe Developer <jd@debian.org> Mon, 02 Nov 2013 22:21:31 -0100
END
mkdir -p "$TEMP_PKG_DIR"/repo/foo
touch "$TEMP_PKG_DIR"/repo/foo/content
for href in foo-1.zip /foo/foo-1.zip //localhost:$PORT/foo/foo-1.zip ../foo/foo-1.zip x/../../foo/foo-1.zip; do
( cd "$TEMP_PKG_DIR"/repo/foo ;
zip -q -r $PKG-1.zip *;
zip -q -r $PKG-0.9.zip *;
cat > index.html <<END
<html><body>
<base href="/foo/" />
<a href="$href">foo-1.zip</a>
</body></html>
END
)
(cd "$TEMP_PKG_DIR"/$PKG ; $COMMAND)
assertEquals "uscan: exit_code!=0 but exit_code=0 with $href" "$?" "0"
done
assertTrue 'unrepacked zipfile present' "[ -f "$TEMP_PKG_DIR"/${PKG}-1.zip ]"
}
testComponentDehsOutput() {
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
mkdir -p "$TEMP_PKG_DIR"/$PKG/debian
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/watch
version=4
http://localhost:$PORT/$PKG-(\d).zip debian
opts="searchmode=plain,component=baz" \
http://localhost:$PORT/src.json http://localhost:$PORT/foo-(\d).zip
END
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/changelog
$PKG (0-1) unstable; urgency=low
* Initial release
-- Joe Developer <jd@debian.org> Mon, 02 Nov 2013 22:21:31 -0100
END
mkdir -p "$TEMP_PKG_DIR"/repo/foo
touch "$TEMP_PKG_DIR"/repo/foo/content
( cd "$TEMP_PKG_DIR"/repo ;
zip -q -r $PKG-1.zip *;
cat > src.json <<END
{"1.0":{"tarball":"http://localhost:$PORT/foo-1.zip"}}
END
)
OUTPUT=$( (cd "$TEMP_PKG_DIR"/$PKG ; $COMMANDDEHS --report --dehs) )
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
assertTrue "malfored target in dehs output: $OUTPUT" $(validXML "$OUTPUT")
assertTrue "malfored target in dehs output: $OUTPUT" \
$(containsName "$OUTPUT" '<component id="baz">')
assertTrue "malfored target in dehs output: $OUTPUT" \
$(containsName "$OUTPUT" "<component-upstream-version>1</component-upstream-version>")
}
testSimpleHeader() {
PKG=foo
TEMP_PKG_DIR=$(mktemp -d -p "$SHUNIT_TMPDIR")
spawnHttpServer
PORT=$(cat "$TEMP_PKG_DIR"/repo/port)
mkdir -p "$TEMP_PKG_DIR"/$PKG/debian/source
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/watch
version=4
http://localhost:$PORT/$PKG-(\d).zip debian
opts="searchmode=plain,component=baz,filenamemangle=s/.*-(@ANY_VERSION@@ARCHIVE_EXT@)/baz-\$1/" \
http://localhost:$PORT/src.json http://localhost:$PORT/foo-(\d).zip
END
echo -n '3.0 (quilt)' > "$TEMP_PKG_DIR"/$PKG/debian/source/format
cat <<END > "$TEMP_PKG_DIR"/$PKG/debian/changelog
$PKG (0-1) unstable; urgency=low
* Initial release
-- Joe Developer <jd@debian.org> Mon, 02 Nov 2013 22:21:31 -0100
END
mkdir -p "$TEMP_PKG_DIR"/repo/foo
touch "$TEMP_PKG_DIR"/repo/foo/content
( cd "$TEMP_PKG_DIR"/repo ;
zip -q -r $PKG-1.zip *;
cat > src.json <<END
{"1.0":{"tarball":"http://localhost:$PORT/foo-1.zip"}}
END
)
OUTPUT=$( (cd "$TEMP_PKG_DIR"/$PKG ; $COMMAND -v \
--http-header http://localhost:$PORT@Simple-Token=localtoken \
--http-header http://another.com@Ext-Token=exttoken \
) )
assertEquals "uscan: exit_code!=0 but exit_code=0" "$?" "0"
assertTrue "per-host header not exported: $OUTPUT" \
$(containsName "$OUTPUT" "Set per-host custom header Simple-Token for http://localhost:$PORT/foo")
assertFalse "ext per-host header is exported: $OUTPUT" \
$(containsName "$OUTPUT" "Set per-host custom header Ext-Token")
}
. shunit2
|