Re: Need help with uscan

2019-04-25 Thread Andrius Merkys
Hi Alex,

On 2019-04-25 15:51, Alex Mestiashvili wrote:
> have you found a solution?
> I managed to craft the following d/watch:

[snip]

Thanks, I have already managed to put together something very similar,
which also works fine.

Best,
Andrius

-- 
Andrius Merkys
Vilnius University Institute of Biotechnology, Saulėtekio al. 7, room V325
LT-10257 Vilnius, Lithuania



Re: Need help with uscan

2019-04-25 Thread Alex Mestiashvili
On 4/24/19 11:01 AM, Andrius Merkys wrote:
> Hello,
> 
> I want to package unversioned source. AFAIK, it should be possible to
> have timestamp of the last tarball change in lieu of upstream version. I
> am wondering if it would be possible to write uscan rules to extract the
> timestamp and download the upstream tarball by analyzing the following
> HTML excerpt (taken from [1]):
> 
>  href="reference-structures.tar.gz">reference-structures.tar.gz2013-03-12
> 12:16 6.4M
> 
> where the "reference-structures.tar.gz" is the tarball I want and
> "2013-03-12" is the timestamp.
> 
> Thanks in advance,
> Andrius
> 
> [1] https://www2.mrc-lmb.cam.ac.uk/personal/pemsley/coot/dependencies/
> 
> -- 
> Andrius Merkys
> Vilnius University Institute of Biotechnology, Saulėtekio al. 7, room V325
> LT-10257 Vilnius, Lithuania
> 

Hi Andrius,

have you found a solution?
I managed to craft the following d/watch:

https://paste.debian.net/hidden/7ed83d37/

version=4
opts="pagemangle=s/(?:.*)(@PACKAGE@)(\.tar\.gz).*?(\d{4}-\d{2}-\d{2})(?:.*)//g, \
uversionmangle=s/(?:.*)\.([\d-]*)/$1/, \
downloadurlmangle=s{(.*)(\.tar\.gz)}{https://www2.mrc-lmb.cam.ac.uk/personal/pemsley/coot/dependencies/@PACKAGE@$2};
\
https://www2.mrc-lmb.cam.ac.uk/personal/pemsley/coot/dependencies
(@PACKAGE@@ANY_VERSION@@ARCHIVE_EXT@)

I am pretty sure one can optimize it, but this seem to work too.

Best,
Alex



Re: Need help with uscan

2019-04-25 Thread Andrius Merkys
Hi Paul,

On 2019-04-25 04:09, Paul Wise wrote:
> uscan now supports arbitrary mangling of the page HTML using the
> pagemangle option. This combined with the downloadurlmangle option
> could easily accommodate this website.

Thanks for the directions. I will check this out.

> I think that would be a workaround and the real fix is to talk
> upstream into importing their code into a VCS and producing properly
> signed and tagged releases (with signed versioned tarballs).

Indeed. I will contact the upstream, but for the time being I'd like to
have even this temporary solution.

Best wishes,
Andrius

-- 
Andrius Merkys
Vilnius University Institute of Biotechnology, Saulėtekio al. 7, room V325
LT-10257 Vilnius, Lithuania



Re: Need help with uscan

2019-04-25 Thread Andrius Merkys
Hi Ben,

On 2019-04-25 03:59, Ben Finney wrote:
> So, for an upstream source tarball with timestamp “2013-03-12T12:16”,
> mangle that to the version string “0+2013.03.12.12.16” (and hence the
> first Debian release of that upstream source has the Debian package
> version string “0+2013.03.12.12.16-1”).

I was going for exactly this upstream version format. Thanks for the
detailed description!

Best wishes,
Andrius

-- 
Andrius Merkys
Vilnius University Institute of Biotechnology, Saulėtekio al. 7, room V325
LT-10257 Vilnius, Lithuania



Re: Need help with uscan

2019-04-24 Thread Paul Wise
On Thu, Apr 25, 2019 at 9:00 AM Ben Finney wrote:
> Andrius Merkys writes:
> > I am wondering if it would be possible to write uscan rules to extract
> > the timestamp and download the upstream tarball by analyzing [the HTML
> > of the index page]
>
> I don't know enough about hacking UScan for custom mangling like that.
> AFAIK, the mangling that UScan does is built into the tool, I don't know
> about custom extensions.

uscan now supports arbitrary mangling of the page HTML using the
pagemangle option. This combined with the downloadurlmangle option
could easily accommodate this website.

I think that would be a workaround and the real fix is to talk
upstream into importing their code into a VCS and producing properly
signed and tagged releases (with signed versioned tarballs).

-- 
bye,
pabs

https://wiki.debian.org/PaulWise



Re: Need help with uscan

2019-04-24 Thread Ben Finney
Andrius Merkys  writes:

> I want to package unversioned source. AFAIK, it should be possible to
> have timestamp of the last tarball change in lieu of upstream version.

Yes, that is feasible.

> I am wondering if it would be possible to write uscan rules to extract
> the timestamp and download the upstream tarball by analyzing [the HTML
> of the index page]

I don't know enough about hacking UScan for custom mangling like that.
AFAIK, the mangling that UScan does is built into the tool, I don't know
about custom extensions.

So the only way I know to do this is to write some script that would be
invoked by something other than UScan, for example in a custom Debian
maintainer workflow for this package.

What I would advise for using timestamp as version:

* Allow for some future upstream release to have SemVer-conforming
  version strings (for example, if upstream decides to begin making
  versioned releases). That means: Ensure the fake version strings you
  use will all sort earlier than any future “first release” from
  upstream.

  Practically, this means: Precede your fake version string with “0”.

* Use the special-character rules of Debian package version comparison
  to place the timestamp.

  Practically, this means: Use “+” separator between the “0” prefix and
  the timestamp.

* Format the timestamp so that it works like a version string, that it
  avoids characters reserved for Debian release suffix, and so that
  consecutive values will sort correctly as version strings.

  Practically, this means: Use only “.” to separate components of the
  timestamp.

So, for an upstream source tarball with timestamp “2013-03-12T12:16”,
mangle that to the version string “0+2013.03.12.12.16” (and hence the
first Debian release of that upstream source has the Debian package
version string “0+2013.03.12.12.16-1”).

You can reduce the precision of the timestamp, for example to omit the
time-of-day, “0+2013.03.12”. That will still allow for multiple releases
on one day (just include the timestamp for subsequent releases on that
day) while being easier for a human to understand and still retaining
correct ordering semantics by DPkg.