You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Sterling Hughes <st...@runtime.io> on 2016/04/04 18:47:05 UTC

Newt package, package search & new

Heya,

I'm going to put a little work into newt, and how we compose projects 
with it.  I think there are a couple of areas  where I think we could 
improve:

1- "newt new" currently fetches 
github.com/apache/incubator-mynewt-blinky as a project skeleton.  I 
think there should be configurable skeletons, and the default 
(incubator-mynewt-blinky) should come bundled with the go src, so that 
you don't need internet access to create a new project skeleton.

This should make newt general purpose enough to use with any project, 
not just our OS.  While primarily useful for our OS at the moment, I 
think we want newt to stand on its own as a build & package management 
tool for embedded contexts.

2- To newt install -v, you should be able to specify a local directory 
that contains the necessary remote repositories, so if you want to 
install the new project skeleton without internet access, you can.

3- We should add a new command: newt pkg new, which can create a new 
package in the local repository, I'm thinking the format should be:

$ newt pkg new drivers/rgbled

Which will create a new package in <your_proj>/drivers/rgbled, along 
with the pkg.yml file and src and include headers. Additional options to 
this command should be a package type (default is lib), and the skeleton 
will change depending on what type is specified (e.g. bsp, or app.)

4- Package search directories.  Currently, there is a hardcoded set of 
package search directories in the base of the project, specifically:

var PackageSearchDirs []string = []string{
     "apps/",
     "compiler/",
     "fs/",
     "libs/",
     "net/",
     "hw/bsp/",
     "hw/mcu/",
     "hw/mcu/stm",
     "hw/drivers/",^[[>1;95;0c
     "hw/",
     "project/",
     "targets/",
     "sys/",
}

And then additional package directories can be specified by adding them 
to the project.pkg_dirs configuration variable in project.yml.

We could have newt pkg new automatically add non-standard directories to 
project.pkg_dirs, but it occurs to me that we may be too restrictive on 
this for no reason.   The base of our core repository is as follows:

total 88
-rw-r--r--   1 sterling  staff    531 Apr  1 17:46 DISCLAIMER
-rw-r--r--   1 sterling  staff  16360 Apr  1 17:46 LICENSE
-rw-r--r--   1 sterling  staff    254 Apr  1 17:46 NOTICE
-rw-r--r--   1 sterling  staff   9703 Apr  1 17:46 README.md
-rw-r--r--   1 sterling  staff   1713 Apr  1 17:46 RELEASE_NOTES.md
drwxr-xr-x  11 sterling  staff    374 Apr  1 17:46 apps
drwxr-xr-x   5 sterling  staff    170 Apr  1 17:46 compiler
drwxr-xr-x   4 sterling  staff    136 Apr  1 17:46 fs
drwxr-xr-x   5 sterling  staff    170 Apr  1 17:46 hw
drwxr-xr-x  17 sterling  staff    578 Apr  1 17:46 libs
drwxr-xr-x   3 sterling  staff    102 Apr  1 17:46 net
-rw-r--r--   1 sterling  staff    825 Apr  1 17:46 project.yml
drwxr-xr-x   6 sterling  staff    204 Apr  1 17:46 sys
drwxr-xr-x   3 sterling  staff    102 Apr  1 17:46 targets

As you can see, every directory here contains packages in them.  I think 
it would be better to, by default, search all directories for packages, 
and provide a configuration directive to ignore directories.

Thoughts?

Cheers,

Sterling