From 8ba939d53e52a88c183a2db95d1e51f04b0d9bb6 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 20 Sep 2012 10:19:54 -0700 Subject: Add QA_DESKTOP_FILE variable. --- bin/phase-functions.sh | 2 +- man/ebuild.5 | 5 +++++ pym/portage/package/ebuild/doebuild.py | 27 ++++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index 92e25c65f..2b9323147 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -560,7 +560,7 @@ __dyn_install() { if [[ $CATEGORY != virtual ]] ; then for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ - LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do + LDFLAGS LIBCFLAGS LIBCXXFLAGS QA_DESKTOP_FILE ; do x=$(echo -n ${!f}) [[ -n $x ]] && echo "$x" > $f done diff --git a/man/ebuild.5 b/man/ebuild.5 index 1ac1f920d..338a7653a 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -744,6 +744,11 @@ with escape\-quoted special characters. This should contain a list of file paths, relative to the image directory, of shared libraries that lack NEEDED entries. The paths may contain regular expressions with escape\-quoted special characters. +.TP +\fBQA_DESKTOP_FILE\fR +This should contain a list of file paths, relative to the image directory, of +desktop files which should not be validated. The paths may contain regular +expressions with escape\-quoted special characters. .SH "PORTAGE DECLARATIONS" .TP .B inherit diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 7200327e4..b9952bead 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -1785,6 +1785,29 @@ def _post_src_install_uid_fix(mysettings, out): xdg_dirs = tuple(os.path.join(i, "applications") + os.sep for i in xdg_dirs if i) + qa_desktop_file = "" + f = None + try: + with io.open(_unicode_encode(os.path.join( + mysettings["PORTAGE_BUILDDIR"], + "build-info", "QA_DESKTOP_FILE"), + encoding=_encodings['fs'], errors='strict'), + mode='r', encoding=_encodings['repo.content'], + errors='replace') as f: + qa_desktop_file = f.read() + except IOError as e: + if e.errno not in (errno.ENOENT, errno.ESTALE): + raise + + qa_desktop_file = qa_desktop_file.split() + if qa_desktop_file: + if len(qa_desktop_file) > 1: + qa_desktop_file = "|".join("(%s)" % x for x in qa_desktop_file) + qa_desktop_file = "^(%s)$" % qa_desktop_file + else: + qa_desktop_file = "^%s$" % qa_desktop_file[0] + qa_desktop_file = re.compile(qa_desktop_file) + while True: unicode_error = False @@ -1831,9 +1854,11 @@ def _post_src_install_uid_fix(mysettings, out): else: fpath = os.path.join(parent, fname) + fpath_relative = fpath[ed_len - 1:] if desktop_file_validate and fname.endswith(".desktop") and \ os.path.isfile(fpath) and \ - fpath[ed_len - 1:].startswith(xdg_dirs): + fpath_relative.startswith(xdg_dirs) and \ + not (qa_desktop_file and qa_desktop_file.match(fpath_relative.strip(os.sep)) is not None): desktop_validate = validate_desktop_entry(fpath) if desktop_validate: -- cgit v1.2.3-1-g7c22