-
Notifications
You must be signed in to change notification settings - Fork 185
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
Automate the process of updating the license #301
Comments
This issue is open for discussion. Once we decide on what all things we need to automate, then we can proceed on for implementation. I would like to help with the implementation part too. 🙂 |
Thank you for opening this issue @vchrombie! Please could you propose:
We can use your proposal as a baseline for discussions. |
Hi @valeriocos
I have got two implementations for now.
This would change the copyright year period in all the code files in the backend folder. There is no support for the |
I would go for a simple and common definition:
Why solution 1. is weird? If I understand the approach correctly, it looks for some text in a given file and replace it, right? Solution 2. seems to be too much for what we are looking for (that tool uses templates and focuses on licences), however we can have a look at it as a source of ideas.
Maybe we could use the Git backend of Perceval to get the commits of a repository and then extract the authors of the commits in a given file. Another option could be to use the GitHub commits API to get the same information. WDYT? |
Okay.
The approach involves making a temporary file, writing all contents of the source file in the temporary file and substituting the string and at the last replacing the source file with the temporary file. I just felt weird because it is a lot of process, nothing else. 😅
Yes, exactly.
This seems to be a perfect idea. 😃 |
Thank you for the quick reply!
I see :) it's a PoC, it can be improved in the next iteration |
Hi @valeriocos Can you please check this repository, vchrombie/grimoirelab-scripts when you have time. I have written a script which fetches the authors names and updates that with the copyright information using a template. This is the result when I executed the script for the backend.py.
As of now, most of them are hard-coded. But, it can be improved by having some iteration through the files using the os module maybe. Also, the next step here is to remove the initial content (existing copyright information in the file) and add the new content (generated one). This should not affect much as git shows only additions and deletions, but not how you did. |
Hi @valeriocos A small update. I completed the script, at least it works now, but can be improved more. I tried updating the source code files too and I sent a draft PR testing the script, chaoss/grimoirelab-perceval#623. |
As of now, we have a manual process of updating the license at least updating the year.
Example: chaoss/grimoirelab-perceval@076953e
We can automate this as this applies to all the components in the grimoirelab. Maybe a small script that updates the year, which can be executed yearly once.
This can be extended to updating the Authors in the license too.
Inspired by Bitergia/prosoul#13 (comment). 🙂
The text was updated successfully, but these errors were encountered: