[build2] Adding a package in a project seems to break the project build

Klaim - Joël Lamotte mjklaim at gmail.com
Tue Jul 17 14:01:09 UTC 2018


On 17 July 2018 at 15:08, Boris Kolpackov <boris at codesynthesis.com> wrote:
> Klaim - Joėl Lamotte <mjklaim at gmail.com> writes:
>
>> I guess my issue then becomes: there should be an error when trying to
>> attempt to add a package inside another
>
> Good idea, added the diagnostics.


Cool! I will try that soon.

By the way, I found a similar but slightly different issue:
if I have a package repository, so not-a-package, but I have a
buildfile (that build the packages in subdirectories),
then when trying to use this repository as a dependency I end up with
other errors.
Similarly, this should be prevented: having a buildfile in the rood
directory of a package repository.

I ended up in this situation after moving files around and missed that one.
I think it's easy to get there when you initially have a repo with a
project (with buildfile and manifest) but then you decide to make the
repository a package repository.

So some suggestions (not sure what would work best):

 1.1. Any operation in a package repository should fail with an
appropriate "why" report if:
   - there is a buildfile
   - there is a manifest file
 1.2. Maybe same check for any operation in a package? Don't allow
packages.manifest?
 1.3. Maybe a mix of both previous suggestions: some kind of
"undefined directory kind: package or package repository? Conflicting
files found: manifest/buildfile and packages.manifest"
 2. Have a report for this conflict/undetermination when doing `bdep
status` so that it's easy for someone doing manual maintenance of
these files or moving them to check if they messed up.
 3. Consider adding a command in bdep to:
 3.1. ...explicitly convert the current repository from a package
(buildfile,manifest) to a package repository with 1 package which is
the intial repo.
That woudld be equivalent to (not tried):

  cd ./myproject
  mkdir myproject
  mv *.* ./myproject/*
  bdep new myproject -d . --t empty   #or any command that would setup
the current directory into a package repository, adding
packages.manifest
 #then add myproject/ to the packages.manifest

That would be helpful while growing a project.
The alternative, of course, is to just document these steps for this
kind of conversion. After all it doesn't happen every day.
There is no need to consider the reverse conversion.

3.2. ... rename a package in a package repository : that would change
both the package directory name and the manifest together,
   and the references in .bdep too.

It's only suggestions but at least 3.1 and 1.3 would be helpful.

A. Joël Lammotte



More information about the users mailing list