get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/613860/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 613860,
    "url": "http://patchwork.ozlabs.org/api/patches/613860/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/buildroot/patch/1461358223-18312-8-git-send-email-s.martin49@gmail.com/",
    "project": {
        "id": 27,
        "url": "http://patchwork.ozlabs.org/api/projects/27/?format=api",
        "name": "Buildroot development",
        "link_name": "buildroot",
        "list_id": "buildroot.buildroot.org",
        "list_email": "buildroot@buildroot.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1461358223-18312-8-git-send-email-s.martin49@gmail.com>",
    "list_archive_url": null,
    "date": "2016-04-22T20:50:19",
    "name": "[v9,07/11] support/scripts: update check-host-rpath to use the shell helpers",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "77ace4852dd2942f884f212c06279ddc7b03a05a",
    "submitter": {
        "id": 12868,
        "url": "http://patchwork.ozlabs.org/api/people/12868/?format=api",
        "name": "Samuel Martin",
        "email": "s.martin49@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/buildroot/patch/1461358223-18312-8-git-send-email-s.martin49@gmail.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/613860/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/613860/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<buildroot-bounces@busybox.net>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "buildroot@lists.busybox.net"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "buildroot@osuosl.org"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 3qs77p6VTCz9sDD\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 23 Apr 2016 06:51:18 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 2A5B0966B2;\n\tFri, 22 Apr 2016 20:51:17 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id PSoWIiHV0kZn; Fri, 22 Apr 2016 20:51:03 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 21D51966A3;\n\tFri, 22 Apr 2016 20:50:53 +0000 (UTC)",
            "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 08AC31C1750\n\tfor <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:46 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 062C5C002F\n\tfor <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:46 +0000 (UTC)",
            "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id KZftRJxeENkg for <buildroot@lists.busybox.net>;\n\tFri, 22 Apr 2016 20:50:45 +0000 (UTC)",
            "from mail-wm0-f67.google.com (mail-wm0-f67.google.com\n\t[74.125.82.67])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 0B121C05F0\n\tfor <buildroot@buildroot.org>; Fri, 22 Apr 2016 20:50:45 +0000 (UTC)",
            "by mail-wm0-f67.google.com with SMTP id n3so7846959wmn.1\n\tfor <buildroot@buildroot.org>; Fri, 22 Apr 2016 13:50:44 -0700 (PDT)",
            "from bobook.localdomain (ivr94-4-82-229-165-48.fbx.proxad.net.\n\t[82.229.165.48]) by smtp.gmail.com with ESMTPSA id\n\tiv1sm9826507wjb.34.2016.04.22.13.50.41\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tFri, 22 Apr 2016 13:50:42 -0700 (PDT)"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=tjxt/XCG;\n\tdkim-atps=neutral",
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=Y2lQYFuu0MeVT1bXIZGtZRqlt2OaS4DRrUZPbc14Azg=;\n\tb=tjxt/XCG2UFMKLm5jPIDIMGNLeCcfFQX96YzllHo6szsYfIEjPl7jBbx04Qj/9MzU+\n\tHWdIMIrmhwAUfE1qEloothJaOxhr+L7lJc26ZdzvDpGbtZ0Rg6cU+q1qaca5qVHespg3\n\torEiNZvS3uEg1ioRDVt3mvEfk/akjtBhs0gXhWRn6Opid2ck426cGqdrUFgOtv+Xe6qs\n\tzyomtwzUWvBIhF84t1qQgXZpPa72sRLtt3ZBldy9Pz6MuwnlRatMMlb3CBZEyR5GHt25\n\tLunL0KjeS8qsCivXisbJg9D5E/1/viPSUW5T9/W8glMuOJ/UWK/fq1VHo+Ea2Z9W9xJp\n\tgMSw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=Y2lQYFuu0MeVT1bXIZGtZRqlt2OaS4DRrUZPbc14Azg=;\n\tb=Yz2wMuDfPZBnRnnrxv8/uTMSdbUIkD60HE+/Fq3b3VBsxf2kUGZQKrsI1SbEOtEcP4\n\tzG2KLzPAIy3EUIwbAHPyDqsKwShryVukTViG4WHMFx/19Hax537jq5VpVwwSfsJS50OO\n\tVEUWKACsfEoDir4YXrK1yBfmZpWFU2rgANvypcz80HvswPORGmIzVAAppefb9MEikpzI\n\tiY+wCJPVeUUYWExoMUXlaDh9dA/boI5uXu17fzILiNiOOY2Sj0DpOM1ffECp1ZknQbtZ\n\tjEwsO62t+DvN3E05uKc7kkNl1NNTE5ZZdybhtaI4Hvkgw/wKEjmyE1qdQ20KHH2Tul61\n\tFtOA==",
        "X-Gm-Message-State": "AOPr4FUWmbE33QxwrUY5VRA88hfVZ12rhYjmQffSZiBVrpUYQUhcTc2zlMPhSTc3CcMwDA==",
        "X-Received": "by 10.28.211.136 with SMTP id k130mr5553005wmg.81.1461358243698; \n\tFri, 22 Apr 2016 13:50:43 -0700 (PDT)",
        "From": "Samuel Martin <s.martin49@gmail.com>",
        "To": "buildroot@buildroot.org",
        "Date": "Fri, 22 Apr 2016 22:50:19 +0200",
        "Message-Id": "<1461358223-18312-8-git-send-email-s.martin49@gmail.com>",
        "X-Mailer": "git-send-email 2.8.0",
        "In-Reply-To": "<1461358223-18312-1-git-send-email-s.martin49@gmail.com>",
        "References": "<1461358223-18312-1-git-send-email-s.martin49@gmail.com>",
        "Cc": "\"Yann E. MORIN\" <yann.morin.1998@free.fr>",
        "Subject": "[Buildroot] [PATCH v9 07/11] support/scripts: update\n\tcheck-host-rpath to use the shell helpers",
        "X-BeenThere": "buildroot@busybox.net",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Discussion and development of buildroot <buildroot.busybox.net>",
        "List-Unsubscribe": "<http://lists.busybox.net/mailman/options/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=unsubscribe>",
        "List-Archive": "<http://lists.busybox.net/pipermail/buildroot/>",
        "List-Post": "<mailto:buildroot@busybox.net>",
        "List-Help": "<mailto:buildroot-request@busybox.net?subject=help>",
        "List-Subscribe": "<http://lists.busybox.net/mailman/listinfo/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "buildroot-bounces@busybox.net",
        "Sender": "\"buildroot\" <buildroot-bounces@busybox.net>"
    },
    "content": "This change moves and refactors the helper functions from the\ncheck-host-rpath into the readelf module.\n\nThe replacement of the elf_needs_rpath function: readelf.needs_rpath\ndoes not fundamentally change the implementation, it only uses the APIs\noffered by the readelf module.\n\nThe replacement of the check_elf_has_rpath function: readelf.has_rpath\ndoes a bit more than the original implementation - adding the support\nfor relative RPATH (those strating with '$ORIGIN').\n\nCc: \"Yann E. MORIN\" <yann.morin.1998@free.fr>\nSigned-off-by: Samuel Martin <s.martin49@gmail.com>\n\n---\nchanges v8->v9:\n- update commit log (ThomasP)\n- minor fix\n\nchanges v7->v8:\n- none\n\nchanges v6->v7:\n- minor updates after shell modules shell changes\n\nchanges v5->v6:\n- new patch\n---\n support/scripts/check-host-rpath | 73 +++++++++++++++-------------------------\n support/scripts/shell/readelf.sh | 69 +++++++++++++++++++++++++++++++++++++\n 2 files changed, 97 insertions(+), 45 deletions(-)",
    "diff": "diff --git a/support/scripts/check-host-rpath b/support/scripts/check-host-rpath\nindex 6ce547c..e6e82d6 100755\n--- a/support/scripts/check-host-rpath\n+++ b/support/scripts/check-host-rpath\n@@ -1,12 +1,29 @@\n #!/usr/bin/env bash\n \n+# Copyright (C) 2015 Yann E. MORIN <yann.morin.1998@free.fr>\n+# Copyright (C) 2016 Samuel Martin <s.martin49@gmail.com>\n+#\n+# This program is free software; you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation; either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+# General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program; if not, write to the Free Software\n+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n+\n # This script scans $(HOST_DIR)/{bin,sbin} for all ELF files, and checks\n # they have an RPATH to $(HOST_DIR)/usr/lib if they need libraries from\n # there.\n \n-# Override the user's locale so we are sure we can parse the output of\n-# readelf(1) and file(1)\n-export LC_ALL=C\n+source \"${0%/*}/shell/source.sh\"\n+\n+source.load_module readelf\n \n main() {\n     local pkg=\"${1}\"\n@@ -14,58 +31,24 @@ main() {\n     local file ret\n \n     # Remove duplicate and trailing '/' for proper match\n-    hostdir=\"$( sed -r -e 's:/+:/:g; s:/$::;' <<<\"${hostdir}\" )\"\n+    hostdir=\"$(sed -r -e 's:/+:/:g; s:/$::;' <<<\"${hostdir}\")\"\n \n     ret=0\n     while read file; do\n-        elf_needs_rpath \"${file}\" \"${hostdir}\" || continue\n-        check_elf_has_rpath \"${file}\" \"${hostdir}\" && continue\n+        READELF=readelf readelf.needs_rpath \"${file}\" \"${hostdir}\" || continue\n+        READELF=readelf readelf.has_rpath \"${file}\" \"${hostdir}\" && continue\n         if [ ${ret} -eq 0 ]; then\n             ret=1\n             printf \"***\\n\"\n-            printf \"*** ERROR: package %s installs executables without proper RPATH:\\n\" \"${pkg}\"\n+            printf \\\n+                \"*** ERROR: package %s installs executables without proper RPATH:\\n\" \\\n+                \"${pkg}\"\n         fi\n         printf \"***   %s\\n\" \"${file}\"\n-    done < <( find \"${hostdir}\"/{,usr/}{bin,sbin} -type f -exec file {} + 2>/dev/null \\\n-              |sed -r -e '/^([^:]+):.*\\<ELF\\>.*\\<executable\\>.*/!d'                \\\n-                      -e 's//\\1/'                                                  \\\n-            )\n+    done < <(find \"${hostdir}\"/{,usr/}{bin,sbin} -type f -print 2>/dev/null |\n+              readelf.filter_elf_executable)\n \n     return ${ret}\n }\n \n-elf_needs_rpath() {\n-    local file=\"${1}\"\n-    local hostdir=\"${2}\"\n-    local lib\n-\n-    while read lib; do\n-        [ -e \"${hostdir}/usr/lib/${lib}\" ] && return 0\n-    done < <( readelf -d \"${file}\"                                         \\\n-              |sed -r -e '/^.* \\(NEEDED\\) .*Shared library: \\[(.+)\\]$/!d;' \\\n-                     -e 's//\\1/;'                                          \\\n-            )\n-\n-    return 1\n-}\n-\n-check_elf_has_rpath() {\n-    local file=\"${1}\"\n-    local hostdir=\"${2}\"\n-    local rpath dir\n-\n-    while read rpath; do\n-        for dir in ${rpath//:/ }; do\n-            # Remove duplicate and trailing '/' for proper match\n-            dir=\"$( sed -r -e 's:/+:/:g; s:/$::;' <<<\"${dir}\" )\"\n-            [ \"${dir}\" = \"${hostdir}/usr/lib\" ] && return 0\n-        done\n-    done < <( readelf -d \"${file}\"                                              \\\n-              |sed -r -e '/.* \\(R(UN)?PATH\\) +Library r(un)?path: \\[(.+)\\]$/!d' \\\n-                      -e 's//\\3/;'                                              \\\n-            )\n-\n-    return 1\n-}\n-\n main \"${@}\"\ndiff --git a/support/scripts/shell/readelf.sh b/support/scripts/shell/readelf.sh\nindex c8ad38b..78a1a9f 100644\n--- a/support/scripts/shell/readelf.sh\n+++ b/support/scripts/shell/readelf.sh\n@@ -24,11 +24,15 @@\n #   readelf.is_elf_executable\n #   readelf.is_elf_shared_object\n #   readelf.get_rpath\n+#   readelf.get_neededs\n+#   readelf.needs_rpath\n+#   readelf.has_rpath\n #   readelf.list_sections\n #   readelf.has_section\n #\n # This module is sensitive to the following environment variables:\n #   READELF\n+\n source.declare_module readelf\n \n # When calling readelf(1) program, the user's locale will be overriden with the\n@@ -143,6 +147,71 @@ readelf.get_rpath() {\n         sed -r -e '/.* \\(R(UN)?PATH\\) +Library r(un)?path: \\[(.+)\\]$/!d ; s//\\3/'\n }\n \n+# readelf.get_neededs file\n+#\n+# Returns the list of the NEEDED libraries of $file.\n+#\n+# file : ELF file path\n+#\n+# environment:\n+#   READELF: readelf program path\n+readelf.get_neededs() {\n+    local file=\"${1}\"\n+    LC_ALL=C \"${READELF}\" --dynamic \"${file}\" |\n+        sed -r -e '/^.* \\(NEEDED\\) .*Shared library: \\[(.+)\\]$/!d ; s//\\1/'\n+}\n+\n+# readelf.needs_rpath file basedir\n+#\n+# Returns 0 if $file needs to have RPATH set, 1 otherwise.\n+#\n+# file    : path of file to be tested\n+# basedir : path of the tree in which $basedir/lib and $basedir/usr/lib are\n+#           checked for belonging to RPATH\n+#\n+# environment:\n+#   READELF: readelf program path\n+readelf.needs_rpath() {\n+    local file=\"${1}\"\n+    local basedir=\"${2}\"\n+    local lib\n+\n+    while read lib; do\n+        [ -e \"${basedir}/lib/${lib}\" ] && return 0\n+        [ -e \"${basedir}/usr/lib/${lib}\" ] && return 0\n+    done < <(readelf.get_neededs \"${file}\")\n+    return 1\n+}\n+\n+# readelf.has_rpath file basedir\n+#\n+# Returns 0 if $file has RPATH already set to $basedir/lib or $basedir/usr/lib,\n+# or uses relative RPATH (starting with \"$ORIGIN\"); returns 1 otherwise.\n+#\n+# file    : path of file to be tested\n+# basedir : path of the tree in which $basedir/lib and $basedir/usr/lib are\n+#           checked for belonging to RPATH\n+#\n+# environment:\n+#   READELF: readelf program path\n+readelf.has_rpath() {\n+    local file=\"${1}\"\n+    local basedir=\"${2}\"\n+    local rpath dir\n+\n+    while read rpath; do\n+        for dir in ${rpath//:/ }; do\n+            # Remove duplicate and trailing '/' for proper match\n+            dir=\"$(sed -r -e \"s:/+:/:g; s:/$::\" <<<\"${dir}\")\"\n+            [ \"${dir}\" = \"${basedir}/lib\" ] && return 0\n+            [ \"${dir}\" = \"${basedir}/usr/lib\" ] && return 0\n+            grep -q '^\\$ORIGIN/' <<<\"${dir}\" && return 0\n+        done\n+    done < <(readelf.get_rpath \"${file}\")\n+\n+    return 1\n+}\n+\n # readelf.list_sections file\n #\n # Returns the list of ELF sections in $file.\n",
    "prefixes": [
        "v9",
        "07/11"
    ]
}