Re: URL to source file

2021-01-28 Thread Emanuel Berg
Vincent Lefevre wrote: > The zsh parameter expansion syntax is very cryptic (and the > above command is far from being the worst). > >> so can you please explain that syntax or provide a URL >> where it is explained? (Or, just a list with names and/or >> examples should be sufficient, actually.) >

Re: URL to source file

2021-01-28 Thread Vincent Lefevre
On 2021-01-28 08:07:51 -0500, Greg Wooledge wrote: > On Thu, Jan 28, 2021 at 02:26:47AM +0100, Vincent Lefevre wrote: > > print -r ${${(M)${(f)"$(aptitude show units)"}:#Version:*}#* } > > I have one major objection to this: how do you handle a package that > has more than one version available?

Re: URL to source file

2021-01-28 Thread Greg Wooledge
On Thu, Jan 28, 2021 at 02:26:47AM +0100, Vincent Lefevre wrote: > Using the "units" example, we start with: > > print -r "$(aptitude show units)" > > The double quotes are necessary, as the zshexpn(1) man page says: > for command substitution: > > "If the substitution is not enclosed in doubl

Re: URL to source file

2021-01-27 Thread Vincent Lefevre
On 2021-01-27 14:46:14 +0100, Emanuel Berg wrote: > Vincent Lefevre wrote: > > > With zsh, you can avoid the pipe with zsh expansions: > > > > local ver=${${(M)${(f)"$(aptitude show $pack)"}:#Version:*}#* } > > > > or with apt-cache (which is faster than aptitude): > > > > local ver=${${(M)${(

Re: URL to source file

2021-01-27 Thread Emanuel Berg
Stefan Monnier wrote: >> It is still in some interface but good enough for >> a reference. > > https://sources.debian.org/data/main/u/units/2.18-1/definitions.units > > gives you the "raw" file. #! /bin/zsh file-url () { local pack=$1 local ver=$(dpkg-query -f '${Version}\n' -W $pack)

Re: URL to source file

2021-01-27 Thread Emanuel Berg
Stefan Monnier wrote: >> It is still in some interface but good enough for a reference. > > https://sources.debian.org/data/main/u/units/2.18-1/definitions.units > > gives you the "raw" file. Great! :) > Stefan = king -- underground experts united http://user.it.uu.se/~embe8573 https://datasw

Re: URL to source file

2021-01-27 Thread Emanuel Berg
Vincent Lefevre wrote: > With zsh, you can avoid the pipe with zsh expansions: > > local ver=${${(M)${(f)"$(aptitude show $pack)"}:#Version:*}#* } > > or with apt-cache (which is faster than aptitude): > > local ver=${${(M)${(f)"$(apt-cache show --no-all-versions > $pack)"}:#Version:*}#* } Co

Re: URL to source file

2021-01-27 Thread Andrei POPESCU
On Mi, 27 ian 21, 12:38:07, Vincent Lefevre wrote: > On 2021-01-27 12:02:53 +0100, Emanuel Berg wrote: > > > Or even better, with dpkg-query(1) > > > > > > file-url () { > > > local debian=https://sources.debian.org/src > > > local pack=$1 > > > local ver=$(dpkg-query -f '${Version}\n'

Re: URL to source file

2021-01-27 Thread Emanuel Berg
> Or even better, with dpkg-query(1) > > file-url () { > local debian=https://sources.debian.org/src > local pack=$1 > local ver=$(dpkg-query -f '${Version}\n' -W $pack) > local file=$2 > local url=$debian/$pack/$ver/$file > echo $url > } Advantage compared to previous vers

Re: URL to source file

2021-01-27 Thread Stefan Monnier
Emanuel Berg [2021-01-27 10:49:49] wrote: > tomas wrote: > >> https://sources.debian.org/src/units/2.18-1/definitions.units > > It is still in some interface but good enough for a reference. https://sources.debian.org/data/main/u/units/2.18-1/definitions.units gives you the "raw" file.

Re: URL to source file

2021-01-27 Thread Emanuel Berg
> Oh, forgot the awk + grep trick :) Or even better, with dpkg-query(1) file-url () { local debian=https://sources.debian.org/src local pack=$1 local ver=$(dpkg-query -f '${Version}\n' -W $pack) local file=$2 local url=$debian/$pack/$ver/$file echo $url } -- underground

Re: URL to source file

2021-01-27 Thread Emanuel Berg
> #! /bin/zsh > > file-url () { > local debian=https://sources.debian.org/src > local pack=$1 > local ver=$(aptitude show units | grep '^Version: ' | awk '{print $2}') > local file=$2 > local url=$debian/$pack/$ver/$file > echo $url > } # [1] > > [1] https://dataswamp.org/~i

Re: URL to source file

2021-01-27 Thread Emanuel Berg
> It is still in some interface but good enough for a reference. > > Good enough for government work! > > So it is: https://sources.debian.org/src/ + package name + > package version + file name $ file-url units definitions.units # https://sources.debian.org/src/units/2.21-1/definitions.units #!

Re: URL to source file

2021-01-27 Thread Emanuel Berg
tomas wrote: > https://sources.debian.org/src/units/2.18-1/definitions.units It is still in some interface but good enough for a reference. Good enough for government work! So it is: https://sources.debian.org/src/ + package name + package version + file name -- underground experts united h

Re: URL to source file

2021-01-27 Thread Vincent Lefevre
On 2021-01-27 12:02:53 +0100, Emanuel Berg wrote: > > Or even better, with dpkg-query(1) > > > > file-url () { > > local debian=https://sources.debian.org/src > > local pack=$1 > > local ver=$(dpkg-query -f '${Version}\n' -W $pack) > > local file=$2 > > local url=$debian/$pack/$

Re: URL to source file

2021-01-27 Thread tomas
On Wed, Jan 27, 2021 at 10:49:49AM +0100, Emanuel Berg wrote: > tomas wrote: > > > https://sources.debian.org/src/units/2.18-1/definitions.units > > It is still in some interface but good enough for a reference. > > Good enough for government work! :-) > So it is: https://sources.debian.org/

Re: URL to source file

2021-01-27 Thread tomas
On Wed, Jan 27, 2021 at 10:21:29AM +0100, Emanuel Berg wrote: > Hello, how can I get a hyperlink to a particular file in > a pack? You mean... a Debian package? > e.g., definitions.units of the units pack, i.e. > units-2.21/definitions.units ? TIA If I understood you correctly, there are several