diff options
author | Dmitry Shachnev <mitya57@gmail.com> | 2015-12-29 12:37:57 +0300 |
---|---|---|
committer | Dmitry Shachnev <mitya57@gmail.com> | 2015-12-29 18:39:20 +0300 |
commit | 6601dc94e9bdc548eb37f9c3a4f2c49f2bce4752 (patch) | |
tree | 555c79b08d6b592811f7a591916b67dc8e1669a5 | |
parent | 7c78cd8673fde84774feb931d5b855841b951d8e (diff) | |
download | pkg-kde-tools-6601dc94e9bdc548eb37f9c3a4f2c49f2bce4752.tar.gz |
Add a new script pkgkde-mark-qt5-private-symbols.
It is a replacement for the old script (pkgkde-mark-private-symbols) that
works with Qt ≥ 5.6.
Add dependency on python3:any for this script.
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | debian/control | 5 | ||||
-rw-r--r-- | debian/pkg-kde-tools.install | 1 | ||||
-rwxr-xr-x | pkgkde-mark-qt5-private-symbols | 70 |
5 files changed, 79 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 22048f2..0dabc71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,7 @@ install(PROGRAMS pkgkde-gensymbols pkgkde-getbuildlogs pkgkde-mark-private-symbols + pkgkde-mark-qt5-private-symbols pkgkde-override-sc-dev-latest pkgkde-symbolshelper pkgkde-vcs diff --git a/debian/changelog b/debian/changelog index 1a3a964..8a2aa09 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ pkg-kde-tools (0.15.20) UNRELEASED; urgency=medium [ Dmitry Shachnev ] * Minor fixes to pkgkde-mark-private-symbols.1 manpage. + * Add a new script (pkgkde-mark-qt5-private-symbols) which is a replacement + for the old script (pkgkde-mark-private-symbols) that works with Qt ≥ 5.6. + - Add dependency on python3:any for this script. [ Maximiliano Curia ] * Drop stale copy of Dpkg/Shlibs (2010-02-21), and use the ones from diff --git a/debian/control b/debian/control index 016900e..ddf18a4 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,10 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-kde/pkg-kde-tools.git;a=sum Package: pkg-kde-tools Architecture: all Multi-Arch: foreign -Depends: ${perl:Depends}, ${misc:Depends}, libdpkg-perl (>= 1.15.6~) +Depends: libdpkg-perl (>= 1.15.6~), + python3:any (>= 3.3.2-2~), + ${misc:Depends}, + ${perl:Depends} Recommends: dpkg-dev (>= 1.15.6~), libwww-perl Suggests: debhelper (>= 7.3.16), cdbs Breaks: kdelibs5-dev (<< 4:4.2.2), dpkg-dev (<< 1.15.6~) diff --git a/debian/pkg-kde-tools.install b/debian/pkg-kde-tools.install index 9896386..bcd3571 100644 --- a/debian/pkg-kde-tools.install +++ b/debian/pkg-kde-tools.install @@ -6,6 +6,7 @@ usr/bin/pkgkde-gensymbols usr/bin/pkgkde-getbuildlogs usr/bin/pkgkde-git usr/bin/pkgkde-mark-private-symbols +usr/bin/pkgkde-mark-qt5-private-symbols usr/bin/pkgkde-override-sc-dev-latest usr/bin/pkgkde-symbolshelper usr/bin/pkgkde-vcs diff --git a/pkgkde-mark-qt5-private-symbols b/pkgkde-mark-qt5-private-symbols new file mode 100755 index 0000000..8514ac2 --- /dev/null +++ b/pkgkde-mark-qt5-private-symbols @@ -0,0 +1,70 @@ +#!/usr/bin/python3 + +# Script to mark private symbols +# Copyright: 2015 Dmitry Shachnev <mitya57@debian.org> + +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +'''Mark private symbols based on Qt version tags (symbols that are tagged +with Qt_5_PRIVATE_API will be marked as private).''' + + +from argparse import ArgumentParser +from difflib import unified_diff +from glob import glob +from sys import stdout, stderr + + +def process_symbols_file(symbols_file_path, write_results=False): + old_lines = [] + new_lines = [] + with open(symbols_file_path) as symbols_file: + for line in symbols_file: + old_lines.append(line) + line = line.rstrip() + if line.endswith(' 1'): + line = line[:-2] + if '@Qt_5_PRIVATE_API' in line: + line += ' 1' + new_lines.append(line + '\n') + if write_results: + with open(symbols_file_path, 'w') as symbols_file: + for line in new_lines: + symbols_file.write(line) + else: + for line in unified_diff(old_lines, new_lines, + fromfile=symbols_file_path, + tofile=symbols_file_path): + stdout.write(line) + + +if __name__ == '__main__': + parser = ArgumentParser(description=__doc__) + parser.add_argument('--write-results', + help='write results back into symbols files', + action='store_true') + args = parser.parse_args() + + symbols_files = glob('debian/*.symbols') + if not symbols_files: + print('No symbols files found!', file=stderr) + for symbols_file_path in symbols_files: + process_symbols_file(symbols_file_path, args.write_results) |