--- author: eamanu blogspot: true date: Aug 11, 2018 tags: Old-Blog title: 'Debian/watch: Usando uscan Tool' --- # Debian/watch: Usando uscan Tool El archivo *watch* en el directorio debian de todo paquete debian (que valga la dedundancia) se utiliza para checkear si existen versiones más reciente del software empaquetado y lo descarga si es neceario. Para realizar una descarga necesitamos usar la herramienta uscan que forma parte del paquete devscript. El archivo simplemente te dice: dónde descargar y te permite filtrar para poder obtener siempre la misma versión. Hasta ahora todo bien. Todo sencillo ¿no?. Primer el archivo tienen la siguiente forma:
[Source code](#codesyntax_1 "Click to show/hide code block")[![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png)](#codesyntax_1 "Show code only") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png)](#codesyntax_1 "Print code") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif)](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/About.html "Show plugin information")
```
version=4
http://somesite.com/dir/filename_(.+).tar.gz
```

Lo que hace uscan básicamente es entrar en la dirección web y «filtrar» según el wildcard que le escribamos. Nunca viene mal una mirada al manual. Por ello dejo aquí el [manual](https://manpages.debian.org/stretch/devscripts/uscan.1.en.html) Ok, vamos al grano. Generalmente, (bah), mejor dicho, *yo* casi siempre utilizo softwares que se encuetran almacenados en github o Pypi (que estos a su vez se encuentra en Github también.), por tal motivo voy a dejar un par de ejmplos de como se debería escribir el archivo watch para desgargar software desde Github, como así también de PyPi Github
[Source code](#codesyntax_2 "Click to show/hide code block")[![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png)](#codesyntax_2 "Show code only") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png)](#codesyntax_2 "Print code") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif)](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/About.html "Show plugin information")
```
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/-$1\.tar\.gz/ \
https://github.com///tags .*/v?(\d\S+)\.tar\.gz
```

Pypi - Para Pypi el archivo será muy parecido:
[Source code](#codesyntax_3 "Click to show/hide code block")[![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png)](#codesyntax_3 "Show code only") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png)](#codesyntax_3 "Print code") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif)](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/About.html "Show plugin information")
```
version=4
opts=pgpsigurlmangle=s/$/.asc/ \
https://pypi.debian.net//-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
```

Lo de PyPi es que podemos utilizar la siguiente página para tener el correcto upstrem para descargar: http://pypi.debian.net//watch Vamos a la práctica =================== En mi caso estoy tratano de empaquetar un módulo de python que se llama «[pcapy](https://www.coresecurity.com/corelabs-research/open-source-tools/pcapy)«. Entre los varios update que tengo que realizar, uno de estos es el watch file. Esto se debe a que Lintian me devuelve el siguiente error: > Problems while searching for a new upstream version > > uscan had problems while searching for a new upstream version: > > In debian/watch no matching files for watch line > http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&type=tool&name=Pcapy /index\\.php\\?module=Wiki&action=attachment&type=tool&page=Pcapy&file=pcapy-(\[0-9.\]+)\\.tar\\.gz Por lo visto hay algo que no le gusta a Lintian. Por lo tanto me cloné el proyecto a mi máquina. Una vez realizado esto, le digo a uscan, descarga si tenes alguna versión nueva. Para ello uso el siguiente comando:
[Source code](#codesyntax_4 "Click to show/hide code block")[![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png)](#codesyntax_4 "Show code only") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png)](#codesyntax_4 "Print code") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif)](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/About.html "Show plugin information")
```
uscan -dd -v
```

La opción -dd fuerza a uscan a descargar la versión filtrada. -v es el verbose. Esto me duevuelve lo siguiente:
[Source code](#codesyntax_5 "Click to show/hide code block")[![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png)](#codesyntax_5 "Show code only") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png)](#codesyntax_5 "Print code") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif)](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/About.html "Show plugin information")
Evidentemente hay algo mal en el archivo watch. Para ello, no lo voy a pensar demasiado y voy a usar la página de PyPi. http://pypi.debian.net/pcapy/watch Y el resultado fue: > **502 Bad Gateway** Ok. Voy a ver que me muestra Github: https://github.com/CoreSecurity/pcapy/releases Aquí se puede observar que se encuentran las releases y que está actualizada. Por lo tanto voy a apuntar mi archivo watch a los release de pcapy en Github:
[Source code](#codesyntax_6 "Click to show/hide code block")[![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png)](#codesyntax_6 "Show code only") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png)](#codesyntax_6 "Print code") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif)](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/About.html "Show plugin information")
```
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/pcapy-$1\.tar\.gz/ \
https://github.com/CoreSecurity/pcapy/tags .*/v?(\d\S+)\.tar\.gz
```

Veamos ahora que suecede si ejecuto uscan -dd -v:
[Source code](#codesyntax_7 "Click to show/hide code block")[![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/code.png)](#codesyntax_7 "Show code only") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png)](#codesyntax_7 "Print code") [![](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif)](https://eamanu.com/blog/wp-content/plugins/wp-synhighlight/About.html "Show plugin information")
voilà! Ya tengo descargada la última versión de pcapy. > drwxr-xr-x 6 eamanu eamanu 4096 Aug 10 21:58 pcapy > lrwxrwxrwx 1 eamanu eamanu 19 Aug 10 23:17 pcapy\_0.11.4.orig.tar.gz -> pcapy-0.11.4.tar.gz > -rw-r–r– 1 eamanu eamanu 35623 Aug 10 23:17 pcapy-0.11.4.tar.gz Listo, es todo por hoy. En esta entrada mostré (muy, pero muy brevemente) como se debería trabajar con uscan, para que sirve. Ojalá en el futuro pueda dar un update y profundizar un poco más en esta tool