2013-05-26 14:20:14 +00:00
**nvchecker** (short for *new version checker* ) is for checking if a new version of some software has been released.
2015-11-04 11:43:10 +00:00
.. image :: https://travis-ci.org/lilydjwg/nvchecker.svg
2015-11-04 11:36:28 +00:00
:alt: Build Status
2015-11-04 11:43:10 +00:00
:target: https://travis-ci.org/lilydjwg/nvchecker
2015-11-11 06:31:25 +00:00
.. image :: https://badge.fury.io/py/nvchecker.svg
2015-11-11 06:20:49 +00:00
:alt: PyPI version
2017-07-06 08:14:18 +00:00
:target: https://badge.fury.io/py/nvchecker
2015-11-04 11:14:55 +00:00
2015-11-29 14:30:33 +00:00
Contents
========
* `Dependency <#dependency> `_
2018-08-01 08:10:04 +00:00
* `Install and Run <#running> `_
2018-05-09 06:34:32 +00:00
* `JSON logging <#json-logging> `_
2015-11-29 14:30:33 +00:00
* `Version Record Files <#version-record-files> `_
* `The nvtake Command <#the-nvtake-command> `_
* `Version Source Files <#version-source-files> `_
* `Configuration Section <#configuration-section> `_
2017-10-10 17:57:35 +00:00
* `Global Optons <#global-options> `_
2015-11-29 14:30:33 +00:00
* `Search in a Webpage <#search-in-a-webpage> `_
* `Find with a Command <#find-with-a-command> `_
* `Check AUR <#check-aur> `_
* `Check GitHub <#check-github> `_
* `Check BitBucket <#check-bitbucket> `_
* `Check GitLab <#check-gitlab> `_
* `Check PyPI <#check-pypi> `_
* `Check RubyGems <#check-rubygems> `_
* `Check NPM Registry <#check-npm-registry> `_
* `Check Hackage <#check-hackage> `_
* `Check CPAN <#check-cpan> `_
2015-12-03 03:19:58 +00:00
* `Check Packagist <#check-packagist> `_
2015-11-29 14:30:33 +00:00
* `Check Local Pacman Database <#check-local-pacman-database> `_
* `Check Arch Linux official packages <#check-arch-linux-official-packages> `_
2017-07-04 02:47:43 +00:00
* `Check Debian Linux official packages <#check-debian-linux-official-packages> `_
2017-07-06 05:27:24 +00:00
* `Check Ubuntu Linux official packages <#check-ubuntu-linux-official-packages> `_
2017-07-25 07:36:40 +00:00
* `Check Anitya (release-monitoring.org) <#check-anitya> `_
2017-11-04 17:29:12 +00:00
* `Check Android SDK <#check-android-sdk> `_
2015-11-29 14:30:33 +00:00
* `Manually updating <#manually-updating> `_
2015-11-29 14:39:26 +00:00
* `Version Control System (VCS) (git, hg, svn, bzr) <#version-control-system-vcs-git-hg-svn-bzr> `_
2015-11-29 14:30:33 +00:00
* `Other <#other> `_
* `Bugs <#bugs> `_
* `Footnotes <#footnotes> `_
2013-05-26 15:22:21 +00:00
Dependency
==========
2017-07-04 09:04:29 +00:00
- Python 3.5+
2018-04-11 08:45:19 +00:00
- Python library: structlog
- One of these Python library combinations (ordered by preference):
2017-07-08 06:58:46 +00:00
* tornado + pycurl
* aiohttp
* tornado
2013-08-09 10:50:41 +00:00
- All commands used in your version source files
2013-05-26 15:22:21 +00:00
2018-08-01 08:10:04 +00:00
Install and Run
===============
To install::
pip3 install nvchecker
To use the latest code, you can also clone this repository and run::
python3 setup.py install
2013-05-26 15:22:21 +00:00
To see available options::
2018-08-01 08:10:04 +00:00
nvchecker --help
2013-05-26 15:22:21 +00:00
2013-08-09 10:50:41 +00:00
Run with one or more software version source files::
2013-05-26 15:22:21 +00:00
2018-08-01 08:10:04 +00:00
nvchecker source_file
2013-05-26 15:22:21 +00:00
2013-08-09 10:50:41 +00:00
You normally will like to specify some "version record files"; see below.
2013-05-26 15:22:21 +00:00
2018-05-09 06:34:32 +00:00
JSON logging
------------
With `` --logger=json `` or `` --logger=both `` , you can get a structured logging
for programmatically consuming. You can use `` --json-log-fd=N `` to specify the
file descriptor to send logs to (take care to do line buffering). The logging
level option (`` -l `` or `` --logging `` ) doesn't take effect with this.
The JSON log is one JSON string per line. The following documented events and
fields are stable, undocumented ones may change without notice.
event=updated
An update is detected. Fields `` name `` , `` old_version `` and `` version `` are
available. `` old_version `` maybe `` null `` .
event=up-to-date
There is no update. Fields `` name `` and `` version `` are available.
event=no-result
No version is detected. There may be an error. Fields `` name `` is available.
level=error
There is an error. Fields `` name `` and `` exc_info `` may be available to give
further information.
2013-08-09 10:50:41 +00:00
Version Record Files
====================
2017-12-08 07:32:21 +00:00
Version record files record which version of the software you know or is available. They are simple key-value pairs of `` (name, version) `` separated by a space::
2013-05-26 15:22:21 +00:00
2013-11-17 15:43:07 +00:00
fcitx 4.2.7
google-chrome 27.0.1453.93-200836
vim 7.3.1024
2013-05-26 15:22:21 +00:00
2013-12-03 16:34:14 +00:00
Say you've got a version record file called `` old_ver.txt `` which records all your watched software and their versions, as well as some configuration entries. To update it using `` nvchecker `` ::
2013-05-26 15:22:21 +00:00
2018-08-01 08:10:04 +00:00
nvchecker source.ini
2013-05-26 15:22:21 +00:00
2014-01-08 13:25:43 +00:00
See what are updated with `` nvcmp `` ::
2018-08-01 08:10:04 +00:00
nvcmp source.ini
2014-01-08 13:25:43 +00:00
Manually compare the two files for updates (assuming they are sorted alphabetically; files generated by `` nvchecker `` are already sorted)::
2013-05-26 15:22:21 +00:00
comm -13 old_ver.txt new_ver.txt
# or say that in English:
2013-11-17 15:43:07 +00:00
comm -13 old_ver.txt new_ver.txt | awk '{print $1 " has updated to version " $2 "."}'
2013-07-03 10:23:23 +00:00
# show both old and new versions
join old_ver.txt new_ver.txt | awk '$2 != $3'
2013-05-26 15:22:21 +00:00
2013-09-05 08:53:19 +00:00
The `` nvtake `` Command
----------------------
This command helps to manage version record files. It reads both old and new version record files, and a list of names given on the commandline. It then update the versions of those names in the old version record file.
This helps when you have known (and processed) some of the updated software, but not all. You can tell nvchecker that via this command instead of editing the file by hand.
This command will help most if you specify where you version record files are in your config file. See below for how to use a config file.
2013-08-09 10:50:41 +00:00
Version Source Files
====================
The software version source files are in ini format. *Section names* is the name of the software. Following fields are used to tell nvchecker how to determine the current version of that software.
2013-05-26 14:20:14 +00:00
2013-08-09 10:50:41 +00:00
See `` sample_source.ini `` for an example.
2013-05-26 14:20:14 +00:00
2013-12-03 16:34:14 +00:00
Configuration Section
---------------------
2017-12-08 07:32:21 +00:00
A special section named `` __config__ `` is special, it provides some configuration options.
2013-12-03 16:34:14 +00:00
Relative path are relative to the source files, and `` ~ `` and environmental variables are expanded.
Currently supported options are:
oldver
Specify a version record file containing the old version info.
newver
2015-11-07 13:38:35 +00:00
Specify a version record file to store the new version info.
2013-12-03 16:34:14 +00:00
2017-07-06 04:49:36 +00:00
proxy
The HTTP proxy to use. The format is `` host:port `` , e.g. `` localhost:8087 `` .
2017-07-08 07:05:17 +00:00
max_concurrent
Max number of concurrent jobs. Default: 20.
2018-05-05 16:01:27 +00:00
keyfile
Specify an ini config file containing key (token) information. This file should contain a `` keys `` section, mapping key names to key values. See specific source for the key name(s) to use.
2017-10-10 17:50:44 +00:00
Global Options
--------------
2017-10-12 14:46:30 +00:00
The following options apply to all checkers.
2017-10-10 17:50:44 +00:00
prefix
2017-10-12 14:46:30 +00:00
Strip the prefix string if the version string starts with it. Otherwise the
version string is returned as-is.
2017-10-10 17:50:44 +00:00
from_pattern, to_pattern
Both are Python-compatible regular expressions. If `` from_pattern `` is found
2017-10-10 17:58:21 +00:00
in the version string, it will be replaced with `` to_pattern `` .
2017-10-10 17:50:44 +00:00
2018-09-21 04:17:21 +00:00
missing_ok
Suppress warnings and errors if a version checking module finds nothing.
Currently only `` regex `` supports it.
2017-10-12 14:46:30 +00:00
If both `` prefix `` and `` from_pattern `` /`` to_pattern `` are used,
`` from_pattern `` /`` to_pattern `` are ignored. If you want to strip the prefix
and then do something special, just use `` from_pattern ` `` /`` to_pattern `` . For
example, the transformation of `` v1_1_0 `` => `` 1.1.0 `` can be achieved with
`` from_pattern = v(\d+)_(\d+)_(\d+) `` and `` to_pattern = \1.\2.\3 `` .
2013-05-26 14:20:14 +00:00
Search in a Webpage
-------------------
Search through a specific webpage for the version string. This type of version finding has these fields:
url
The URL of the webpage to fetch.
encoding
(*Optional* ) The character encoding of the webpage, if `` latin1 `` is not appropriate.
regex
A regular expression used to find the version string.
It can have zero or one capture group. The capture group or the whole match is the version string.
When multiple version strings are found, the maximum of those is chosen.
2013-07-02 09:50:45 +00:00
proxy
2017-07-04 09:04:29 +00:00
The HTTP proxy to use. The format is `` host:port `` , e.g. `` localhost:8087 `` .
2013-07-02 09:50:45 +00:00
2015-03-14 07:54:26 +00:00
user_agent
The `` User-Agent `` header value to use. Use something more like a tool (e.g. `` curl/7.40.0 `` ) in Europe or the real web page won't get through because cookie policies (SourceForge has this issue).
2016-04-02 14:13:41 +00:00
sort_version_key
Sort the version string using this key function. Choose between `` parse_version `` and
`` vercmp `` . Default value is `` parse_version `` . `` parse_version `` use
`` pkg_resources.parse_version `` . `` vercmp `` use `` pyalpm.vercmp `` .
2013-05-26 14:20:14 +00:00
Find with a Command
-------------------
Use a shell command line to get the version. The output is striped first, so trailing newlines do not bother.
cmd
2013-11-09 13:45:22 +00:00
The command line to use. This will run with the system's standard shell (i.e. `` /bin/sh `` ).
2013-05-26 14:20:14 +00:00
2013-07-01 09:53:12 +00:00
Check AUR
---------
2013-07-01 10:00:58 +00:00
Check `Arch User Repository <https://aur.archlinux.org/> `_ for updates.
2013-07-01 09:53:12 +00:00
aur
The package name in AUR. If empty, use the name of software (the *section name* ).
2015-08-24 16:18:19 +00:00
strip-release
Strip the release part.
2013-07-01 09:53:12 +00:00
Check GitHub
------------
2013-07-01 10:00:58 +00:00
Check `GitHub <https://github.com/> `_ for updates. The version returned is in date format `` %Y%m%d `` , e.g. `` 20130701 `` .
2013-07-01 09:53:12 +00:00
github
2013-07-01 10:00:15 +00:00
The github repository, with author, e.g. `` lilydjwg/nvchecker `` .
2013-07-01 09:53:12 +00:00
2014-09-14 08:23:36 +00:00
branch
Which branch to track? Default: `` master `` .
2015-11-04 12:10:13 +00:00
use_latest_release
2015-11-05 03:25:57 +00:00
Set this to `` true `` to check for the latest release on GitHub. An annotated
2015-11-04 12:10:13 +00:00
tag creates a "release" on GitHub. It's not the same with git tags, which
includes both annotated tags and lightweight ones.
2015-11-05 03:25:57 +00:00
use_max_tag
Set this to `` true `` to check for the max tag on GitHub. Unlike `` use_latest_release `` ,
this option includes both annotated tags and lightweight ones, and return the biggest one
sorted by `` pkg_resources.parse_version `` .
2018-05-04 03:01:23 +00:00
include_tags_pattern
Only include tags matching this pattern. This option must be used together
with `` use_max_tag `` .
2015-12-23 13:02:06 +00:00
ignored_tags
2015-12-23 13:59:53 +00:00
Ignore certain tags while computing the max tag. Tags are separate by
whitespaces. This option must be used together with `` use_max_tag `` . This can
be useful to avoid some known badly versioned tags, so the newer tags won't
be "overridden" by the old broken ones.
2015-12-23 13:02:06 +00:00
2016-04-02 14:13:41 +00:00
sort_version_key
Sort the version string using this key function. Choose between `` parse_version `` and
`` vercmp `` . Default value is `` parse_version `` . `` parse_version `` use
`` pkg_resources.parse_version `` . `` vercmp `` use `` pyalpm.vercmp `` .
2017-02-09 12:48:38 +00:00
proxy
2017-07-04 09:04:29 +00:00
The HTTP proxy to use. The format is `` host:port `` , e.g. `` localhost:8087 `` .
2017-02-09 12:48:38 +00:00
2018-05-05 16:01:27 +00:00
An environment variable `` NVCHECKER_GITHUB_TOKEN `` or a key named `` github ``
can be set to a GitHub OAuth token in order to request more frequently than
anonymously.
2015-11-04 12:13:32 +00:00
2015-08-04 08:12:46 +00:00
Check BitBucket
---------------
2018-05-04 03:01:23 +00:00
Check `BitBucket <https://bitbucket.org/> `_ for updates. The version returned
is in date format `` %Y%m%d `` , e.g. `` 20130701 `` .
2015-08-04 08:12:46 +00:00
bitbucket
The bitbucket repository, with author, e.g. `` lilydjwg/dotvim `` .
branch
Which branch to track? Default is the repository's default.
2015-11-05 04:12:03 +00:00
use_max_tag
Set this to `` true `` to check for the max tag on BitBucket. Will return the biggest one
sorted by `` pkg_resources.parse_version `` .
2015-12-23 13:02:06 +00:00
ignored_tags
2015-12-23 13:59:53 +00:00
Ignore certain tags while computing the max tag. Tags are separate by
whitespaces. This option must be used together with `` use_max_tag `` . This can
be useful to avoid some known badly versioned tags, so the newer tags won't
be "overridden" by the old broken ones.
2015-12-23 13:02:06 +00:00
2016-04-02 14:13:41 +00:00
sort_version_key
Sort the version string using this key function. Choose between `` parse_version `` and
`` vercmp `` . Default value is `` parse_version `` . `` parse_version `` use
`` pkg_resources.parse_version `` . `` vercmp `` use `` pyalpm.vercmp `` .
2015-11-05 07:31:56 +00:00
Check GitLab
-------------
Check `GitLab <https://gitlab.com/> `_ for updates. The version returned is in date format `` %Y%m%d `` , e.g. `` 20130701 `` .
gitlab
The gitlab repository, with author, e.g. `` Deepin/deepin-music `` .
branch
Which branch to track? Default: `` master `` .
use_max_tag
Set this to `` true `` to check for the max tag on BitBucket. Will return the biggest one
sorted by `` pkg_resources.parse_version `` .
2015-12-23 13:02:06 +00:00
ignored_tags
2015-12-23 13:59:53 +00:00
Ignore certain tags while computing the max tag. Tags are separate by
whitespaces. This option must be used together with `` use_max_tag `` . This can
be useful to avoid some known badly versioned tags, so the newer tags won't
be "overridden" by the old broken ones.
2015-12-23 13:02:06 +00:00
2016-04-02 14:13:41 +00:00
sort_version_key
Sort the version string using this key function. Choose between `` parse_version `` and
`` vercmp `` . Default value is `` parse_version `` . `` parse_version `` use
`` pkg_resources.parse_version `` . `` vercmp `` use `` pyalpm.vercmp `` .
2015-11-05 07:31:56 +00:00
host
Hostname for self-hosted GitLab instance.
2015-11-05 14:53:22 +00:00
token
2018-05-05 16:01:27 +00:00
GitLab authorization token used to call the API.
2015-11-05 07:31:56 +00:00
Authenticated only.
2018-05-05 16:01:27 +00:00
To set a authorization token, you can set:
- a key named `` gitlab_{host} `` in the keyfile (where `` host `` is formed the
same as the environment variable, but all lowercased).
- an environment variable `` NVCHECKER_GITLAB_TOKEN_{host} `` must provide that
token. The `` host `` part is the uppercased version of the `` host `` setting,
with dots (`` . `` ) and slashes (`` / `` ) replaced by underscores (`` _ `` ), e.g.
`` NVCHECKER_GITLAB_TOKEN_GITLAB_COM `` .
- the token option
2013-09-08 07:11:23 +00:00
Check PyPI
----------
Check `PyPI <https://pypi.python.org/> `_ for updates.
pypi
The name used on PyPI, e.g. `` PySide `` .
2014-09-29 08:38:44 +00:00
Check RubyGems
--------------
Check `RubyGems <https://rubygems.org/> `_ for updates.
gems
The name used on RubyGems, e.g. `` sass `` .
2015-11-04 09:32:52 +00:00
Check NPM Registry
2015-11-04 11:36:28 +00:00
------------------
2015-11-04 09:32:52 +00:00
Check `NPM Registry <https://registry.npmjs.org/> `_ for updates.
npm
The name used on NPM Registry, e.g. `` coffee-script `` .
2015-11-04 10:01:47 +00:00
Check Hackage
2015-11-04 11:36:28 +00:00
-------------
2015-11-04 10:01:47 +00:00
Check `Hackage <https://hackage.haskell.org/> `_ for updates.
hackage
The name used on Hackage, e.g. `` pandoc `` .
2015-11-04 10:15:40 +00:00
Check CPAN
--------------
Check `MetaCPAN <https://metacpan.org/> `_ for updates.
cpan
The name used on CPAN, e.g. `` YAML `` .
2017-02-09 12:48:38 +00:00
proxy
2017-07-04 09:04:29 +00:00
The HTTP proxy to use. The format is `` host:port `` , e.g. `` localhost:8087 `` .
2017-02-09 12:48:38 +00:00
2015-12-03 03:19:58 +00:00
Check Packagist
2015-12-23 14:00:07 +00:00
---------------
2015-12-03 03:19:58 +00:00
Check `Packagist <https://packagist.org/> `_ for updates.
packagist
The name used on Packagist, e.g. `` monolog/monolog `` .
2013-11-02 16:21:46 +00:00
Check Local Pacman Database
---------------------------
2014-11-03 14:08:26 +00:00
This is used when you run `` nvchecker `` on an Arch Linux system and the program always keeps up with a package in your configured repositories for `Pacman`_ .
2013-11-02 16:21:46 +00:00
pacman
The package name to reference to.
2015-08-24 16:18:19 +00:00
strip-release
Strip the release part.
2014-09-14 08:28:38 +00:00
Check Arch Linux official packages
----------------------------------
This enables you to track the update of `Arch Linux official packages <https://www.archlinux.org/packages/> `_ , without needing of pacman and an updated local Pacman databases.
archpkg
Name of the Arch Linux package.
2015-08-24 16:18:19 +00:00
strip-release
Strip the release part.
2017-07-03 17:14:35 +00:00
Check Debian Linux official packages
----------------------------------
This enables you to track the update of `Debian Linux official packages <https://packages.debian.org> `_ , without needing of apt and an updated local APT database.
debianpkg
Name of the Debian Linux source package.
suite
Name of the Debian release (jessie, wheezy, etc, defaults to sid)
strip-release
Strip the release part.
2017-07-06 05:27:24 +00:00
Check Ubuntu Linux official packages
2017-07-25 07:36:40 +00:00
------------------------------------
2017-07-06 05:27:24 +00:00
This enables you to track the update of `Ubuntu Linux official packages <https://packages.ubuntu.com/> `_ , without needing of apt and an updated local APT database.
ubuntupkg
Name of the Ubuntu Linux source package.
suite
Name of the Ubuntu release (xenial, zesty, etc, defaults to None, which means no limit on suite)
strip-release
Strip the release part.
2017-07-25 07:36:40 +00:00
Check Anitya
------------
This enables you to track updates from `Anitya <https://release-monitoring.org/> `_ (release-monitoring.org).
anitya
`` distro/package `` , where `` distro `` can be a lot of things like "fedora", "arch linux", "gentoo", etc. `` package `` is the package name of the chosen distribution.
2017-11-04 17:29:12 +00:00
Check Android SDK
-----------------
This enables you to track updates of Android SDK packages listed in `` sdkmanager --list `` .
android_sdk
2018-01-14 16:47:16 +00:00
The package path prefix. This value is matched against the `` path `` attribute in all <remotePackage> nodes in an SDK manifest XML. The first match is used for version comparisons.
2017-11-04 17:29:12 +00:00
repo
Should be one of `` addon `` or `` package `` . Packages in `` addon2-1.xml `` use `` addon `` and packages in `` repository2-1.xml `` use `` package `` .
2014-09-14 08:28:38 +00:00
Manually updating
-----------------
This enables you to manually specify the version (maybe because you want to approve each release before it gets to the script).
manual
The version string.
2014-11-03 12:39:56 +00:00
Version Control System (VCS) (git, hg, svn, bzr)
------------------------------------------------
2014-11-03 14:08:26 +00:00
Check a VCS repo for new commits. The version returned is currently not related to the version of the software and will increase whenever the referred VCS branch changes. This is mainly for Arch Linux.
2014-11-03 12:39:56 +00:00
vcs
2014-11-03 14:08:26 +00:00
The url of the remote VCS repo, using the same syntax with a VCS url in PKGBUILD (`Pacman`_ 's build script). The first VCS url found in the source array of the PKGBUILD will be used if this is left blank. (Note: for a blank `` vcs `` setting to work correctly, the PKGBUILD has to be in a directory with the name of the software under the path where nvchecker is run. Also, all the commands, if any, needed when sourcing the PKGBUILD need to be installed).
2014-11-03 12:39:56 +00:00
2015-12-29 04:15:19 +00:00
use_max_tag
Set this to `` true `` to check for the max tag. Currently only supported for `` git `` .
This option returns the biggest tag sorted by `` pkg_resources.parse_version `` .
ignored_tags
Ignore certain tags while computing the max tag. Tags are separate by
whitespaces. This option must be used together with `` use_max_tag `` . This can
be useful to avoid some known badly versioned tags, so the newer tags won't
be "overridden" by the old broken ones.
2013-05-26 14:20:14 +00:00
Other
-----
More to come. Send me a patch or pull request if you can't wait and have written one yourself :-)
2013-07-02 09:24:33 +00:00
Bugs
2013-09-05 08:27:44 +00:00
====
2013-07-02 09:24:33 +00:00
* Finish writing results even on Ctrl-C or other interruption.
2013-09-05 08:27:44 +00:00
2013-11-17 15:43:07 +00:00
Footnotes
=========
2014-11-03 14:08:26 +00:00
.. _Pacman: https://wiki.archlinux.org/index.php/Pacman