Re: [Discuss OpenCPI] Package ID
Neil,
You are correct that the package-id is automatically assigned to "local.<project-name>" by ocpidev if you do not provide it with a package prefix at creation time. It is true that "local" is not a good name when hoping for globally unique identifiers, but it is hard for us to provide the user with a good globally unique prefix.
"ocpidev create project" accepts a few options which allow the user to set the package-id to whatever they choose at creation time. These options (listed in the help screen) are -N (package name which will replace the <project-name> in the package-id) and -F (package prefix which will replace "local" in your case).
So, we have <package-prefix>.<package-name>, where prefix defaults to "local" and name defaults to <project-name>.
After a project has been created, you cannot modify the package-id using "ocpidev". The only way as of now to modify the package-id of an existing project is through the Project.mk. If you plan to modify the project's package-id, you probably want to unregister it first:
$ cd <project>;
$ ocpidev unregister project
Now, edit the Project.mk, and set the following variables: PackagePrefix and/or PackagePrefix.
Then, reregister the project:
$ ocpidev register project
Note that the package-id is baked into generated files for workers, so you will need to clean the project and rebuild after modifying the package-id.
Also note that these variables also exist for libraries! So, you can modify the Library.mk for your "components" library (if you have a single flattened components library), or sub-library (if you have more than one) in a similar fashion! In this case, the default prefix is the full package-id of the project, and the default name is the directory name for the library (with components being an exception that defaults to <empty>). For libraries, it may be useful to set PackageName to something other than your simple directory name. Then workers/components in that library would have package-ids like my_unique_prefix.my_project.library_abc.component_123.
For more information, please see section 14.2 of the OpenCPI Component Development Guide.
I hope I have answered all of your questions!
Regards,
David
________________________________
From: discuss <discuss-bounces_at_lists.opencpi.org> on behalf of Neil Schafer <neil.schafer_at_nrl.navy.mil>
Sent: Thursday, July 12, 2018 5:53:58 PM
To: discuss_at_lists.opencpi.org
Subject: [Discuss OpenCPI] Package ID
Just getting familiar with the package-id paradigm, and I'm confused a bit
over the fact that it's supposed to be globally unique, yet it's
automatically assigned as "local.project-name" when using ocpidev to set up
a new project.
Is there a way to set a new package-id after the project has been created
using the tools, or do I need to go into the .project.xml to manually set
it?
According to the documentation, it seems like the desired result is to have
something along the lines of <TLD>.<organization>.<project> as the
project-id.
I am using the up-to-date build2 branch.
Thanks,
Neil
Received on Thu Jul 12 2018 - 22:17:09 CDT
This archive was generated by hypermail 2.3.0
: Fri Jun 05 2026 - 08:45:25 CDT