jafingerhut / p4-guide

Guide to p4lang repositories and some other public info about P4
530 stars 155 forks source link

Issue with script install-p4dev-v8.sh #76

Open at-nojavan opened 1 week ago

at-nojavan commented 1 week ago

I tried to to install p4devtools using "install-p4dev-v8.sh" on a fresh Ubuntu 24.04 but the script gives an error and does not finish. Therefore, p4setup.bash is not created. These are the last lines of the log file:

clone https://github.com/p4lang/p4runtime-shell
Cloning into 'p4runtime-shell'...
+ cd p4runtime-shell
+ '[' x '!=' x ']'
+ git log -n 1
commit 82094bdcda0a1456c9b884eebc4a50385b1dd120
Author: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
Date:   Tue Sep 3 13:45:18 2024 -0400

    Make a Merge() call allow not-yet-recognized new fields in P4Info files (#132)

    Make a Merge() call allow not-yet-recognized new fields in P4Info files
    This is helpful when p4c adds new P4Info fields to the P4Info files it
    generates, but the consumers have not yet all been updated to
    recognize them.  The most recent example of this in 2024-Aug is the
    initial_default_action field of Table messages.

    Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+ PATCH_DIR=/home/ata/p4-guide/bin/patches
+ patch -p1
patching file p4runtime_sh/p4runtime.py
Hunk #1 FAILED at 289.
1 out of 1 hunk FAILED -- saving rejects to file p4runtime_sh/p4runtime.py.rej
patching file setup.cfg

It doesn't advance further. This is the p4runtime.py.rej:

--- p4runtime_sh/p4runtime.py
+++ p4runtime_sh/p4runtime.py
@@ -289,7 +289,7 @@ class P4RuntimeClient:
         with open(p4info_path, 'r') as f1:
             with open(bin_path, 'rb') as f2:
                 try:
-                    google.protobuf.text_format.Merge(f1.read(), req.config.p4info)
+                    google.protobuf.text_format.Merge(f1.read(), req.config.p4info, allow_unknown_field=True)
                 except google.protobuf.text_format.ParseError:
                     logging.error("Error when parsing P4Info")
                     raise

I'm not sure if I'm doing anything wrong. I have done this before on the Ubuntu 22.04 using v6 script multiple time. I will appreciate you insight.

jafingerhut commented 1 week ago

Not your fault. There was about a week of time where the version of code in https://github.com/p4lang/p4runtime-shell and my scripts conflicted with each other, and would cause the error you saw.

Over this past weekend I made a small change to my p4-guide repo that should avoid this in the future. If you update your copy of the p4-guide repo, and do /bin/rm -fr p4runtime-shell from the same directory where you ran the install script, you should be able to run it again and it should be able to take advantage of all the time spent compiling the bigger projects before it reached the point where it failed.

at-nojavan commented 1 week ago

Thank you!