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

interactively query for license, suggest SPDX licenses #1902

Merged
merged 10 commits into from
Sep 6, 2023

Conversation

WebFreak001
Copy link
Member

@WebFreak001 WebFreak001 commented Mar 19, 2020

This is a rebase of #1101

@dlang-bot
Copy link
Collaborator

Thanks for your pull request, @WebFreak001!

@WebFreak001
Copy link
Member Author

updated, now allows entering raw values if they are present in the list (e.g. sdl, json; for backwards compatibility) and displays items in column order, not in row order now. (User feedback with sample size of 2 preferred this ordering)

Example output:

Select a package recipe format
1) sdl    2) json   
#? [2]: 
Name [a]: 
Description [A minimal D application.]: 
Author name [webfreak]: 
Select or enter a license (https://choosealicense.com/)
 1) MIT                   5) BSD 3-clause          9) Apache-2.0           
 2) BSL-1.0 (Boost)       6) BSD 2-clause         10) MPL-2.0 (Mozilla)    
 3) public domain         7) GPL-2.0              11) AGPL-3.0             
 4) GPL-3.0               8) LGPL-3.0             12) proprietary          
? [12]: 
Copyright string [Copyright © 2023, webfreak]: 
Add dependency (leave empty to skip) []: 
     Success created empty project in /home/webfreak/dev/dub/a
             Package successfully created in .

@WebFreak001 WebFreak001 requested a review from Geod24 January 11, 2023 00:13
@WebFreak001 WebFreak001 force-pushed the default_license branch 2 times, most recently from 322d0f9 to f3a9598 Compare January 11, 2023 20:15
source/dub/commandline.d Outdated Show resolved Hide resolved
@adamdruppe
Copy link

lgtm i think

@WebFreak001
Copy link
Member Author

just saw the license list is actually problematic, will adjust it to use what's documented on dub right now. We can change it later for properly specified licenses, e.g. #2403

@WebFreak001 WebFreak001 marked this pull request as draft January 11, 2023 20:26
@WebFreak001 WebFreak001 marked this pull request as ready for review January 11, 2023 21:49
@WebFreak001
Copy link
Member Author

preview:
image
image

@WebFreak001
Copy link
Member Author

WebFreak001 commented Jan 11, 2023

aggregated nearly all the licenses used on DUB:

849    MIT
628    BSL-1.0
120    Apache-2.0
96    LGPL-3.0
67    GPL-3.0
61    public domain
61    proprietary
58    BSD 3-clause
42    Zlib
38    BSD 2-clause
26    MPL-2.0
20    GPL-2.0
20    CC0
19    ISC
17    BSD
16    AGPL-3.0
14    LGPL-2.1
12    LGPL-1.0
12    GPL-3.0 or later
9    GPL-1.0
8    ESL-1.0
7    WTFPL
7    Unlicense
7    LGPL-2.1 or later
7    GPL-2.0 or later
4    MS-PL
4    Apache-1.0
3    OpenSSL or SSLeay
3    NYSL
3    LGPL-3.0-or-later
2    LGPL 2.0+
2    FreeBSD
2    Fair Use License v2
2    CC Attribution-ShareAlike 
2    ASL-2.0
2    AGPL-3.0 or later
1    X11
1    WTFPL-2.0
1    VST
1    utf8proc
1    UIM
1    PSFv2
1    OpenLDAP
1    NIT
1    NetCDF
1    Microline
1    LGPL license with additional exceptions
1    LGPL 2.0
1    FreeBSD 2-clause
1    FOSS
1    EPL-1.0
1    DarkRiDDeR
1    CDDL
1    BSD-like(2-clause)
1    BSD-like
1    BSD 2-Clause "Simplified" License
1    Anti-996
1    ALGP3

The license table is now only 2 columns wide because of some wider strings:
image

@WebFreak001 WebFreak001 changed the title interactively query for license interactively query for license, suggest SPDX licenses Jan 11, 2023
@WebFreak001
Copy link
Member Author

@Geod24 what do you think of this one to start the transition to SPDX?

Next I would change the dub docs to suggest using SPDX licenses and then inside DUB add an SPDX checker and emit warnings when the used license is invalid.

MartinNowak and others added 9 commits September 5, 2023 21:08
- add select input (also for sdl/json)
- provide common license defaults (choosealicense.com options + Boost)
- order options by popularity
users liked it better if indexing went from up to down first, than from
left to right.
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

✅ PR OK, no changes in deprecations or warnings

Total deprecations: 14

Total warnings: 0

Build statistics:

 statistics (-before, +after)
-executable size=5329096 bin/dub
+executable size=5357768 bin/dub
 rough build time=80s
Full build output
DUB version 1.33.1, built on Aug 26 2023
LDC - the LLVM D compiler (1.34.0):
  based on DMD v2.104.2 and LLVM 16.0.6
  built with LDC - the LLVM D compiler (1.34.0)
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake-avx512
  http://dlang.org - http://wiki.dlang.org/LDC


  Registered Targets:
    aarch64     - AArch64 (little endian)
    aarch64_32  - AArch64 (little endian ILP32)
    aarch64_be  - AArch64 (big endian)
    amdgcn      - AMD GCN GPUs
    arm         - ARM
    arm64       - ARM64 (little endian)
    arm64_32    - ARM64 (little endian ILP32)
    armeb       - ARM (big endian)
    avr         - Atmel AVR Microcontroller
    bpf         - BPF (host endian)
    bpfeb       - BPF (big endian)
    bpfel       - BPF (little endian)
    hexagon     - Hexagon
    lanai       - Lanai
    loongarch32 - 32-bit LoongArch
    loongarch64 - 64-bit LoongArch
    mips        - MIPS (32-bit big endian)
    mips64      - MIPS (64-bit big endian)
    mips64el    - MIPS (64-bit little endian)
    mipsel      - MIPS (32-bit little endian)
    msp430      - MSP430 [experimental]
    nvptx       - NVIDIA PTX 32-bit
    nvptx64     - NVIDIA PTX 64-bit
    ppc32       - PowerPC 32
    ppc32le     - PowerPC 32 LE
    ppc64       - PowerPC 64
    ppc64le     - PowerPC 64 LE
    r600        - AMD GPUs HD2XXX-HD6XXX
    riscv32     - 32-bit RISC-V
    riscv64     - 64-bit RISC-V
    sparc       - Sparc
    sparcel     - Sparc LE
    sparcv9     - Sparc V9
    spirv32     - SPIR-V 32-bit
    spirv64     - SPIR-V 64-bit
    systemz     - SystemZ
    thumb       - Thumb
    thumbeb     - Thumb (big endian)
    ve          - VE
    wasm32      - WebAssembly 32-bit
    wasm64      - WebAssembly 64-bit
    x86         - 32-bit X86: Pentium-Pro and above
    x86-64      - 64-bit X86: EM64T and AMD64
    xcore       - XCore
   Upgrading project in /home/runner/work/dub/dub/
    Starting Performing "release" build using /opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/ldc2 for x86_64.
    Building dub 1.34.0+commit.33.g34a2c845: building configuration [application]
source/dub/dependency.d(917,18): Deprecation: scope variable `this` assigned to non-scope parameter `oth` calling `opEquals`
source/dub/dependency.d(920,30): Deprecation: scope variable `this` assigned to non-scope parameter `a` calling `doCmp`
source/dub/dependency.d(921,27): Deprecation: scope variable `this` assigned to non-scope parameter `b` calling `doCmp`
source/dub/dependency.d(939,26): Deprecation: scope variable `this` assigned to non-scope parameter `oth` calling `opEquals`
source/dub/internal/configy/Exceptions.d(130,34): Deprecation: reference to local variable `buffer` assigned to non-scope anonymous parameter
source/dub/internal/configy/Exceptions.d(134,34): Deprecation: reference to local variable `buffer` assigned to non-scope anonymous parameter
source/dub/internal/configy/Exceptions.d(248,27): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
source/dub/internal/configy/Exceptions.d(250,27): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
source/dub/internal/configy/Exceptions.d(283,27): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
source/dub/internal/configy/Exceptions.d(286,27): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
source/dub/internal/configy/Exceptions.d(323,31): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
source/dub/internal/configy/Exceptions.d(325,31): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
source/dub/internal/configy/Exceptions.d(332,31): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
source/dub/internal/configy/Exceptions.d(335,31): Deprecation: `@safe` function `formatMessage` calling `formattedWrite`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/write.d(537,34):        which calls `std.format.spec.FormatSpec!char.FormatSpec.writeUpToNextSpec!(void delegate(in char[]) @safe).writeUpToNextSpec`
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        which wouldn't be `@safe` because of:
/opt/hostedtoolcache/dc/ldc2-1.34.0/x64/ldc2-1.34.0-linux-x86_64/bin/../import/std/format/spec.d(258,33):        scope variable `this` assigned to non-scope parameter `e` calling `put`
     Linking dub
STAT:statistics (-before, +after)
STAT:executable size=5357768 bin/dub
STAT:rough build time=80s

@WebFreak001 WebFreak001 merged commit 2ea8838 into dlang:master Sep 6, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants