when publishing, use relative symbolic links
When publishing a snapshot, the pool contains the packages tree, with a absolute symbolic link toward the mirror's pool.
Is it possible to use relative symbolic links instead of absolute ones?
This is useful when moving the aptly tree to another system and/or directory tree.
My use case is the following:
- mirror/snapshot/publish on a system having internet access,
/A/aptly - rsyncing the corresponding subtree to a external disk
- rsyncing from the external disk on another system, which is a server for an isolated network; as it happens, the target system has a different tree in which the subtree is inserted
/B/aptly
Currently, I'm doing the following, before the step 2:
# rectify symbolic links: absolute to relative:
publishDirectory="/mirrors/debian/published"
while read symlink
do
{
target="$(ls -l "${symlink}" | sed --expression='s/^.*-> //' --expression 's:^/mirrors/debian/:../../../../../../../:')"
ln --symbolic --force "${target}" "${symlink}" ||
Error "cannot create symbolic link toward '${target}'!"
}
done < <(find "${publishDirectory}" -type l | sort)
Sounds like a good improvement, I wonder if that can be default mode? Or should we better introduce yet another filesystem publishing method (symlink-relative)?
IMHO, this should be the default and the absolute symbolic link an option --symlink-absolute.
I think we can't convert existing published repositories from absolute to relative publishes easily...
The conversion is a simple operation, as the code that I commented in my initial comment shows. The enhancement's point is to give the choice for the publishing either by default using relative symbolic links or explicit absolute symbolic links.
aptly is supposed to be backwards compatible, so that upgrades should never be an issue. Conversion of existing published repos is not an easy thing to implement correctly, so I would better skip it.
Okay, but for new published snapshots it would be useful, isn’t it ?
I've created a pull request here https://github.com/aptly-dev/aptly/pull/1092 Could you guys check it?