Add QA_DESKTOP_FILE variable.
authorZac Medico <zmedico@gentoo.org>
Thu, 20 Sep 2012 17:19:54 +0000 (10:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 20 Sep 2012 17:19:54 +0000 (10:19 -0700)
bin/phase-functions.sh
man/ebuild.5
pym/portage/package/ebuild/doebuild.py

index 92e25c65f515ed574ab1647efa4f70f813ed1cb1..2b932314751a64a71126ba86bee1929b49594386 100644 (file)
@@ -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
index 1ac1f920d65cec2379493d979f26d00c447b2af4..338a7653abf912f61694cc8c289ae10fccfb2a5a 100644 (file)
@@ -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
index 7200327e467e20ab6e853a0f122c62ac84cd261c..b9952bead6eea0cc5b40b34a8bf6b1c4d653f617 100644 (file)
@@ -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: