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

Makefile: Add a Makefile and build script #22

Closed
wants to merge 1 commit into from

Conversation

wking
Copy link

@wking wking commented Jan 2, 2018

Based on the script in-flight with spdx/license-list-XML#592, but using an external test-data directory. This script does not cover fetching those directories, but it does cover the build process once they're fetched. I didn't build the JAR myself, so I'm just hashing the JAR that Bintray is currently returning and assuming that is uncompromised.

Docs on $@, $<, and $* are here.

This pull request is an alternative to #21, we'll want one or the other.

@goneall
Copy link
Member

goneall commented Jan 2, 2018

Could you document or propose changes to the license-list-XML travis files to use these when there is a PR or commit? For example, do we clone this repo into the license-list-XML working directory?

@wking
Copy link
Author

wking commented Jan 3, 2018 via email

Based on the script in-flight with [1], but using an external
test-data directory.  This script does not cover fetching those
directories, but it does cover the build process once they're fetched.
I didn't build the JAR myself, so I'm just hashing the JAR that
Bintray is currently returning and assuming that is uncompromised.

Docs on $@, $<, and $* in [2].

The key in goneall.gpg is
0xEA760AF7CBD0E4F9013F06FB8CCBE63DE91BFF1C, imported with:

  $ gpg --search 0x8CCBE63DE91BFF1C
  gpg: data source: http://5.45.108.219:11371
  (1)     Gary O'Neall (Key for signing jar files) <gary@sourceauditor.com>
            4096 bit RSA key 8CCBE63DE91BFF1C, created: 2017-12-13
  Keys 1-1 of 1 for "0x8CCBE63DE91BFF1C".  Enter number(s), N)ext, or Q)uit > 1
  gpg: key 8CCBE63DE91BFF1C: public key "Gary O'Neall (Key for signing jar files) <gary@sourceauditor.com>" imported
  gpg: Total number processed: 1
  gpg:               imported: 1

The source keyserver is from hkp://pool.sks-keyservers.net.  I then
exported the key with:

  $ gpg --export 0x8CCBE63DE91BFF1C >goneall.gpg

When exported without ASCII armor, such keys can be used as a keyring.
The --no-default-keyring option disables the user's default keyring
(if any.  There probably won't be one on Travis).  And the --keyring
./goneall.gpg slots in our local file.  We need the ./ (at least with
GnuPG 2.1.20), because gpg2(1) has:

  If the filename does not contain a slash, it is assumed to be in the
  GnuPG home directory ("~/.gnupg" if --homedir or $GNUPGHOME is not
  used).

The output may still include:

  gpg: WARNING: This key is not certified with a trusted signature!
  gpg:          There is no indication that the signature belongs to the owner.

but that's ok, because gpg still exits zero.  And because of our
keyring manipulation, we know the key is trusted.  Signatures from any
other key will instead show:

  gpg: Can't check signature: No public key

and exit 2.

[1]: spdx/license-list-XML#592
[2]: https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
@goneall
Copy link
Member

goneall commented Jan 3, 2018

I like the makefile approach. I would like to move this into the license-list-XML repo and reference the local test data.

Since the script version already has this working and most of your recommendations have been implemented, I would like to roll out the scripts first then follow-up with an improved makefile implementation.

I would also like to implement an incremental build functionality. It takes a long time to process all of the license list.

We could detect which files were modified since the last build and enhance the SPDX tools to take a list of license-listXML files to be "compiled".

Using Make to orchestrate this would be a lot easier than implementing in a script.

@wking
Copy link
Author

wking commented Jan 3, 2018

I would like to move this into the license-list-XML repo and reference the local test data.

I'd rather not, for the reasons given here and in spdx/license-test-files#6. Managing separate checkouts (as I do in spdx/license-list-XML#593) isn't hard, and could be automated with scripts/submodules. I think that's worth it to stay dry.

Since the script version already has this working and most of your recommendations have been implemented...

This PR is also implemented ;).

...I would like to roll out the scripts first then follow-up with an improved makefile implementation.

The scripts still auto-tag releases, and I think that's a mistake. Also, I don't see a hurry to auto-publish. spdx/license-list-XML#593 has enough to auto-validate without pulling in output-format-specific code. We can circle back and auto-publish in follow-up work.

@goneall
Copy link
Member

goneall commented Jan 3, 2018

I commented out the tagging for the releases.

Once we auto-publish and test, I no longer need to manually run the scripts myself. This saves us time and allows me to go on vacations ;)

In terms of the repositories for the tests, I don't think you and are are going to agree. I do think putting the tests in a repository separate from the source XML files places a burden on contributors and maintainers of the license-list-XML repo with little or no practical benefit.

As an example, the recent PR to change the test for the Bittorrent-1.0 license would cause a failure for the next commit to the license list XML. The commit would likely be unrelated to Bittorrent. It would be confusing for the committer. Since the submittal is in a different repository, it won't be very obvious what caused the error. To fix the problem, the license XML would have to be updated. Since they are in separate repositories, you would have to coordinate the submittals to avoid test failures. If you submit the license XML first, it may fail since it doesn't match the test. If you submit the test first you have the problem describe above. As an alternative, if we maintained the tests and the license XML in the same repository you could make one commit that included both the test update and license XML update. This would logically group the changes together. Make the changes atomic. Make it easier to revert and keep consistent.

@wking
Copy link
Author

wking commented Jan 3, 2018 via email

@goneall
Copy link
Member

goneall commented Jan 3, 2018

Would you accept a submodule entry in license-list-XML to include the test data?

This would solve some of my concerns by making the changes and history more visible. Would this still require submitting the test file and license file in separate repos? If I were to make a change that required a new or updated test along with the XML file, I would like to be able to make that change in a single commit.

@goneall
Copy link
Member

goneall commented Jan 3, 2018

@wking separate question and topic:

If I were to change the interface to the RdfaLicenseGenerator tool to take in specific file patterns in place of a directory name, would you be able to update the makefile to only compile the files which have changed since the last time the license-list-data files were generated?

I am thinking the incremental builds would greatly improve the performance of the license checks and could also be used to generate the output files if we take the additional step of deleting output files on deletion of the associated XML file.

@wking
Copy link
Author

wking commented Jan 3, 2018 via email

@wking
Copy link
Author

wking commented Jan 3, 2018 via email

TOOLS=${TOOLS:-spdx-tools-*.jar}
LICENSE_XML=${LICENSE_XML:-../license-list-XML}
TEST_DATA=${TEST_DATA:-../license-test-files/simpleForGenerator}
EXPECTED_WARNINGS="\"Duplicates licenses: AGPL-3.0-or-later, AGPL-3.0-only\",\"Duplicates licenses: GFDL-1.1-or-later, GFDL-1.1-only\",\"Duplicates licenses: GFDL-1.2-or-later, GFDL-1.2-only\",\"Duplicates licenses: GFDL-1.3-or-later, GFDL-1.3-only\",\"Duplicates licenses: GPL-1.0-or-later, GPL-1.0-only\",\"Duplicates licenses: GPL-2.0-or-later, GPL-2.0-only\",\"Duplicates licenses: GPL-3.0-or-later, GPL-3.0-only\",\"Duplicates licenses: LGPL-2.0-or-later, LGPL-2.0-only\",\"Duplicates licenses: LGPL-2.1-or-later, LGPL-2.1-only\",\"Duplicates licenses: LGPL-3.0-or-later, LGPL-3.0-only\",\"Duplicates licenses: MPL-2.0, MPL-2.0-no-copyleft-exception\""
Copy link
Author

Choose a reason for hiding this comment

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

We'll be able to drop this line if spdx/license-list-XML#593 lands with its expected-warnings file.

@goneall
Copy link
Member

goneall commented Jan 3, 2018

but I'm not sure it's worth the trouble to trim a 5min build.

OK - Let's leave it as is.

@goneall
Copy link
Member

goneall commented Jan 5, 2018

I'm still of the opinion to store the test files in the license-list-XML repository.

I'm OK re-opening the discussion once we decide on the format of the test repository. Jack is still working out the proposal.

As far as keeping the 2 repositories in sync, we could exclude the canonical text tests from the license list test data repo, or, we could automatically update the test data repo when the license-list-XML canonical text is updated using the same Travis-CI scripts which test the license XML files.

@wking
Copy link
Author

wking commented Jan 5, 2018 via email

@goneall
Copy link
Member

goneall commented Jan 5, 2018

I think we're missing an opportunity for a useful separation of concerns

I do agree with this point - let's revisit this once we have the test repository fully up and running. We can always switch over to a different approach. In the tools, I have a much more robust testing framework which uses positive and negative tests. The only thing missing is a consensus on the file structure for the tests.

@newtires
Copy link

newtires commented Jan 9, 2018

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

carmenbianca pushed a commit to carmenbianca/license-list-data that referenced this pull request Apr 13, 2019
@goneall
Copy link
Member

goneall commented Sep 10, 2020

Since we have the testing up and running in the license-list-XML repo, closing this PR

@goneall goneall closed this Sep 10, 2020
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.

3 participants