Overview
Used to create a C/C++ (and other techs) package manager, like PIP for python.
- see CPIP Packages - the current packages available
- these projects currently generate CPIP packages:
- see CPIP Common - C/C++ code for a logger
- see Find The Best - a tkinter GUI. The executables are published (tar/zip state)
- see C++ On the Fly Stats - C++ code for doing stats "on the fly"
- see xplat_utils UTs - unit tests for the zpm functions that work with CPIP. see ut/test_tp025, tp026 and tp027 (so far)
How to create and publish a CPIP package
1. Gen files
- Note: this assumes that the root cpip directory is in "~/projects/cpip"
- go to the repo that contains the file to publish
- determine the files to publish
- update tools/cpip_publish.json
- see below for the format of that json content
- run ./do_build (if a python executable e.g. find-the-best)
- the cpip_publish.json will have a path to the executable in the
dist/*,src/*, orlib/*files to publish
- the cpip_publish.json will have a path to the executable in the
- run “zpm cpip-publish”
- this takes the content of the cpip_publish.json and uses it to update the cpip.json and files in "~/projects/cpip"
- check it on ubuntu “find ~/projects/cpip/msys2” (or whichever directory)
- ensure all the files were copied there
- ensure the content of ~/projects/cpip/cpip.json contains the new/updated package information
- repeat this on each platform: macos, msys2 as needed
2. test the setup
I have a VM machine that replicates my website. I use this ("VM04") for test purposes to ensure that any changes I make are okay to finally publish to arrizza.com. VM04's local subnet ip address is 10.0.0.23.
- go to ubuntu
- start VM4
- in my website repo, I have a special command “zpm doit push-cpip” that publishes to the website
- go to
https://arrizza.com/web-cpipand check it is there along with the previous ones
3. upload to your website
How to use a CPIP package
- TODO the procedure for using a CPIP package
Content of tools/cpip_publish.json
This is a description of the content of the tools/cpip_publish.json file.
It is used to describe a package for use in CPIP.
deleted
- must be present
- format: boolean, true/false
- if true, the package has been deleted, ok to ignore on web page. If false the package will be published and will be available for download.
For example:
{
"abc": {
"deleted": true,
"desc": "ignore; for cpip testing only",
"dst": ".",
"dst-pattern": "{file}",
"all.paths": { "lib/other/abc.cpp": {} }
}
}
desc
- must be present
- format: text
Short description of the package. This is used to generate the web-cpip page
dst
- must be present
- format: path
This is the path in ~/projects/cpip/* that the files/executeables will exist in.
For the “all” platform, I typically use “cpip” and then files in all.src are relative to that directory.
For other platforms, I typically use "." so the paths in "ubuntu.src", etc. are relative to that directory.
{
"logger": {
"deleted": false,
"desc": "c/c++ source files<br/> logging to stdout",
"dst": "cpip",
"dst-pattern": "logger/{file}",
"all.paths": { "lib/logger/logger.h": {}, "lib/logger/logger.cpp": {} }
}
}
dst-pattern
- must be present
- format: path with symbols in it
Used to specify a pattern for the location in the ~/projects/cpip/* directory.
For example:
"dst": "cpip",
"dst-pattern": "logger/{file}"
will result with files put in ~/projects/cpip/cpip/logger/* directory.
all.paths
- must be present if the same files are used across all platforms, otherwise must not be present (use "macos.paths" etc.)
- format: dict of dictionaries
- contains a set of file paths relative to the repo root directory
For example, there will be two files in the repo_dir/lib/logger/* directory
json "all.paths": { "lib/logger/logger.h": {}, "lib/logger/logger.cpp": {} }
The {} indicates that no compression is needed for this file.
msys2.paths, macos.paths, ubuntu.paths
- must be present if there are specific files used on specific OS platforms, otherwise must not be present
- format: dict of dictionaries
- Each key is a local path relative to the repo root directory.
- If the element "compress" is specified:
- if it is "", it uses the default compression tool for that platform:
- ubuntu: tar
- macos: zip
- msys2: zip
- if it is "tar", then the tar compression tool is used. Note: it is assumed that tar is installed on that platform.
- if it is "zip", then the zip compression tool is used. Note: it is assumed that zip is installed on that platform.
- if it is "", it uses the default compression tool for that platform:
For example:
{
"msys2.paths": { "dist/find-the-best.exe": { "compress": "" } },
"macos.paths": { "dist/find-the-best": { "compress": "zip" } },
"ubuntu.paths": { "dist/find-the-best": { "compress": "tar" } }
}
Content of cpip.json
This is a description of the content of the cpip.json file
deleted
- must be present
- format: boolean, true/false
- if true, the package has been deleted, ok to ignore on page. If false the package is available for download.
desc
- must be present
- format: text
- describes the package. This is used to generate the web-cpip page
src-proj
- must be present
- format: text
- name of the repo name used to generate this package. for example, see bitbucket find-the-best
dst
- must be present
- format: path
This is the path in ~/projects/cpip/* that the files/executeables will exist in.
For the “all” platform, I typically use “cpip” and then files in all.src are relative to that directory.
For other platforms, I typically use "." so the paths in "ubuntu.src", etc. are relative to that directory.
all.src
- must be present if the same files are used across all platforms, otherwise must not be present (use "macos.src" etc.)
- format: list
- contains a list of file paths
- web site is relative to dst path: "web.../web-cpip/{dst}/{path in all.src}"
- src paths are relative to ~/projects/cpip/{dst}/{path in all.src}
"cpp-on-the-fly": { "deleted": false, "desc": "c/c++ on-the-fly statistics", "src-proj": "cpp-on-the-fly-stats", "dst": "cpip", "all.src": ["cpp_otf/otf_list.h", "cpp_otf/otf_list.cpp", "cpp_otf/otf_stats.h", "cpp_otf/otf_stats.cpp"] },
msys2.src
- must be present if there are specific files used on Windows/MSYS2, otherwise must not be present
- format: list
- contains a list of file paths
- web site is relative to dst path: "web.../web-cpip/msys2/{dst}/{path in msys2.src}"
- src paths are relative to ~/projects/cpip/msys2/{dst}/{path in msys2.src}
"find-the-best": { "deleted": false, "desc": "find the best app to sort options by criteria", "src-proj": "find-the-best", "dst": ".", "msys2.src": ["find-the-best.zip"], "macos.src": ["find-the-best.zip"], "ubuntu.src": ["find-the-best.tar.gz"] }
macos.src
- must be present if there are specific files used on macOS, otherwise must not be present
- format: list
- contains a list of file paths
- web site is relative to dst path: "web.../web-cpip/macos/{dst}/{path in msys2.src}"
- src paths are relative to ~/projects/cpip/macos/{dst}/{path in msys2.src}
ubuntu.src
- must be present if there are specific files used on ubuntu, otherwise must not be present
- format: list
- contains a list of file paths
- web site is relative to dst path: "web.../web-cpip/ubuntu/{dst}/{path in msys2.src}"
- src paths are relative to ~/projects/cpip/ubuntu/{dst}/{path in msys2.src}