Ubuntu Pastebin

Paste from vorlon at Mon, 3 Aug 2015 22:26:37 +0000

Download as text
  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
#!/bin/sh

set -e

bendir=/home/vorlon/devel/canonical/ubuntu-transition-tracker-configs/monitor/ongoing

dry_run=false
no_update=false

while [ $# -gt 0 ]; do
        case $1 in
                --dry-run)
                        dry_run=:
                        ;;
		--no-update)
			no_update=:
			;;
                *)
                        echo "Unknown argument: $1"
                        exit 1
                        ;;
        esac
        shift
done

rename_package() {
	oldpkg="$1"
	newpkg="$2"
	if [ -z "$1" ] || [ -z "$2" ]; then
		echo "Error: rename_package called with args '$@'"
		return 1
	fi

	# warning: sed can be hazardous to your mental health.
	sed -i -e"s/\([ |,=/]\)$oldpkg\([ |,:]\|$\)/\1$newpkg\2/g" \
		debian/control debian/control.in debian/rules
	if sed -n -e"/^Package:[[:space:]]*$newpkg[[:space:]]*\$/,/^Package:/p" debian/control \
	   | grep -q Conflicts:
	then
		sed -i -e"/^Package:[[:space:]]*$newpkg[[:space:]]*\$/,/^Package:/ { s/^Conflicts:/& $oldpkg,/; }" \
			debian/control debian/control.in
	else
		sed -i -e"/^Package:[[:space:]]*$newpkg[[:space:]]*\$/,/^Package:/ { /^Description:/i\\" \
		    -e "Conflicts: $oldpkg" -e '}' \
			debian/control debian/control.in
	fi
	if sed -n -e"/^Package:[[:space:]]*$newpkg[[:space:]]*\$/,/^Package:/p" debian/control \
	   | grep -q Replaces:
	then
		sed -i -e"/^Package:[[:space:]]*$newpkg[[:space:]]*\$/,/^Package:/ { s/^Replaces:/& $oldpkg,/; }" \
			debian/control debian/control.in
	else
		sed -i -e"/^Package:[[:space:]]*$newpkg[[:space:]]*\$/,/^Package:/ { /^Description:/i\\" \
		    -e "Replaces: $oldpkg" -e '}' \
			debian/control debian/control.in
	fi
	for dh_old in debian/$oldpkg.*; do
		if [ -e "$dh_old" ]; then
			dh_new=$(echo $dh_old | sed -e"s/$oldpkg/$newpkg/")
			mv -v $dh_old $dh_new
			sed -i -e"s/\(^\|[ |,/]\)$oldpkg\([ |,:/]\|$\)/\1$newpkg\2/g" $dh_new
		fi
	done
	echo "# G++5 ABI transition" >> debian/$newpkg.lintian-overrides
	echo "$newpkg: package-name-doesnt-match-sonames ${oldpkg}" >> debian/$newpkg.lintian-overrides

}

if ! $no_update; then
	echo '========== Downloading Debian build logs =========='
	wget -q --mirror -nH --cut-dirs=3 -np -R '*index.html*' -P "debian-build-logs" \
		https://people.debian.org/~doko/logs/gcc5-20150701/
fi

echo '=============== Rebuilding packages ==============='
for F in debian-build-logs/*.log
do
	srcpkg=$(basename ${F%%_*})
	echo "Source package: $srcpkg"
	if [ -e blacklist.txt ] && grep -q "^$srcpkg\$" blacklist.txt
	then
		echo "  package blacklisted; skipping"
		continue
	fi

	if ! binpkgs=$(awk '/===== BEGIN GCC CXX11 symbols/ { print $6 }' $F | grep -v DEBIAN/symbols | sort -u)
	then
		echo "Error: no binary packages found in log for $srcpkg"
		continue
	fi
	if nonnumpkgs=$(echo "$binpkgs" | grep -v '[0-9]$'); then
		echo "Skipping non-numeric bin packages: $nonnumpkgs"
	fi
	if ! binpkgs=$(echo "$binpkgs" | grep '[0-9]$'); then
		continue
	fi
	binpkgs=$(echo $binpkgs)

	# Find the most recent available source package known to us and check
	# its binaries.  Better done with launchpadlib, but requires switching
	# to python (which is probably sensible anyway, but grep-dctrl)
	# But it can definitely give a wrong answer relative to pull-lp-source.
	# hopefully sort's -V comparison gives us the right answer in most cases
	latestver=$(apt-cache showsrc "$srcpkg" | grep-dctrl -n -FPackage -X "$srcpkg" -sVersion -n | sort -V | tail -n1)
	latestbinlist=$(apt-cache showsrc "$srcpkg" | grep-dctrl -FPackage -X "$srcpkg" -a -FVersion -X "$latestver" -sBinary -n)
	rename_needed=false
	for binpkg in $binpkgs; do
		if echo $latestbinlist | grep -q "\(^\| \)$binpkg\(, \|$\)"; then
			echo "$binpkg still present in latest source, update needed."
			rename_needed=:
			break
		fi
	done
	if ! $rename_needed; then
		echo "$srcpkg has already been transitioned (old binaries: $binpkgs; current binaries: $latestbinlist)"
		continue
	fi

	echo "Rebuilding $srcpkg"
	if $dry_run; then
		continue
	fi

	pull-lp-source $srcpkg
	build_failed=false
	(cd ${srcpkg}-*
	 dch 'Rename library packages for g++5 ABI transition.'

	 for binpkg in $binpkgs; do
		# FIXME: we should also handle dbg packages of the same name.
		newpkg=${binpkg}v5
		rename_package "$binpkg" "$newpkg"
		case $latestbinlist in
			*${binpkg}-dbg*)
				rename_package "${binpkg}-dbg" "${newpkg}-dbg"
				;;
			*) ;;
		esac
	 done
	 update-maintainer
	 dch -r -D wily ''
	 sudo mk-build-deps -i -r -t 'apt-get --no-install-recommends -y'
	 debuild -S
	) || build_failed=:

	if $build_failed; then
		rm -r ${srcpkg}[-_]*
		continue
	fi

	fname="$bendir/${srcpkg}-g++5.ben"
	affected=
	good=
	bad=
	for binpkg in $binpkgs; do
		oldpkg=$(echo $binpkg | sed -e's/\+/\\+/g')
		newpkg=${oldpkg}v5
		affected="$affected${affected:+|}$oldpkg|$newpkg"
		good="$good${good:+|}$newpkg"
		bad="$bad${bad:+|}$oldpkg"
		case $latestbinlist in
			*${binpkg}-dbg*)
				oldpkg=$(echo $binpkg | sed -e's/\+/\\+/g')-dbg
				newpkg=${oldpkg}v5-dbg
				affected="$affected${affected:+|}$oldpkg|$newpkg"
				good="$good${good:+|}$newpkg"
				bad="$bad${bad:+|}$oldpkg"
				;;
			*) ;;
		esac
	done
	echo 'title = "'"$srcpkg g++5 ABI transition"'";' > $fname
	echo "is_affected = .depends ~ /(^| )($affected)\s*([,(:]|$)/;" >> $fname
	echo "is_good = .depends ~ /(^| )($good)\s*([,(:]|$)/;" >> $fname
	echo "is_bad = .depends ~ /(^| )($bad)\s*([,(:]|$)/;" >> $fname
	(cd $bendir; bzr add $(basename $fname))

	if [ -n "$(find ${srcpkg}-*/debian -maxdepth 1 -name '*.symbols*' -print)" ]
	then
		echo "Error: package $srcpkg uses symbols files, needs manual attention."
		exit 1
	fi

	dput ${srcpkg}*_source.changes
	rm -r ${srcpkg}[-_]*
done
Download as text