Source tree symlink for cowthink.1 man page#27
Conversation
ccc4db2 to
aecc8c0
Compare
| $(A2X) --format manpage ./cowsay.1.adoc | ||
| set -ex; \ | ||
| mantmpdir="mantmp-$$$$"; \ | ||
| mkdir -p "$$mantmpdir"; \ |
There was a problem hiding this comment.
Can we do a MKDIR_P Makefile variable like GNU seems to do? Here's what GNU coreutils 9.1 does, at least after I run ./configure on my macOS 10.14 box:
MKDIR_P = /opt/local/bin/gmkdir -p
[...]
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
I figure a regular mkdir -p would be a good enough default, instead of detecting a GNU-specific mkdir.
The GNU Makefile Conventions say "don't use mkdir -p, because it's not supported everywhere", but I think we can disregard that since we're not trying to be super-portable to old or exotic systems.
There was a problem hiding this comment.
Can we do a
MKDIR_PMakefile variable like GNU seems to do?
Good idea. Sorry for missing that.
I figure a regular
mkdir -pwould be a good enough default, instead of detecting a GNU-specific mkdir.The GNU Makefile Conventions say "don't use
mkdir -p, because it's not supported everywhere", but I think we can disregard that since we're not trying to be super-portable to old or exotic systems.
And for those old and/or exotic systems, the user overridable MKDIR_P will rise and shine.
There was a problem hiding this comment.
And for those old and/or exotic systems, the user overridable MKDIR_P will rise and shine.
Bingo, I guess that's what it's there for. :)
There was a problem hiding this comment.
Unless... we just run mkdir "$$mantmpdir" without the -p. That should be quite portable, should it not?
OTOH, we could switch to mktemp. :-)
|
Oh, sorry if I was unclear in my PR review comment: yep, everything you said in the PR's main description makes sense, including the commit history arrangement. After #26 is merged, we'll roll this right in. And I'll play around with the |
|
Hey check it out, I think I was able to do the regular file to symlink conversion in a single commit: https://github.com/cowsay-org/cowsay/commits/apj/WIP/ndim-cowthink-symlink-in-one-comit Haven't figured out how to do it using regular commit actions (the What do you think? |
I managed to do that as well, but...
As the git user interface is that weird around this (and I have found reports on gitlab bugs around the similar thing of the web UI did not show properly when a symlink was replaced by a regular file), I would err on the side of caution and compatibility by keeping this PR as two separate commits, possibly held together by one |
Works for me; there's no real impact to that. |
b521fd5 to
4a72180
Compare
This makes the Makefile a bit more conforming to the GNU Makefile
conventions, more robust and more flexible.
* Fix: "make uninstall" removes the cows/ dir from its actual location
* Fix: Allow repeated "make install" runs to succeed instead of
failing to create a symlink which already exists.
* Add a standard "all" target
* "make uninstall" remove only the cow files we "make install", i.e.
stop removing files we did not install
* "make uninstall" removes all cowsay specific directories (if empty)
* Define and use make variables for definitions used more than
once like e.g. $(cowsdir) $(sitecowsdir)
* Use make variables for tools like e.g. $(LN_S) $(A2X) $(INSTALL_DIRS)
* Only install cow files called *.cow. Prevents e.g. editor backup
files like *.cow~ or unsupported (as of yet) *.pm format cow files
from being installed.
* Install empty %{sysconfdir}/cowsay/cowpath.d directory
* Use "install -c" for backwards compatibility with ancient "install"
It appears git cannot change a source tree file from regular file to symlink within a single commit, so this is the first part which removes the regular file. Adding the symlink will be in the next commit.
As the source tree is already using symlinks for the cowthink script, we can assume working symlinks and therefore can use them for the cowthink.1 man page as well. This has the advantage that when the man page is updated, no special treatment is required for the "man1/cowthink.1" reference inside the cowthink.1 file produced by a2x. Note that due to an apparent limitation of the git tool, an earlier commit must remove the regular file "cowthink.1" before this commit can add a symlink called "cowthink.1".
4a72180 to
3dcfce5
Compare
|
This PR appears to have been made obsolete by the switch from |
This makes the source tree
cowthink.1a symlink to thecowsay.1file just likecowthinkalready is a symlink to thecowsayscript file.This avoids the need to revert the
cowthink.1file to not have theman1/part in the reference tocowsay.1, which you need to do every timea2xhas re-built the man page fromcowsay.1.adoc.This consists of two commits which cannot be squashed. Update: This appears to be untrue after all. Some research needed.
This builds on PR 26, so for reviewing this, you only need to consider the last two commits in the series of commits.
Remove regular file
cowthink.1(preparing for symlink)It appears git cannot change a source tree file from regular file to symlink within a single commit, so this is the first part which removes the regular file. Update: Is this just limitation of
git guiandgitcan actually handle this?Adding the symlink will be in the next commit.
Make source tree
cowthink.1a symlink tocowsay.1As the source tree is already using symlinks for the
cowthinkscript, we can assume working symlinks and therefore can use them for thecowthink.1man page as well.This has the advantage that when the man page is updated, no special treatment is required for the
man1/cowthink.1reference inside thecowthink.1file produced bya2x.Note that due to an apparent limitation of the git tool, an earlier commit must remove the regular file
cowthink.1before this commit can add a symlink calledcowthink.1.