ocpixml

Description

The ocpixml command-line tool is used to manage the artifact description XML that exists inside an OpenCPI artifact file generated by the ocpidev build operation. It can also be used to parse any standalone XML file.

The artifact description XML describes the contents of an executable binary (an artifact resulting from building an RCC or HDL worker or a component unit test) or a “bitstream” executable (an artifact resulting from building an HDL assembly) and is attached during the build process to the generated executable or bitstream (.bitz or .gz) artifact file. The ocpixml tool can be used to manipulate the artifact description XML attached to an artifact file.

For convenience, options can occur anywhere in the command. When invoked without options and verbs, ocpixml displays help information.

Usage

$ ocpixml
Usage for ocpixml (executed from /home/user/opencpi/build/autotools/target-rocky9/staging/bin/ocpixml):
Options are:
  Long name  Letter  Datatype  Multiple? Description
  log-level    l       ULong      No    <log-level>.
                                        set log level during execution, overriding OCPI_LOG_LEVEL
  top          t       String     Yes   <top-element>.
                                        specify allowable top-level elements
  attribute    a       String     Yes   <attribute>.
                                        specify attribute to print, one per line
                                        if name starts with ?, it is optional (blank line output)
                                        otherwise its an error if attr is missing
                                        if no attributes are specified top element name is printed
                                        
  silent       s       Bool       No    <silent>.
Long options are of the form:   --<long-name>[=<value>]
Short options are of the form:  -<letter>[<value>] or -<letter>  <value>
Boolean options have no value; their presence indicates 'true'.  Other types require values.

This program performs functions relating to the XML inside artifact files.
Usage is: ocpixml [<options>] <command> <file> [<file2>]
Commands are:
  get   - extract the XML from the file to standard output.
  strip - remove the XML from the file while copying artifact to <file2>.
  add   - add the XML file <file2> to the file, in place. file2 can be '-' for standard input.
  parse - parse top-level attributes from an XML file

Examples

  1. Add the content of the XML file named MyFile.xml to the artifact file named myartifact1.bitz and only output exit status:

    ocpixml -s add myartifact1.bitz MyFile.xml
    
  2. Add standard input to the artifact file named myartifact1.gz:

    ocpixml add myartifact1.gz -
    
  3. Extract the XML metadata from the artifact file named myartifact1.bitz and write it to stdout:

    ocpixml get myartifact1.bitz
    
  4. Parse the top-level element1 and the attributes attr1 and attr2 from the XML file named MyFile.xml and write them to stdout. Generate an error if element1 and attr1 are not present. Generate a blank line if attr2 is not present:

    ocpixml -t element1 -a attr1 -a ?attr2 parse MyFile.xml
    
  5. Remove the XML metadata from the artifact file named myartifact1.gz and copy the results to the artifact file named mynewartifact1.gz:

    ocpixml strip myartifact1.gz mynewartifact1.gz