/

CLI

generic invocation

mbpm <top command> [<sub command>] <PacketSpecification> [<options>*]

Here the command line interace for MBPacketManager is described, and conventions used.

1 Invocation structure


Every invocation of consists of "top command". The top command is the first string after the executable name that isn't a flag, or a single argument option . The top command specifies the kind of operation to perform, and some top commands have further subcommands that need to be specified.

1.1 Examples


# Here install is the top command
mbpm install MBUtility
# Here create is the top command, and compilecommands is the subcommand
mbpm create compilecommands --alluser
If a command has a subcommand so has this to be the first argument appearing after the top command.

2 Option classes


Multiple commands share a common set of options, the most prominent being the packet specification, but there are also common options that apply to other parts of the program, which are listed here. A command supporting this kind of option has "<OptionCategory>" in it's command syntax.

3 IterationOptions


These options deal with the vetorisation of commands.

3.1 lags


3.1.1 continue-error


Specifies wheter or not a command should continue to try to process other packets when the command failed for an earlier packet. The default behaviour is to exit with a result > 0 if a command fails for a packet, but supplying this option makes the program process the other packets aswell, displaying what packets failed at the end. A single packet failing results in an exit > 0.

4 RemotePolicy


These flags/options determine the way the program interacts with the remote's. The most important/commonly used option is with which computer info the packet indexes are accessed. The default value for the computer info is different for the different builtin commands, for example install uses the local computer info, while remote uses the blank computer info as default.

4.1 Flags


4.1.1 nocomputerdiff


Specifies that remote packtets are accessed through a blank computer info, meaning that it's content is the same for every computer.

While no restrictions can be enforced for the different packet types, so is it assumed that every file that isn't a part of the computerdiff can be generated from the generic files, and packets should provide all functionality in their generic form, which is for example the case for C++ packets follwing the MBBuild system.

4.1.2 computerdiff


Specifies that remote packets should be accesed with the local computers specification, exactly what this consist of and how they are determined can be read about at computer diff.

This means that the contents of the index can vary from computer to computer, and can for example be used to provide prebuilt binaries.

5 Commands


5.1 install


mbpm install PacketName* <RemoteOptions>

The command tasked with downloading a packet from a remote, along with all of it's required dependancies, and stores them under the "MBPM_PACKETS_INSTALL_DIRECTORY" environment variable.

The default computer diff for this command is the local machines computer diff.

5.2 update


mbpm update <PacketSpecification> <IterationOptions> [<UpdateOptions>*]

The default location type for the packet specification is installed.

This command updates a packet to match the file structure on a remote, and updates the file index in the directory to match the new file structure.

The default computer diff for this command is the local machines computer diff.

Note: If no fileindex file named MBPM_FileInfo is present in the packet directory so is a new MBPM_FileInfo file created, and already present MBPM_FileInfo files are overwritten. These files are used to keep track of which files have been changed since the last update and to compare with the remote index.

Note: A remote packet or user packet appearing in the <PacketsSpecification> is treated as a fatal error, meaning that no packets are updated.

5.3 Flags


5.3.1 allowuser


This flag make's it so that update can modify user packets. The default is to dissallow this in order to prevent accidentall loss of local modifications.

5.4 upload


mbpm update <PacketsSpecification> <IterationOptions> [<UpdateOptions>*]

The command that upload packets on the machine to a remote, or to the local installation directory. The default location type for the packets in the packet specification is 'installed'.

The command checks checks wheter or not a MBPM_FileInfo index file is present in the packet directory, uses it to compare the last modification time for the files present in the packet, and then overrides it with the new info. A new index file is created named MBPM_FileInfo if no MBPM_FileInfo index file is present or a invalid file index is present. Only new files and files that differ from the ones on the remote is uploaded.

The default computer diff for this command is the local machines computer diff.

Note: Uploading multiple packets with the same name is treated as a fatal error, and terminates the program right after resolving the packet specification. This is because uploading packets with the same name is in almost all cases an error, as these uploads would overwrite each other. Remote packets appearing in the packet list are also treated as a fatal error.

5.5 Flags


5.5.1 local


This option makes it so that the command instead of uploading the packet to the remote installs it on the local system. This follow the exact same semantics as downloading this packet through a remote with "mbpm install", except the source of the files/index are on the local machine.

5.6 Single argument options


5.6.1 f


Specifies a specific file to upload instead of comparing the index's for the packet on the machine against the remote index.

Specifying this option or -d makes it so that the upload only upload the file specified by the options -f and -d.

Note: Both -f and -d skips comparison against a local MBPM_FileInfoIgnore, which enables uploading files that are otherwise ignored by default, for example the dirctory "MBPM_Builds".

5.6.2 d


Specifies a specific directory to upload instead of comparing the index for the packet on the machine against the remote index.

Specifying this option or -f makes it so that the upload only upload the file's specified by the options -f and -d.

Note: Both -f and -d skips comparison against a local MBPM_FileInfoIgnore, which enables uploading files that are otherwise ignored by default, for example the dirctory "MBPM_Builds".

5.7 packets


mbpm packets <PacketSpecification> [<PacketsOptions>*]

Command used for visualising the result of a packet specification, and to provides a way to access this list from for example bash scripts.

The command prints the packet name, packet location type, and packet URI for each packet in the packet specification .

5.8 Flags


Specifying no flags prints all of the parts, otherwise it prints only parts specified bellow.

5.8.1 path


For each packet, only print the path to the packet. Remote packets are skipped if this flag is present.

5.8.2 name


For each packet, only print the name of the packet.

5.8.3 location


For each packet, only print the location type of the packet.

5.9 index


mbpm index (create | diff | list | update) ... <IterationOptions>

All commands under the index top command deals with the manipulation and visualisation of file indexes.

5.9.1 create


mbpm index create <PacketsSpecification> <IterationOptions>

Creates or overwrites MBPM_FileInfo with a index file describing the file's in the packet directory.

5.9.2 update


mbpm index update <PacketsSpecification> <IterationOptions>

Updates and existing MBPM_FileInfo index or creates on if it doesn't already exist in the packet directories.

5.9.3 list


mbpm index list <SinglePacketSpecification> ObjectToList="/"

Displays the content of MBPM_FileInfo index at the packet specification.

ObjectToList can be a file or directory, directories are displayed recursivly, and it defaults to displaying the whole index, that is to say the directory "/".

5.9.4 diff


mbpm index diff <SinglePacketSpecification> <SinglePacketSpecification>

Display the difference between the MBPM_FileInfo indexes. The first packet is interpreted to be the "local" packet and the second is the "server" packet. The semantics for differences between file indexes can be found here.

5.10 get


mbpm get <SinglePacketSpecification> <AbsolutePacketPath> <RemoteOptions>

Downloads the given filesystem object specified by the AbsolutePacketPath, a file or a whole directory, from the provided packet. The downloaded object is placed in the same relative directory structure for the current working directory. This means that downloading for example "/foo/bar" would create the directory "foo" if it doesn't already exist in the current working directory, and then creates a new file that is then copied from the packet.

When downloading from a remote so is the empty computer diff used by default.

5.11 CustomCommand


mbpm CommandName [SubCommand] <PacketsSpecification> <IterationOptions> [CommandOptions]

The custom commands are the extension mechanism of mbpm. The compilation of C++ packets are for example done by a builtin extension MBBuild.

More about how extension work can be found here. In short: Extensions can hook in the name of the command, and the type of packet being processed. This means that for example the "compile" command can be implemented by multiple extensions for different kind of packets.

5.11.1 Flags


5.11.1.1 quit-no-extension


The default behaviour when executing a command on a packet with no extension implementing the behaviour is to continue. This means commands like "compile" do their work on packets that define their behaviour, while also allowing packet specifications that add packets where the command should be ignored.

Specifying this flag means that the program instead emits a fatal error when encountering a packet with no appropriate extension.