Created
April 11, 2014 18:52
-
-
Save detrout/10491949 to your computer and use it in GitHub Desktop.
How true is library VERSION.startswith(SONAME)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"from __future__ import print_function" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"from glob import glob\n", | |
"import os" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"def find_libraries(root):\n", | |
" count = 0\n", | |
" mismatch = 0\n", | |
" for path, dirnames, filenames in os.walk(root):\n", | |
" for filename in filenames:\n", | |
" pathname = os.path.join(path, filename)\n", | |
" if '.so.' in filename:\n", | |
" count += 1\n", | |
" if os.path.islink(pathname):\n", | |
" short_name, short_version = pathname.split('.so.')\n", | |
" longname = os.readlink(pathname)\n", | |
" if '.so.' in longname:\n", | |
" long_name, long_version = longname.split('.so.')\n", | |
" if not long_version.startswith(short_version):\n", | |
" mismatch += 1\n", | |
" print('{} {} != {}'.format(long_name, long_version, short_version))\n", | |
" else:\n", | |
" print('hard to match {} / {}'.format(filename, longname))\n", | |
" print('{} mismatch of {}'.format(mismatch, count))" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 30 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"find_libraries('/usr/lib')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"libkpeoplewidgets 0.2.1 != 3\n", | |
"libutempter 1.1.5 != 0\n", | |
"liblancelot 1.9.0 != 2\n", | |
"libowncloudsync 1.5.0 != 0\n", | |
"libqinfinity 3.1.0 != 4\n", | |
"libkasten2core 0.2.0 != 2\n", | |
"libopen-pal 4.0.5 != 5\n", | |
"libkwinglutils 1.0.0.abi2 != 1abi2\n", | |
"libplasmaclock 4.11.5.abi4 != 4abi4\n", | |
"libkephal 4.11.5.abi1 != 4abi1\n", | |
"libkpeoplewidgets 0.1 != 1\n", | |
"libktpmodelsprivate 0.8.0 != 7\n", | |
"libmarblewidget 0.16.5 != 16\n", | |
"libopen-pal 5 != 4\n", | |
"libnepomukwidgets 4.11.5.abi1 != 4abi1\n", | |
"libktpcommoninternalsprivate 0.8.0 != 7\n", | |
"libktpwidgetsprivate 0.8.0 != 7\n", | |
"libkpeople 0.2.1 != 3\n", | |
"libkasten2controllers 0.2.0 != 2\n", | |
"libkasten2okteta1controllers 0.2.1.abi1 != 1abi1\n", | |
"libprocesscore 4.11.5.abi1 != 4abi1\n", | |
"libkasten2okteta1gui 0.2.1 != 1\n", | |
"libkonq 5.11.5.abi1 != 5abi1\n", | |
"libokteta1gui 0.8.1 != 1\n", | |
"libusbmuxd 1.0.8 != 2\n", | |
"libkworkspace 4.11.5.abi2 != 4abi2\n", | |
"libokteta1core 0.8.1 != 1\n", | |
"libkasten2gui 0.2.0 != 2\n", | |
"libktploggerprivate 0.8.0 != 7\n", | |
"libkwineffects 1.0.0.abi5 != 1abi5\n", | |
"libkpeople 0.1 != 1\n", | |
"libtaskmanager 4.11.5.abi4 != 4abi4\n", | |
"libkasten2okteta1core 0.2.1 != 1\n", | |
"libkdecorations 4.11.5.abi2 != 4abi2\n", | |
"libodbc 2 != 1" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"\n", | |
"libodbccr 2 != 1\n", | |
"hard to match libelf.so.1 / libelf-0.157.so\n", | |
"libopenjpeg 1.5.2 != 5" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"\n", | |
"libmlt 0.9.0 != 6\n", | |
"libopenjpeg_JPWL 1.5.2 != 5\n", | |
"libhwloc 5 != 1\n", | |
"libclucene-shared 2.3.3.4 != 1\n", | |
"libodbc 2 != 1\n", | |
"hard to match libsmime3.so.1d / libsmime3.so\n", | |
"libhwloc 5 != 3\n", | |
"hard to match libtcl8.5.so.0 / libtcl8.5.so\n", | |
"hard to match libtk8.6.so.0 / libtk8.6.so\n", | |
"libhwloc 5 != 0\n", | |
"hard to match libnspr4.so.0d / libnspr4.so\n", | |
"hard to match libopenjpeg.so.2 / libopenjpeg-2.1.3.0.so\n", | |
"libclucene-contribs-lib 2.3.3.4 != 1\n", | |
"libmlt++ 0.9.0 != 3\n", | |
"hard to match libplds4.so.0d / libplds4.so\n", | |
"libhwloc 5 != 4\n", | |
"hard to match libtcl8.6.so.0 / libtcl8.6.so\n", | |
"hard to match libtk8.5.so.0 / libtk8.5.so\n", | |
"libodbccr 2 != 1\n", | |
"hard to match libnss3.so.1d / libnss3.so\n", | |
"hard to match libplc4.so.0d / libplc4.so\n", | |
"libhwloc 5 != 2\n", | |
"libclucene-core 2.3.3.4 != 1\n", | |
"libodbcinst 2 != 1\n", | |
"hard to match libelf.so.1 / libelf-0.157.so\n", | |
"libcurl 4 != 3\n", | |
"libpcap 1.5.3 != 0.8\n", | |
"hard to match libnssutil3.so.1d / libnssutil3.so\n", | |
"hard to match libfdt.so.1 / libfdt-1.4.0.so\n", | |
"libcurl-gnutls 4 != 3\n", | |
"libgraphite2 3 != 2.0.0\n", | |
"hard to match libssl3.so.1d / libssl3.so\n", | |
"libkbibtexnetworking 0.4.91 != 1" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"\n", | |
"libkbibtexproc 0.4.91 != 1\n", | |
"libkbibtexio 0.4.91 != 1\n", | |
"58 mismatch of 3882" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"\n" | |
] | |
} | |
], | |
"prompt_number": 31 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment