Skip to contentSkip to conversation

Enhance and document perforce fetcher

PATCH In review Andrew Bradford 1 participant 4 messages Jun 9, 2016 – Jul 7, 2016

lore
Share & tools
lore
#0 lore raw

v2 cover Enhance and document perforce fetcher

From: Andrew Bradford <[email protected]>

Allow the perforce fetcher to act more like the other source control fetchers so that it can use AUTOREV and the use of the p4 P4CONFIG variable to specify many p4 settings. Also document these changes and how to use this new implementation of the perforce fetcher.

This series depends only on one patch from my oe-core series [1] which enables srcrev capability for the perforce fetcher. The other patches in my oe-core series are not required.

[1]: http://patches.openembedded.org/patch/123523/

Changes from v1:
* Rebase on bitbake python3 changes
* Enable ability to fetch a single file from perforce, not just directories
* Slight cleanup of code style
* Remove some unneeded debug logging
* Set defaults for P4DIR and FETCHCMD_p4 in fetcher itself, not in oe-core
* Update documentation as per these changes

Andrew Bradford (2):
fetch2/perforce: Rework to support SRCREV and P4CONFIG
doc: Document use of Perforce fetcher

 .../bitbake-user-manual-fetching.xml               |  68 +++++-
 .../bitbake-user-manual-ref-variables.xml          |  11 +-
 lib/bb/fetch2/__init__.py                          |   3 +-
 lib/bb/fetch2/perforce.py                          | 270 +++++++++++----------
 4 files changed, 225 insertions(+), 127 deletions(-)
Signature · 1 line
2.8.1
#1 lore raw

PATCH v2 1/2 fetch2/perforce: Rework to support SRCREV and P4CONFIG

From: Andrew Bradford <[email protected]>

In recipes which use the perforce fetcher, enable use of SRCREV to specify any of: ${AUTOREV}, changelist number, p4date, or label. This is more in-line with how the other fetchers work for source control systems.

Allow p4 to use the P4CONFIG env variable to define the server URL, username, and password if not provided in a recipe.

This does change existing perforce fetcher usage by recipes and will likely need those recipes which use the perforce fetcher to be updated. No recipes in oe-core use the perforce fetcher.

References [YOCTO #6303]

---
 lib/bb/fetch2/__init__.py |   3 +-
 lib/bb/fetch2/perforce.py | 270 +++++++++++++++++++++++++---------------------
 2 files changed, 150 insertions(+), 123 deletions(-)
lib/bb/fetch2/__init__.py +2 -1
index f612318..a880483 100644
@@ -803,7 +803,8 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None):
                   'GIT_SMART_HTTP',
                   'SSH_AUTH_SOCK', 'SSH_AGENT_PID',
                   'SOCKS5_USER', 'SOCKS5_PASSWD',
-                  'DBUS_SESSION_BUS_ADDRESS']
+                  'DBUS_SESSION_BUS_ADDRESS',
+                  'P4CONFIG']
 
     if not cleanup:
         cleanup = []
lib/bb/fetch2/perforce.py +148 -122

320 lines not on this page · raw message

Signature · 1 line
2.8.1
#2 lore raw

PATCH v2 2/2 doc: Document use of Perforce fetcher

In reply to Andrew Bradford

From: Andrew Bradford <[email protected]>

---
 .../bitbake-user-manual-fetching.xml               | 68 +++++++++++++++++++++-
 .../bitbake-user-manual-ref-variables.xml          | 11 +++-
 2 files changed, 75 insertions(+), 4 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-fetching.xml +65 -3
index f168cfa..65acb35 100644
@@ -716,6 +716,71 @@
             </para>
         </section>
 
+        <section id='perforce-fetcher'>
+            <title>Perforce Fetcher (<filename>p4://</filename>)</title>
+
+            <para>
+                This fetcher submodule fetches code from the
+                <ulink url='https://www.perforce.com/'>Perforce</ulink>
+                source control system.
+                The executable used is specified by
+                <filename>FETCHCMD_p4</filename>, which defaults
+                to "p4".
+                The fetcher's temporary working directory is set by
+                <link linkend='var-P4DIR'><filename>P4DIR</filename></link>,
+                which defaults to <filename>DL_DIR/p4</filename>.
+            </para>
+
+            <para>
+                To use this fetcher, make sure your recipe has proper
+                <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>,
+                <link linkend='var-SRCREV'><filename>SRCREV</filename></link>, and
+                <link linkend='var-PV'><filename>PV</filename></link>.
+                The p4 executable is able to use the config file defined by your
+                system's <filename>P4CONFIG</filename> environment variable in
+                order to define the Perforce server URL and port, username, and
+                password if you do not wish to keep those values in a recipe
+                itself.  If you choose not to use <filename>P4CONFIG</filename>,
+                or to explicitly set variables which <filename>P4CONFIG</filename>
+                can contain, you can specify the <filename>P4PORT</filename> value,
+                which is the server's URL and port number, and you can
+                specify a username and password directly in your recipe within
+                <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>.
+            </para>
+
+            <para>
+                Here is an example which relies on <filename>P4CONFIG</filename>
+                to specify the server URL and port, username, and password, and
+                fetches the Head Revision:
+                <literallayout class='monospaced'>
+    SRC_URI = "p4://example-depot/main/source/..."
+    SRCREV = "${AUTOREV}"
+    PV = "p4-${SRCPV}"
+    S = "${WORKDIR}/p4"
+                </literallayout>
+            </para>
+
+            <para>
+                Here is an example which specifies the server URL and port,
+                username, and password, and fetches a Revision based on a Label:
+                <literallayout class='monospaced'>
+    P4PORT = "tcp:p4server.example.net:1666"
+    SRC_URI = "p4://user:passwd@example-depot/main/source/..."
+    SRCREV = "release-1.0"
+    PV = "p4-${SRCPV}"
+    S = "${WORKDIR}/p4"
+                </literallayout>
+            </para>
+
+            <para>
+                Here is one behaviour worth mentioning:
+                <itemizedlist>
+                    <listitem><para><filename>S</filename> should always be set
+                        to <filename>"${WORKDIR}/p4"</filename> in your recipe.</para></listitem>
+                </itemizedlist>
+            </para>
+        </section>
+
         <section id='other-fetchers'>
             <title>Other Fetchers</title>
 
@@ -726,9 +791,6 @@
                         Bazaar (<filename>bzr://</filename>)
                         </para></listitem>
                     <listitem><para>
-                        Perforce (<filename>p4://</filename>)
-                        </para></listitem>
-                    <listitem><para>
                         Trees using Git Annex (<filename>gitannex://</filename>)
                         </para></listitem>
                     <listitem><para>
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml +10 -1
index 4d06ff9..f59fe85 100644
@@ -52,7 +52,7 @@
        <link linkend='var-MIRRORS'>M</link>
 <!--               <link linkend='var-glossary-n'>N</link> -->
        <link linkend='var-OVERRIDES'>O</link>
-       <link linkend='var-PACKAGES'>P</link>
+       <link linkend='var-P4DIR'>P</link>
 <!--       <link linkend='var-QMAKE_PROFILES'>Q</link> -->
        <link linkend='var-RDEPENDS'>R</link>
        <link linkend='var-SECTION'>S</link>
@@ -1748,6 +1748,15 @@
 
     <glossdiv id='var-glossary-p'><title>P</title>
 
+        <glossentry id='var-P4DIR'><glossterm>P4DIR</glossterm>
+            <glossdef>
+                <para>
+                    The directory in which a local copy of a Perforce depot
+                    is stored when it is fetched.
+                </para>
+            </glossdef>
+        </glossentry>
+
         <glossentry id='var-PACKAGES'><glossterm>PACKAGES</glossterm>
             <glossdef>
                 <para>The list of packages the recipe creates.
Signature · 1 line
2.8.1
#3 lore raw

Re: [PATCH v2 2/2] doc: Document use of Perforce fetcher

Hi,

Quoted 7 lines · Andrew Bradford

From: Andrew Bradford <[email protected]>

---
 .../bitbake-user-manual-fetching.xml               | 68 +++++++++++++++++++++-
 .../bitbake-user-manual-ref-variables.xml          | 11 +++-
 2 files changed, 75 insertions(+), 4 deletions(-)

Adding Scott Rifenbark to CC, sorry I left you off before. Any chance this patch could get picked up to go with the already applied perforce fetcher changes which it documents?

Or are there any changes I should make so that it can be applied?

Thanks,
Andrew