Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore meson subproject directories #496

Merged
merged 5 commits into from May 13, 2022
Merged

ignore meson subproject directories #496

merged 5 commits into from May 13, 2022

Conversation

ventosus
Copy link
Contributor

@ventosus ventosus commented Feb 3, 2022

Meson subprojects should be handled similarly to git submodules. Meson
subprojects may actually be git submodules, but they may also just be
regular directories e.g. included via git subtree or via other means.

If the project of question uses meson as its build system, e.g. has the
following file:

./meson.build

Then directories in the subprojects root directory should be ignored by
default:

./subprojects/libfoo/foo.c
./subprojects/libbar/bar.c

Normal files in the subprojects root directory are normally parsed:

./subprojects/libfoo.wrap
./subprojects/libbar.wrap

This can be overriden with the command line switch:

reuse --include-meson-subprojects lint

Relevant resources are at [1] and [2].

[1] https://mesonbuild.com/Subprojects.html
[2] https://mesonbuild.com/Wrap-dependency-system-manual.html

@mxmehl
Copy link
Member

mxmehl commented Feb 4, 2022

Thanks for your suggestion and the code!

Before looking at the code too closely (for which others are better suited anyway), I am not sure whether we want to have this flag enabled by default like the submodules. I assume there are other projects out there that contain a subproject directory without using meson at all.

I comparison, Git submodules are excluded by default by the REUSE spec, so it makes totally sense to also exclode them in the tool.

tests/test_main.py Outdated Show resolved Hide resolved
@ventosus
Copy link
Contributor Author

ventosus commented Feb 6, 2022

I assume there are other projects out there that contain a subproject directory without using meson at all.

The code of course checks whether meson is used as build system, and only then excludes directories in the subprojects folder.

I comparison, Git submodules are excluded by default by the REUSE spec, so it makes totally sense to also exclode them in the tool.

Maybe I'm blind, but I cannot see any mention of git submodules in the spec to be excluded from linting .Only files that are part of version control or specifically excluded from version control are skipeed while linting. git submodules are under version control.

@mxmehl
Copy link
Member

mxmehl commented Feb 8, 2022

The code of course checks whether meson is used as build system, and only then excludes directories in the subprojects folder.

Ah OK, I see. @carmenbianca @silverhook what do you think about such a specific ignore?

Maybe I'm blind, but I cannot see any mention of git submodules in the spec to be excluded from linting .Only files that are part of version control or specifically excluded from version control are skipeed while linting. git submodules are under version control.

You are right, this issue is still open but the path is clear: the spec will ignore Git submodules. fsfe/reuse-docs#36

@ventosus
Copy link
Contributor Author

ventosus commented Feb 8, 2022

You are right, this issue is still open but the path is clear: the spec will ignore Git submodules. fsfe/reuse-docs#36

I see. This solves the issue for those that include subprojects via git submodules but not for those that include subprojects via other means, e.g. git subtree or verbatim copy.

For a meson project it's pretty clear that every directory und ./subprojects is a subproject. If the --recursive flag will ever come around, it could make sense to subsum meson subprojects with git submodules.

Why have I come up with this patch in the first place?

Really a lot of my projects include subprojects via *git subtree and look like this, e.g. they're all esoteric in @carmenbianca's terms ;-)

  • projA
    • meson.build
    • LICENSES
      • MIT
      • ISC
    • .reuse
      • dep5 (Files subprojects / ext /* ISC)
    • src
      • foo.c
    • subprojects
      • projB
        • meson.build
        • LICENSES
          • MIT
          • ISC
        • .reuse
          • dep5 (Files ext / * ISC)
        • src
          • bar.c
        • ext
          • hi.c

As the subprojects are mine, too, the parent project would comply to REUSE, but in order to do so, I need to duplicate the dep5 files from all subprojects which is superfluous, as the information is already there. I'd really like to get rid of the unneeded dep5 file the the parent project.

Maybe there's a better solution for my use case than this patch here? I don't know.

@ventosus
Copy link
Contributor Author

ventosus commented Feb 8, 2022

As a side note, all my subprojects are checked for and pass REUSE compatibility individually as part of the build/test mechanism, so no information is lost by excluding them from linting of the parent project. E.g. when building/testing the parent project, meson builds/tests all its subprojects individually.

Example output of the tests that are in one of my projects https://git.open-music-kontrollers.ch/lv2/mephisto.lv2

[hp@melamori build (master)]$ ninja test
[0/1] Running all tests.
 1/27 d2tk / FiraSans-Bold.ttf                            OK               0.05s
 2/27 d2tk / FiraCode-Light.ttf                           OK               0.05s
 3/27 d2tk / FiraCode-Regular.ttf                         OK               0.06s
 4/27 d2tk / FiraCode-Medium.ttf                          OK               0.06s
 5/27 d2tk / FiraCode-Bold.ttf                            OK               0.08s
 6/27 ser_atom.lv2 / Test                                 OK               0.05s
 7/27 d2tk / Test core                                    OK               0.26s
 8/27 timely.lv2 / LV2 validate                           OK               0.18s
 9/27 props.lv2 / Test                                    OK               0.01s
10/27 props.lv2 / LV2 validate                            OK               0.11s
11/27 varchunk / Test                                     OK               0.56s
12/27 d2tk / Test base                                    OK               0.87s
13/27 props.lv2 / LV2 lint                                OK               0.54s
14/27 timely.lv2 / LV2 lint                               OK               0.83s
15/27 mephisto.lv2 / LV2 validate                         OK               0.13s
16/27 mephisto.lv2 / FAUST bank-filter_through            OK               0.05s
17/27 mephisto.lv2 / FAUST bank-filter_gain               OK               0.03s
18/27 mephisto.lv2 / FAUST bank-time_lfo                  OK               0.06s
19/27 mephisto.lv2 / FAUST bank-instrument_osc            OK               0.07s
20/27 mephisto.lv2 / FAUST bank-analyzer_vu-meter         OK               0.04s
21/27 varchunk / REUSE                                    OK               1.35s
22/27 ser_atom.lv2 / REUSE                                OK               1.33s
23/27 timely.lv2 / REUSE                                  OK               1.18s
24/27 props.lv2 / REUSE                                   OK               0.90s
25/27 d2tk / REUSE                                        OK               1.49s
26/27 mephisto.lv2 / REUSE                                OK               0.81s
27/27 mephisto.lv2 / LV2 lint                             OK               0.94s


Ok:                 27  
Expected Fail:      0   
Fail:               0   
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0

@mxmehl mxmehl added this to the v1.0.0 milestone May 6, 2022
ventosus and others added 3 commits May 12, 2022 14:44
Meson subprojects should be handled similarly to git submodules. Meson
subprojects may actually be git submodules, but they may also just be
regular directories e.g. included via git subtree or via other means.

If the project of question uses meson as its build system, e.g. has the
following file:

    ./meson.build

Then directories in the subprojects root directory should be ignored by
default:

    ./subprojects/libfoo/foo.c
    ./subprojects/libbar/bar.c

Normal files in the subprojects root directory are normally parsed:

    ./subprojects/libfoo.wrap
    ./subprojects/libbar.wrap

This can be overriden with the command line switch:

    reuse --include-meson-subprojects lint

Relevant resources are at [1] and [2].

[1] https://mesonbuild.com/Subprojects.html
[2] https://mesonbuild.com/Wrap-dependency-system-manual.html
Signed-off-by: Carmen Bianca Bakker <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca Bakker <carmenbianca@fsfe.org>
@carmenbianca
Copy link
Member

Pushed some changes/fixes to the branch; now LGTM.

Thanks @ventosus !

Ready for review.

@carmenbianca
Copy link
Member

Ah, this still needs a change log entry.

Copy link
Member

@mxmehl mxmehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but yes, please do the changelog entry before merging.

@seabass-labrax
Copy link
Contributor

seabass-labrax commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants