aptly icon indicating copy to clipboard operation
aptly copied to clipboard

when publishing, use relative symbolic links

Open pfelecan opened this issue 7 years ago • 7 comments

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:

  1. mirror/snapshot/publish on a system having internet access, /A/aptly
  2. rsyncing the corresponding subtree to a external disk
  3. 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)

pfelecan avatar Oct 05 '18 08:10 pfelecan

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)?

smira avatar Oct 05 '18 20:10 smira

IMHO, this should be the default and the absolute symbolic link an option --symlink-absolute.

pfelecan avatar Oct 06 '18 10:10 pfelecan

I think we can't convert existing published repositories from absolute to relative publishes easily...

smira avatar Oct 09 '18 21:10 smira

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.

pfelecan avatar Oct 13 '18 14:10 pfelecan

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.

smira avatar Oct 16 '18 22:10 smira

Okay, but for new published snapshots it would be useful, isn’t it ?

pfelecan avatar Oct 24 '18 18:10 pfelecan

I've created a pull request here https://github.com/aptly-dev/aptly/pull/1092 Could you guys check it?

vkaylee avatar Jul 05 '22 09:07 vkaylee