Next: , Previous: , Up: Top   [Contents][Index]


7 Creating symlinks

It is a customary practice to keep in the distribution directory a latest symlink pointing to the most recent tarball available. You can maintain such symlink using the --latest option when uploading. For example:

grayupload --to ftp.gnu.org:foo --latest foo-1.0.tar.gz

This command will upload foo-1.0.tar.gz and make it available from ‘https://ftp.gnu.org/gnu/foo’. At the same time, it will create a link ‘https://ftp.gnu.org/gnu/foo/foo-latest.tar.gz’, pointing to ‘https://ftp.gnu.org/gnu/foo/foo-1.0.tar.gz’. If the foo-latest.tar.gz link already existed, it will have been replaced with the new one.

A generalized version of this option is --transform-symlink. It takes as its argument a sed-like replace expression of the form:

s/regexp/replace/[flags]

where regexp is a regular expression, replace is a replacement for each file name part that matches regexp. Both regexp and replace are described in detail in The ‘s’ Command in GNU sed.

Multiple sed expressions can be supplied in one option by separating them with a semicolon.

When processing the --transform-symlink option, the expression is applied to each release tarball name to produce a symlink name. Its result, if it differs from the original name, and is not empty, gives the name of the symbolic link. If multiple expressions are given, each subsequent expression is applied to the result of the previous one. The last expression applied produces the symlink name.

Any delimiter can be used in lieu of ‘/’, the only requirement being that it be used consistently throughout the expression. For example, the following two expressions are equivalent:

s/one/two/
s,one,two,

Changing delimiters is often useful when the regex contains slashes. For example, the --latest option described above is just a shortcut for:

--transform-symlink 's|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|'

Supported flags are:

g

Apply the replacement to all matches to the regexp, not just the first.

i

Use case-insensitive matching.

x

regexp is an extended regular expression (see Extended regular expressions in GNU sed).

number

Only replace the numberth match of the regexp.

If this flag is used together with ‘g’, this means ignore all matches before the numberth one and replace all matches from the numberth on.


Next: , Previous: , Up: Top   [Contents][Index]