Commit graph

543 commits

Author SHA1 Message Date
Danielle McLean 08d7a9f7af Release 2.4.0
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEElCuQdazKBOkDfHP+0xtVY9rB1PoFAmYS3jkACgkQ0xtVY9rB
 1PqSxBAAvPPMSrrxdfGAL9anzCDZArRrtplbS1493fj+OiNIjDWSGsJwm1mZX1ny
 i04te8Hne/ppZs/CrYAe0PZGl6LowswBKFuHkft//f9maeXG/zl+Uh4E7dYWhXik
 N0+9cgh/ngKJ5QgQelfNxZGrHTZZmbbnNfrtuMPqGIDGIDSzNw2qlqdFzp9VxRth
 /dbLLAHoRXY2uRhSgSnEhnk+zJyxR9od5tU3p094xyUEhbBkNRzCE4TwA9oGvyFQ
 N6onEo4wj5w8Mqtu5p6BY5IktYIgechJxF86Sqy27UU/uNQyzeaG2Qs+diwScpop
 9eOsEUDY5mi7oLs4KME0SGqF/V54Spv+QDGks7bftvSQf3WQvFWX+w1fYymbtctD
 US1caKlsleODnQGmyXEBPyNwGmsLmbaF03yIW1BtLfibDxKeDXK0e2zznpBHRRGO
 2klSjH+qd2hqDT3eYNP8SLpRPUdWiuHP2fb1LV+VzjO7vR4iPLdjvTddFEsm7u2M
 IknSXtxCzJuBD4Dz9fZ/fbVEp+2wYmbtKgqmcnKSNtZ5GaFrmA96mekAbyVWYwdB
 IHuscAWlZSCwJJVPp3VMVGVdXfbYhLJRC+Ft6QAzJeJZ2Q44dxnmPDLQHpngNXWJ
 3YhZ62j5C0wInTh0NzUiDbGkxHwY1v4xJC4OXrR6k8+qqPOe1J4=
 =SC3E
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEdnljh8gT62W19LaLaFR4GgSIQhwFAmZdM3cACgkQaFR4GgSI
 Qhx/GA/7BbccrVBYNEnu1TJ9riozvN0k1AO6LE96R7QJQH+hpVcM+al4uIc2+GXA
 gcgoVtdADv7nD3DMtQsJlPxQsS+RFjaipZy3kdLSZyU3EixK/Zy2GtK0zjYLMlI/
 rGEEkPx0um3MBm/gtvfZ/pK9i9v2Au61jn49+z4moPnfc4Gk6ZlRXtggDP4ApHPp
 uHeQmr34AZ+dAcc+cs7bCuZvzxxv97WNB7dfFA8RR3+5cQzkbw+Fjjp4GT1J6ifA
 pn4znVZCdb4HhqjFoQzRi68x61MVdhEq4309Mm8xGi7fTqWgxoRPZjKmgpLUF0Wp
 rUNpmd+whNiebMhi0G1yYl1+Pf0x5Thoa7x66M6YWrSMwbr5KJuU3XFNQAr787ls
 pN3nXimX3jw1Mrp8QP4WQby563jHqG4yzBNn+qX22xXxhZOctDJFUDmGZMHHRD5D
 +GICfmgCEp1Ph/YlP4x34jnC4phoIKRs1pUQuIKZM9ECN5Pg6spbT5BmuOn2AhtF
 dLgdSfXAEhnfhxNzf+uvHgelgeeXpTTZEJbX63XoZelK337f1n9CL4Cbumm3JCNS
 YcgJV5L/lw7jRHcaSnyKY37b6iw5+vOdr5yibgJN1LlCGVEbHdpBOPoFZkBA1cTM
 TouP87RHfb47yu+W8WYnBZ+Tr9M6h1S7gfTJ+qjJf244wWaYLO8=
 =Q/B6
 -----END PGP SIGNATURE-----

Pull in upstream Stow 2.4.0
2024-06-03 13:07:34 +10:00
Adam Spiers 1e2513417d
Merge pull request #108 from aspiers/release-v2.4.0 2024-04-07 18:55:18 +01:00
Adam Spiers a7b1200b63
Merge pull request #97 from ilyagr/patch-1 2024-04-07 18:54:44 +01:00
Adam Spiers 20031c0001 Rebuild META.* 2024-04-07 18:38:12 +01:00
Adam Spiers 9985de7c78 HOWTO-RELEASE: THANKS is no longer being updated 2024-04-07 18:34:35 +01:00
Adam Spiers 413278f178 Update NEWS for v2.4.0 2024-04-07 18:32:51 +01:00
Adam Spiers fdac519bdf Bump version to 2.4.0 2024-04-07 18:24:49 +01:00
Adam Spiers 49aa3458e5 Add details on how to view coverage locally
Unfortunately for now, Coveralls reports don't include source due
to #84, but this is a good workaround.
2024-04-07 18:22:56 +01:00
Adam Spiers cbc12d7a3b stow: remove misleading comment about current dir
The current directory is changed by within_target_do() which is called
by `plan_stow()`, `plan_unstow()`, and `process_tasks()`.  It is not
changed when constructing a new `Stow` object, so remove this outdated
and misleading comment.

Fixes #102.
2024-04-07 18:00:03 +01:00
Adam Spiers 143dbf83e2
Merge pull request #107 from aspiers/improve-dotfiles-fix 2024-04-07 17:56:54 +01:00
Adam Spiers 94ed916466 t/unstow.t: move final set of tests into a subtest 2024-04-07 17:44:44 +01:00
Adam Spiers c0b8890b14 t/unstow.t: remove superfluous spaces 2024-04-07 17:24:13 +01:00
Adam Spiers 93fc195ddb Fix unstowing with --compat --dotfiles
Unstowing with `--dotfiles` didn't work with `--compat`, because when
traversing the target tree rather than the package tree, there was no
mechanism for mapping a `.foo` file or directory back to its original
`dot-foo` and determine whether it should be unstowed.

So add a reverse `unadjust_dotfile()` mapping mechanism to support
this.
2024-04-07 17:21:44 +01:00
Adam Spiers 723ddcf3a4 t/dotfiles.t: improve language in test names and assertion messages
We use the term "directory" (or "dir" for short) rather than "folder".
Also explicitly say whether a test is stowing or unstowing, and fix
the odd typo.
2024-04-07 17:21:10 +01:00
Adam Spiers 34421ba5cf stow_contents: fix bugs and corner cases with type mismatch conflicts
If the target directory as a file named X and a package has a
directory named X, or vice-versa, then it is impossible for Stow
to stow that entry X from the package, even if --adopt is supplied.

However we were previously only handling the former case, and not the
latter, and the test for the former was actually broken.  So fix
stow_contents() to handle both cases correctly, fix the broken test,
and add a new test for the latter case.
2024-04-07 17:21:10 +01:00
Adam Spiers 8ed799a3a3 t/unstow.t: create a bunch of unowned files to make tests more robust
This should make it harder for Stow to do the right thing.
2024-04-07 17:21:10 +01:00
Adam Spiers afa50077c9 dotfiles: switch {un,}stow_{contents,node}() recursion parameters
Stow walks the package and target tree hierarchies by using mutually
recursive pairs of functions:

- `stow_contents()` and `stow_node()`
- `unstow_contents()` and `unstow_node()`

As Stow runs its planning from the target directory (`plan_*()` both
call `within_target_do()`), previously the parameters for these
included:

- `$target_subpath` (or `$target_subdir` in the `*_node()` functions):
  the relative path from the target top-level directory to the target
  subdirectory (initially `.` at the beginning of recursion).  For
  example, this could be `dir1/subdir1/file1`.

- `$source`: the relative path from the target _subdirectory_ (N.B. _not_
  top-level directory) to the package subdirectory.  For example, if
  the relative path to the Stow directory is `../stow`, this could be
  `../../../stow/pkg1/dir1/subdir1/file1`.  This is used when stowing
  to construct a new link, or when unstowing to detect whether the
  link can be unstowed.

Each time it descends into a further subdirectory of the target and
package, it appends the new path segment onto both of these, and also
prefixes `$source` with another `..`.  When the `--dotfiles` parameter
is enabled, it adjusts `$target_subdir`, performing the `dot-foo` =>
`.foo` adjustment on all segments of the path in one go.  In this
case, `$target_subpath` could be something like `.dir1/subdir1/file1`,
and the corresponding `$source` could be something like
`../../../stow/pkg1/dot-dir1/subdir1/file1`.

However this doesn't leave an easy way to obtain the relative path
from the target _top-level_ directory to the package subdirectory
(i.e. `../stow/pkg1/dot-dir1/subdir1/file1`), which is needed for
checking its existence and if necessary iterating over its contents.

The current implementation solves this by including an extra `$level`
parameter which tracks the recursion depth, and uses that to strip the
right number of leading path segments off the front of `$source`.
(In the above example, it would remove `../..`.)

This implementation isn't the most elegant because:

- It involves adding things to `$source` and then removing them again.

- It performs the `dot-` => `.` adjustment on every path segment
  at each level, which is overkill, since when recursing down a level,
  only adjustment on the final subdirectory is required since the higher
  segments have already had any required adjustment.

  This in turn requires `adjust_dotfile` to be more complex than it
  needs to be.

  It also prevents a potential future where we might want Stow to
  optionally start iterating from within a subdirectory of the whole
  package install image / target tree, avoiding adjustment at higher
  levels and only doing it at the levels below the starting point.

- It requires passing an extra `$level` parameter which can be
  automatically calculated simply by counting the number of slashes
  in `$target_subpath`.

So change the `$source` recursion parameter to instead track the
relative path from the top-level package directory to the package
subdirectory or file being considered for (un)stowing, and rename it
to avoid the ambiguity caused by the word "source".

Also automatically calculate the depth simply by counting the number
of slashes, and reconstruct `$source` when needed by combining the
relative path to the Stow directory with the package name and
`$target_subpath`.

Closes #33.
2024-04-07 17:21:07 +01:00
Adam Spiers 744ba651f5 unstow_link_node(): don't register conflicts when unstowing unowned links 2024-04-07 15:47:38 +01:00
Adam Spiers 06fdfc185f merge unstow_orig.t into unstow.t and fix unstowing logic
There was a ton of duplication which is not maintainable, so refactor
everything into a single test which still covers the differences.

This in turn revealed some issues in the unstowing logic:

- We shouldn't conflict if we find a file which isn't a link or a
  directory; we can just skip over it.

- Unstowing with `--dotfiles` was using the wrong variable to obtain
  the package path, and as a result having to perform an unnecessary
  call to `adjust_dotfile()`.

So fix those at the same time.
2024-04-07 15:47:38 +01:00
Adam Spiers 001b287b1b allow playground/ directory for testing stuff 2024-04-07 15:47:38 +01:00
Adam Spiers a7c251c316 tidy up MANIFEST.SKIP 2024-04-07 15:47:38 +01:00
Adam Spiers 5e21f47879 read_a_link(): clarify debug message when it's a real link 2024-04-07 15:47:38 +01:00
Adam Spiers a070116621 Fix Dockerfile by updating from jessie to bookworm 2024-04-07 13:50:09 +01:00
Adam Spiers fee2225dc9
Merge pull request #106 from aspiers/dev 2024-04-06 15:37:36 +01:00
Adam Spiers 5bb65f60d6 Update manifest files to keep ./Build distcheck happy 2024-04-06 15:09:53 +01:00
Adam Spiers 748a34b211 Revert "testutil: Add sanity check for cwd"
This reverts commit 5d4e68291e.

It turns out that this broke `make distcheck`.
2024-04-06 14:59:52 +01:00
Adam Spiers 7815bc8b44 Revert "Remove unnecessary AM_MAKEINFOFLAGS tweak"
This reverts commit 1a20a3f7ee.

It turns out that `texi2dvi` _does_ require `-I $(srcdir)` for
`@verbatiminclude default-ignore-list` to work after all.  It's needed
not for a normal docs build, but when `make distcheck` is run,
presumably because `distcheck` runs from a different directory.
2024-04-06 14:54:32 +01:00
Adam Spiers c691b8fa6e Makefile.am: include DEFAULT_IGNORE_LIST in doc_deps 2024-04-06 14:39:16 +01:00
Adam Spiers 2a647d125f iterate over directories in sorted order
This makes behaviour more deterministic, and makes debugging easier.
2024-04-06 13:33:53 +01:00
Adam Spiers e9ad20576c t/unstow.t: convert to use subtests 2024-04-06 11:59:23 +01:00
Adam Spiers 6d6781dcef t/unstow_orig.t: use like() for regexp matching tests
This is better because it outputs the mismatching value when
the matching check fails.
2024-04-06 11:59:10 +01:00
Adam Spiers 599944bce1 t/unstow_orig.t: use is() for equality tests
This is better because it outputs the mismatching values when
the equality check fails.
2024-04-06 11:51:37 +01:00
Adam Spiers bca711fac2 tests: use stderr_like() instead of home-grown STDERR capturing
The STDERR capturing in testutil just reinvents Test::Output which
we already use in chkstow.t, so it's pointless to reinvent that wheel.
2024-04-06 11:33:18 +01:00
Adam Spiers ebfbb6cc13 testutil: rename parameter names to be less confusing
$target was the source of the link, and $source was the
target (destination) of the link.  Obviously this was hopelessly
confusing, so rename to avoid this.
2024-04-05 22:32:12 +01:00
Adam Spiers 238346f134 manual: clarify the pros and cons and history of --compat 2024-04-05 22:28:40 +01:00
Adam Spiers 96ada510fd
Merge pull request #105 from aspiers/github-workflow 2024-04-05 01:57:29 +01:00
Adam Spiers 58c1946ed9 Port Travis CI workflow to a GitHub CI workflow
Travis is no longer free, so move to GitHub.  (In the future ideally
we should reduce dependencies on proprietary platforms.)
2024-04-05 01:52:42 +01:00
Adam Spiers 4cde7eb19f t/stow.t: fix typos, whitespace, and ordering of lines 2024-04-01 23:58:17 +01:00
Adam Spiers 67081cec02 testutil: use croak() instead of die() for more useful errors 2024-04-01 23:58:17 +01:00
Adam Spiers 1282acf6b5 t/stow: use like() instead of ok(... =~ /.../) 2024-04-01 23:58:17 +01:00
Adam Spiers 4cac249ddc rename $path => $target_path in node helpers
is_a_node(), is_a_dir(), is_a_link() all operate on paths within
the target directory, so make this explicit by avoiding the vague
variable name "$path".
2024-04-01 23:58:17 +01:00
Adam Spiers 2c9065995c fold_tree: rename $target parameter to $target_subdir
$target is vague and could refer to the top-level target directory,
so rename to clarify.
2024-04-01 22:39:32 +01:00
Adam Spiers 8f6a320b50 fold_tree: rename $source parameter to $pkg_subpath
$source is vague and confusing as per the manual.
2024-04-01 22:39:32 +01:00
Adam Spiers bae7890aa5 unstow_node / unstow_existing_node: rename foldable return value
$parent is a bit vague so rename to $parent_in_pkg.
2024-04-01 22:39:32 +01:00
Adam Spiers b3ed86d616 unstow_valid_link: rename $existing_path
Unqualified references to "path" are horribly vague, so rename to
$existing_pkg_path_from_cwd for clarity.
2024-04-01 22:39:32 +01:00
Adam Spiers c45a0632a9 stow_node: rename $existing_path
Unqualified references to "path" are horribly vague, so rename to
$existing_pkg_path_from_cwd for clarity.
2024-04-01 22:39:32 +01:00
Adam Spiers 3c904dade2 link_owned_by_package: rename $source => $link_dest
The use of the word "source" to describe a link's destination is
confusing in the context of Stow for reasons explained in the manual.

So rename the $source variable to avoid this.
2024-04-01 22:39:32 +01:00
Adam Spiers 381fd71155 remove or rename XXX
Remove old XXX FIXMEs which tell us nothing useful and may not be
relevant any more.

Also rename another XXX to an industry-standard FIXME.
2024-04-01 22:39:32 +01:00
Adam Spiers 221449d640 unstow_node: remove redundant return 2024-04-01 22:39:32 +01:00
Adam Spiers a337a2fcd0 Change debug indentation in some helpers
These helpers can be called at more deeply nested levels, so they
should be indented more than they were.
2024-04-01 22:39:32 +01:00