File: get_and_diffoscope

package info (click to toggle)
firefox 146.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,653,260 kB
  • sloc: cpp: 7,587,892; javascript: 6,509,455; ansic: 3,755,295; python: 1,410,813; xml: 629,201; asm: 438,677; java: 186,096; sh: 62,697; makefile: 18,086; objc: 13,087; perl: 12,811; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10; exp: 6
file content (115 lines) | stat: -rw-r--r-- 2,357 bytes parent folder | download | duplicates (12)
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
#!/bin/bash

set -e
set -x
set -o pipefail

cd /builds/worker

mkdir a b

# /builds/worker/bin contains wrapper binaries to divert what diffoscope
# needs to use, so it needs to appear first.
export PATH=/builds/worker/bin:$PATH

# Until https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879010 is
# implemented, it's better to first manually extract the data.
# Plus dmg files are not supported yet.

RESOURCE_DIR=firefox
case "$ORIG_URL" in
*.zip|*.apk)
	curl -L "$ORIG_URL" > a.zip
	curl -L "$NEW_URL" > b.zip
	unzip -d a a.zip
	unzip -d b b.zip
	;;
*.tar.zst)
	curl -L "$ORIG_URL" | tar -C a --zstd -xf -
	curl -L "$NEW_URL" | tar -C b --zstd -xf -
	;;
*.tar.bz2)
	curl -L "$ORIG_URL" | tar -C a -jxf -
	curl -L "$NEW_URL" | tar -C b -jxf -
	;;
*.tar.xz)
	# Account for comparing with old bz2 format
	curl -L "$ORIG_URL" | tar -C a -Jxf -
	curl -L "$NEW_URL" | tar -C b -Jxf -
	;;
*.tar.gz)
	curl -L "$ORIG_URL" | tar -C a -zxf -
	curl -L "$NEW_URL" | tar -C b -zxf -
	;;
*.dmg)
	for tool in lipo otool; do
		ln -s $MOZ_FETCHES_DIR/cctools/bin/x86_64-apple-darwin*-$tool bin/$tool
	done
	curl -L "$ORIG_URL" > a.dmg
	curl -L "$NEW_URL" > b.dmg
	for i in a b; do
		$MOZ_FETCHES_DIR/dmg/dmg extract $i.dmg $i.hfs
		$MOZ_FETCHES_DIR/dmg/hfsplus $i.hfs extractall / $i
	done
	RESOURCE_DIR=$(cd b; echo */Contents/Resources)
	;;
*)
	ARTIFACT=$(basename "${ORIG_URL}")
	curl -L "$ORIG_URL" > "a/${ARTIFACT}"
	curl -L "$NEW_URL" > "b/${ARTIFACT}"
esac

case "$ORIG_URL" in
*/target.apk)
	OMNIJAR=assets/omni.ja
	;;
*)
	OMNIJAR=omni.ja
	;;
esac

# Builds are 99% of the time differing in some small ways, so it's not
# really useful to report a failure (at least not until we actually
# care about the builds being 100% identical).
POST=true

fail() {
	exit 1
}

for option; do
	case "$option" in
	--unpack)
		CURDIR=$PWD
		for dir in a b; do
			# Need to run mach python from inside the gecko source.
			# See bug #1533642.
			(cd $GECKO_PATH && ./mach python toolkit/mozapps/installer/unpack.py --omnijar $OMNIJAR "$CURDIR/$dir/$RESOURCE_DIR")
		done
		;;
	--fail)
		POST="fail"
		;;
	*)
		echo "Unsupported option: $option" >&2
		exit 1
	esac
done

if [ -n "$PRE_DIFF" ]; then
	eval $PRE_DIFF
fi

if eval diffoscope \
	--html diff.html \
	--text diff.txt \
	--progress \
	$DIFFOSCOPE_ARGS \
	a b
then
	# Ok
	:
else
	$(dirname $0)/report_error diff
	$POST
fi