-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlts-wayland-rename
executable file
·86 lines (62 loc) · 2.38 KB
/
lts-wayland-rename
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
#!/bin/bash
ltsq=$(grep "^[#]*libdrm-intel1" "${rename_mapping_file}" | cut -d- -f3)
if [ -z "${ltsq}" ]; then
echo "Could not get name for ltsq"
exit 1
fi
set -e
# debian/control
# the only package not to have conflicts/replaces/provides
${basedir}/dpkg-control \
--source-suffix ${suffix} \
--binary-suffix ${suffix} \
--mapping-file "${rename_mapping_file}" \
> debian/control.new
# .. except in libwayland-dev renamed, which is special
conflicts="Conflicts: libwayland-dev, libwayland-dev-renamed, ${extraconflicts}"
provides="Provides: libwayland-dev, libwayland-dev-renamed, ${extraprovides}"
# add conflicts to libwayland-dev
sed -e "/Package: libwayland-dev-${suffix}\$/s@\$@\n${conflicts}\n${provides}@" -i debian/control.new
mv -v debian/control.new debian/control
# debian/rules fixes
cp debian/rules debian/rules.new
# big mess, since we're special
sed -e "s/libwayland/&_${ltsq}/" -i debian/libwayland-dev.install
mv debian/libwayland-dev.install debian/libwayland-dev-${suffix}.install
sed -e /^SOURCE/s/=.*/=${new_package}/ -i debian/rules.new
for ipkg in 0 -client0 -server0 -cursor0; do
newpkg="libwayland-${ltsq}${ipkg}"
pkg="libwayland${ipkg}"
[ -f "debian/${pkg}.install" ] || continue
sed -e "/PACKAGE/s/=${pkg}/=${newpkg}/" -i debian/rules.new
echo "- Renaming ${pkg}.* files to ${newpkg}.*"
set +e
files=$(ls debian/${pkg}.*)
err=$?
set -e
if [ $err -ne 0 ]; then
echo "Failed to list in ${old_package} for ${old_package} -> ${new_package}"
continue
fi
for old_file in $files; do
new_file=${old_file/${pkg}/${newpkg}}
mv -v ${old_file} ${new_file}
# TODO: Maybe using 'rename' would be better?
done
# fixup symbols
sed -e "s/ ${pkg} / ${newpkg} /" -i debian/${newpkg}.symbols*
sed -e "s/${pkg}/${newpkg}/g" -i debian/rules.new
# we're renaming the sonames too, fix those up..
sed -e "s/^libwayland/&_${ltsq}/" -i debian/${newpkg}.symbols*
# and of course the install stuff
sed -e "s/libwayland/&_${ltsq}/" -i debian/${newpkg}.install
done
mv debian/rules.new debian/rules
sed -e "s/-lwayland/&_${ltsq}/" -i */*.pc.in
sed -e "s/^libwayland/&_${ltsq}/" -i */Makefile.am
for n in util client server cursor; do
sed -e "s/libwayland-${n}\\.la/libwayland_${ltsq}-${n}.la/" \
-i */Makefile.am
done
debuild --source-option=--auto-commit -S -sa
cd ..