Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCmd = &cobra.Command{ Use: "add [<pack> | -f <packs list>]", Short: "Add Open-CMSIS-Pack packages", Long: ` Add a pack using the following "<pack>" specification or using packs provided by "-f <packs list>": $ cpackget add Vendor.Pack.1.2.3 $ cpackget add Vendor::Pack@1.2.3 Use the syntax above to let cpackget determine the location of pack files prior to installing it locally. $ cpackget add Vendor.Pack.1.2.3.pack Use this syntax if you already have a pack at hand and simply want to install it under pack-root folder. $ cpackget add path/to/Vendor.Pack.pdsc Use this syntax if you are installing a pack that has not been released yet. This will install it as a local pack and keep a reference in ".Local/local_repository.pidx". The file can be a local file or a file hosted somewhere else on the Internet. If it's hosted somewhere, cpackget will first download it then extract all pack files into "CMSIS_PACK_ROOT/<vendor>/<packName>/<x.y.z>/" If "-f" is used, cpackget will call "cpackget pack add" on each URL specified in the <packs list> file.`, Args: cobra.MinimumNArgs(0), PersistentPreRunE: configureInstaller, RunE: func(cmd *cobra.Command, args []string) error { if addCmdFlags.packsListFileName != "" { log.Infof("Parsing packs urls via file %v", addCmdFlags.packsListFileName) file, err := os.Open(addCmdFlags.packsListFileName) if err != nil { return err } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { args = append(args, scanner.Text()) } if err := scanner.Err(); err != nil { return err } } if len(args) == 0 { log.Error("Missing a pack-path or list with pack urls specified via -f/--packs-list-filename") return errs.ErrIncorrectCmdArgs } log.Debugf("Specified packs %v", args) var lastErr error installer.UnlockPackRoot() for _, packPath := range args { var err error if filepath.Ext(packPath) == ".pdsc" { err = installer.AddPdsc(packPath) } else { err = installer.AddPack(packPath, !addCmdFlags.skipEula, addCmdFlags.extractEula, addCmdFlags.forceReinstall) } if err != nil { lastErr = err if !errs.AlreadyLogged(err) { log.Error(err) } } } installer.LockPackRoot() return lastErr }, }
View Source
var AllCommands = []*cobra.Command{ PackCmd, PdscCmd, IndexCmd, InitCmd, AddCmd, RmCmd, ListCmd, UpdateIndexCmd, ChecksumCreateCmd, ChecksumVerifyCmd, }
AllCommands contains all available commands for cpackget
View Source
var ChecksumCreateCmd = &cobra.Command{ Use: "checksum-create [<local .path pack>]", Short: "Generates a .checksum file containing the digests of a pack", Long: ` Creates a .checksum file of a local pack. This is file contains the digests of the contents of the pack. Example <Vendor.Pack.1.2.3.sha256.checksum> file: "6f95628e4e0824b0ff4a9f49dad1c3eb073b27c2dd84de3b985f0ef3405ca9ca Vendor.Pack.1.2.3.pdsc 435fsdf..." The referenced pack must be in its original/compressed form (.pack), and be present locally: $ cpackget checksum-create Vendor.Pack.1.2.3.pack The default Cryptographic Hash Function used is "` + cryptography.Hashes[0] + `". In the future other hash functions might be supported. The used function will be prefixed to the ".checksum" extension. By default the checksum file will be created in the same directory as the provided pack.`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { return cryptography.GenerateChecksum(args[0], checksumCreateCmdFlags.outputDir, checksumCreateCmdFlags.hashAlgorithm) }, }
View Source
var ChecksumVerifyCmd = &cobra.Command{ Use: "checksum-verify [<local .path pack>] [<local .checksum path>]", Short: "Verifies the integrity of a pack using its .checksum file", Long: ` Verifies the contents of a pack, checking its integrity against its .checksum file (created with "checksum-create"): $ cpackget checksum-verify Vendor.Pack.1.2.3.pack Vendor.Pack.1.2.3.sha256.checksum The used hash function is inferred from the checksum filename, and if any of the digests computed doesn't match the one provided in the checksum file an error will be thrown.`, Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { return cryptography.VerifyChecksum(args[0], args[1]) }, }
View Source
var CopyRight string
View Source
var IndexCmd = &cobra.Command{ Deprecated: "Consider running `cpackget update-index` instead", Use: "index <index url>", Short: "Updates public index", Long: getLongIndexDescription(), PersistentPreRunE: configureInstaller, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { log.Infof("Updating index %v", args) indexPath := args[0] installer.UnlockPackRoot() err := installer.UpdatePublicIndex(indexPath, overwrite, true) installer.LockPackRoot() return err }, }
View Source
var InitCmd = &cobra.Command{ Use: "init [--pack-root <pack root>] <index-url>", Short: "Initializes a pack root folder", Long: `Initializes a pack root folder specified by -R/--pack-root command line or via the CMSIS_PACK_ROOT environment variable with the following contents: - .Download/ - .Local/ - .Web/ - .Web/index.pidx (downloaded from <index-url>) The index-url is mandatory. Ex "cpackget init --pack-root path/to/mypackroot https://www.keil.com/pack/index.pidx"`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { packRoot := viper.GetString("pack-root") indexPath := args[0] log.Debugf("Initializing a new pack root in \"%v\" using index url \"%v\"", packRoot, indexPath) createPackRoot = true err := configureInstaller(cmd, args) if err != nil { return err } installer.UnlockPackRoot() err = installer.UpdatePublicIndex(indexPath, true, true) installer.LockPackRoot() return err }, }
View Source
var ListCmd = &cobra.Command{ Use: "list [--cached|--public]", Short: "List installed packs", Long: `List all installed packs and optionally cached pack files`, Args: cobra.MaximumNArgs(0), PersistentPreRunE: configureInstaller, RunE: func(cmd *cobra.Command, args []string) error { return installer.ListInstalledPacks(listCmdFlags.listCached, listCmdFlags.listPublic, listCmdFlags.listFilter) }, }
View Source
var PackCmd = &cobra.Command{
Deprecated: "Consider running `cpackget add|rm|list` instead",
Use: "pack",
Short: "Adds/Removes Open-CMSIS-Pack packages",
Long: "Adds/Removes Open-CMSIS-Pack packages from a local file or a file hosted somewhere else on the Internet.",
PersistentPreRunE: configureInstaller,
}
View Source
var PdscCmd = &cobra.Command{
Deprecated: "Consider running `cpackget add|rm|list` instead",
Use: "pdsc",
Short: "Adds or removes Open-CMSIS-Pack packages in the local file system via PDSC files.",
PersistentPreRunE: configureInstaller,
}
View Source
var RmCmd = &cobra.Command{ Use: "rm <pack reference>", Short: "Remove Open-CMSIS-Pack packages", Long: ` Remove a pack using the reference "Vendor.Pack[.x.y.z]", "Vendor::Pack[@x.y.z]" or "[path/to/]Vendor.Pack.pdsc". $ cpackget rm Vendor.Pack.1.2.3 $ cpackget rm Vendor::Pack@1.2.3 Use the syntax above to let cpackget determine the location of pack files prior to removing them. $ cpackget rm Vendor.LocalPackInstalledViaPdsc.pdsc $ cpackget rm path/to/Vendor.LocalPackInstalledViaPdsc.pdsc cpackget also identifies if the pack was installed via PDSC file. In this case, cpackget will remove its reference from ".Local/local_repository.pidx". In the first example, since just the basename of the PDSC file path was specified, cpackget will remove *ALL* references of the PDSC file it might find. Since it is possible to have many versions of the same pack installed via different PDSC file paths, one may wish to remove a specific one by specifying a more complete PDSC file path, as shown in the second example. The version "x.y.z" is optional. Cache files (i.e. under CMSIS_PACK_ROOT/.Download/) are *NOT* removed. If cache files need to be actually removed, please use "--purge".`, Args: cobra.MinimumNArgs(1), PersistentPreRunE: configureInstaller, RunE: func(cmd *cobra.Command, args []string) error { log.Infof("Removing %v", args) var lastErr error installer.UnlockPackRoot() for _, packPath := range args { var err error if filepath.Ext(packPath) == ".pdsc" { err = installer.RemovePdsc(packPath) if err == errs.ErrPdscEntryNotFound { err = errs.ErrPackNotInstalled } } else { err = installer.RemovePack(packPath, rmCmdFlags.purge) } if err != nil { if err != errs.ErrAlreadyLogged { log.Error(err) err = errs.ErrAlreadyLogged } lastErr = err } } installer.LockPackRoot() return lastErr }, }
View Source
var UpdateIndexCmd = &cobra.Command{ Use: "update-index", Short: "Update the public index", Long: getLongUpdateDescription(), PersistentPreRunE: configureInstaller, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) error { log.Infof("Updating public index") installer.UnlockPackRoot() err := installer.UpdatePublicIndex("", true, updateIndexCmdFlags.sparse) installer.LockPackRoot() return err }, }
View Source
var Version string
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.