Update man pages with current date and curl/libcurl version number when running maketgz #1058
My only hesitation about doing this, is that it makes it harder for users who want to run diff to see what changed and this scripts unconditionally updates all man pages disregarding if they are identical or not.
Would it make sense to also mark the page somehow that it was updated (and then we can commit the updates too) so that repeated runs only would update those that actually were changed since the previous run?
Hmm... having given some thought about it...
What about having a file that has a list of man pages with hashes, compare with the hash in the list with the hash for the actual file. If it has changed then update otherwise leave alone?
Also have the script check for deleted man pages and remove them from the list as needed when it runs.
Oh hey, I came to think of another approach!
If we assume or require that the user who runs this script does it in the checked-out git repo (which I think is a fair requirement), then we can just check with git if there has been any changes in the given file since the date used in the file! Like this:
It has the nice upside that anyone can run the script at any time without having to store any additional hashes or similar.
I played around with this a bit and I've thought about some things:
The downside with (2) would be that it doesn't update the date/version in git, but I'm not sure that matters a whole lot.
If there would be anything else, it would be that this script uses different indenting and slightly different code style than other perl scripts in our repo do.
I've applied your patch and made a couple of alterations to the script and it now generates the updated man pages with the ".dist" extension.
At the moment, I have an issue with certain man pages when it runs git log in that it returns data each time when it shouldn't.
If I do
I'll bring the code style of the script into line with the other perl scripts in the repo and then push those changes to my local repo.
Added script to update man pages to use the current date and curl/libcurl versions. updatemanpages.pl has three arrays: list of directories to look in, list of extensions to process, list of files to exclude from processing. Check man page in git repoistory using the date from the existing man page before updating to avoid updating the man page if no change is made. If data is received from the git command then update the man page with the current date and version otherwise leave alone. Applied patch from badger to make the date argument optional, change the git command used, added date argument to processfile subroutine and print to STDERR if no date is found in a man page. Added code to process the changed man page into a new man page with .dist added to the filename to keep the original source files unchanged. Updated POD documentation to reflect that the date argument optional. Code style is in line with CODE_STYLE.md. Directories: docs/ docs/libcurl/ docs/libcurl/opts/ tests/ Extensions: .1 .3 Excluded files: mk-ca-bundle.1 template.3 (TODO Section 3.1)
maketgz now runs scripts/updatemanpages.pl to update the man pages .TH section to use the current date and curl/libcurl version. (TODO Section 3.1)