~cyruslien/network-manager-applet/network-manager-applet

« back to all changes in this revision

Viewing changes to src/libnm-gtk/check-exports.sh

  • Committer: cyrus.lien at canonical
  • Date: 2016-11-30 05:14:42 UTC
  • Revision ID: cyrus.lien@canonical.com-20161130051442-1odgw3pwcqbdmuuw
Import from soruce package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
LC_ALL=C
 
4
export LC_ALL
 
5
 
 
6
stat=0
 
7
so="$1"
 
8
def="$2"
 
9
PATTERN="_ANCHOR_"
 
10
 
 
11
TMPFILE="$(mktemp .nm-check-exports.XXXXXX)"
 
12
 
 
13
 
 
14
get_syms() {
 
15
    ${NM:-nm} "$1" |
 
16
    sed -n 's/^[[:xdigit:]]\+ [DT] //p' |
 
17
    sort
 
18
}
 
19
 
 
20
get_1_0_0_syms() {
 
21
        cat <<SYMBOLS
 
22
nma_country_info_get_country_code
 
23
nma_country_info_get_country_name
 
24
nma_country_info_get_providers
 
25
nma_country_info_get_type
 
26
nma_country_info_ref
 
27
nma_country_info_unref
 
28
nma_mobile_access_method_get_3gpp_apn
 
29
nma_mobile_access_method_get_dns
 
30
nma_mobile_access_method_get_family
 
31
nma_mobile_access_method_get_gateway
 
32
nma_mobile_access_method_get_name
 
33
nma_mobile_access_method_get_password
 
34
nma_mobile_access_method_get_type
 
35
nma_mobile_access_method_get_username
 
36
nma_mobile_access_method_ref
 
37
nma_mobile_access_method_unref
 
38
nma_mobile_provider_get_3gpp_mcc_mnc
 
39
nma_mobile_provider_get_cdma_sid
 
40
nma_mobile_provider_get_methods
 
41
nma_mobile_provider_get_name
 
42
nma_mobile_provider_get_type
 
43
nma_mobile_provider_ref
 
44
nma_mobile_providers_database_dump
 
45
nma_mobile_providers_database_get_countries
 
46
nma_mobile_providers_database_get_type
 
47
nma_mobile_providers_database_lookup_3gpp_mcc_mnc
 
48
nma_mobile_providers_database_lookup_cdma_sid
 
49
nma_mobile_providers_database_lookup_country
 
50
nma_mobile_providers_database_new
 
51
nma_mobile_providers_database_new_finish
 
52
nma_mobile_providers_database_new_sync
 
53
nma_mobile_providers_split_3gpp_mcc_mnc
 
54
nma_mobile_provider_unref
 
55
nma_mobile_wizard_destroy
 
56
nma_mobile_wizard_new
 
57
nma_mobile_wizard_present
 
58
nma_utils_disambiguate_device_names
 
59
nma_utils_get_connection_device_name
 
60
nma_utils_get_device_description
 
61
nma_utils_get_device_generic_type_name
 
62
nma_utils_get_device_product
 
63
nma_utils_get_device_type_name
 
64
nma_utils_get_device_vendor
 
65
nma_vpn_password_dialog_focus_password
 
66
nma_vpn_password_dialog_focus_password_secondary
 
67
nma_vpn_password_dialog_get_password
 
68
nma_vpn_password_dialog_get_password_secondary
 
69
nma_vpn_password_dialog_get_type
 
70
nma_vpn_password_dialog_new
 
71
nma_vpn_password_dialog_run_and_block
 
72
nma_vpn_password_dialog_set_password
 
73
nma_vpn_password_dialog_set_password_label
 
74
nma_vpn_password_dialog_set_password_secondary
 
75
nma_vpn_password_dialog_set_password_secondary_label
 
76
nma_vpn_password_dialog_set_show_password
 
77
nma_vpn_password_dialog_set_show_password_secondary
 
78
nma_wifi_dialog_get_connection
 
79
nma_wifi_dialog_get_nag_ignored
 
80
nma_wifi_dialog_get_type
 
81
nma_wifi_dialog_nag_user
 
82
nma_wifi_dialog_new
 
83
nma_wifi_dialog_new_for_create
 
84
nma_wifi_dialog_new_for_hidden
 
85
nma_wifi_dialog_new_for_other
 
86
nma_wifi_dialog_set_nag_ignored
 
87
nma_wireless_dialog_get_connection
 
88
nma_wireless_dialog_get_type
 
89
nma_wireless_dialog_new
 
90
nma_wireless_dialog_new_for_create
 
91
nma_wireless_dialog_new_for_other
 
92
SYMBOLS
 
93
        }
 
94
 
 
95
get_syms_from_def() {
 
96
    (sed -n 's/^\t\(\([_a-zA-Z0-9]\+\)\|#\s*\([_a-zA-Z0-9]\+@@\?[_a-zA-Z0-9]\+\)\);$/\2\3/p' "$1";
 
97
    get_1_0_0_syms)  |
 
98
    sort
 
99
}
 
100
 
 
101
anchor() {
 
102
    sed "s/.*/$PATTERN\0$PATTERN/"
 
103
}
 
104
 
 
105
unanchor() {
 
106
    sed "s/^$PATTERN\(.*\)$PATTERN\$/\1/"
 
107
}
 
108
 
 
109
 
 
110
get_syms "$so" | anchor > "$TMPFILE"
 
111
WRONG="$(get_syms_from_def "$def" | anchor | grep -F -f - "$TMPFILE" -v)"
 
112
RESULT=$?
 
113
if [ $RESULT -eq 0 ]; then
 
114
    stat=1
 
115
    echo ">>library \"$so\" exports symbols that are not in linker script \"$def\":"
 
116
    echo "$WRONG" | unanchor | nl
 
117
fi
 
118
 
 
119
get_syms_from_def "$def" | anchor > "$TMPFILE"
 
120
WRONG="$(get_syms "$so" | anchor | grep -F -f - "$TMPFILE" -v)"
 
121
RESULT=$?
 
122
if [ $RESULT -eq 0 ]; then
 
123
    stat=1
 
124
    echo ">>linker script \"$def\" contains symbols that are not exported by library \"$so\":"
 
125
    echo "$WRONG" | unanchor | nl
 
126
fi
 
127
 
 
128
rm -rf "$TMPFILE"
 
129
exit $stat
 
130