-
Notifications
You must be signed in to change notification settings - Fork 298
use nvchecker to check new version
nvchecker developed by lilydjwg, is an easy-to-use tool to check if a new version of software has been released. Package Maintainers, I (Stephen Zhang / zsrkmyn) recommend you all use this tool to keep your packages in the repo up to date by finding which of them have new versions available.
- Project Home: https://github.com/lilydjwg/nvchecker
- Project Documentation: https://github.com/lilydjwg/nvchecker/blob/master/README.rst
- Installation: It is available as nvchecker-git in our repo and the AUR. The following optional dependencies are recommended for access to HTTP and other repo types: python-pycurl, mercurial, git.
In the repo, there is a configuration file, nvchecker.ini, listing version sources for repo packages. When using Lilac, nvchecker will be fed version-source information from this file for each package that has a lilac.py
to determine whether it needs to be updated. Although maintained for use with Lilac, nvchecker.ini
can be used when running nvchecker manually as well. You may find it useful, however, to maintain a separate configuration file that only contains version-sorce records for packages you are interested in. Version source files can have any name and are passed to nvchecker on the command line.
###Keep the configuration file in sync with the repo
Each record in the configuration file, nvchecker.ini, contains a package name (in square brackets) with information telling nvchecker how to determine the current version of that package, and is listed under the package maintainer's name. So, every time you add a new package to the repo, you should also add a corresponding record to this configuration file, under your name. If your name is not already in the configuration file, add it, being careful to use the following format: # Your Name <email> {{{1
. Make sure to add the final {{{1
, so that vim will fold configuration records by name. Whether you should remove the configuration record when you remove the package from the repo depends on the complexity of the record.
Most records in nvchecker.ini just have "aur =" as the configuration option under the package name because finding the latest version in the AUR is the default (blank) configuration. Such a simple record should be deleted when you remove the package from the repo. Other repo types can have complicated configuration information though, like URL, regex, shell command, git location and branch, etc. Rather than deleting complicated records, you should just comment them out for possible future use.
For detailed information about the options you can enter in each record of the configuration file, according to repo type, read Version Source Files
If you look at nvchecker.ini, you'll see that it is configured to find the old version info (listing what version of each package is currently in the repo) in a file named old_ver.txt
, and to put the new version info into a file named new_ver.txt
containing the latest versions available for those packages. Both files are expected to be found in the same directory as nvchecker.ini since no path is specified.
-
Generate old_ver.txt Switch to your repo directory cloned from our github repo (
cd ~/repo
, for example), and simply usepacman -Sl archlinuxcn | awk '{print $ 2, $ 3}'> old_ver.txt
to generateold_ver.txt
. Please note that, unfortunately, some version information generated this way will not be in the same format detected by nvchecker. This package, nvchecker-git, is a good example of this issue. Inold_ver.txt
, it's currently listed asnvchecker-git v0.3.r33.g82c85f0-1
but in checking for the version on github, nvchecker just detected the date part and put that innew_ver.txt
asnvchecker-git 20141103
. There's no obvious way to tell if that's a new version or not. -
Generate new_ver.txt with
nvchecker nvchecker.ini
(again from your local copy of our repo directory). -
Generate a list of packages that have newer versions available with
nvcmp nvchecker.ini
. The previously mentioned issue where some version information is not in the same format will be obvious in this listing. For example, nvchecker-git currently shows up in the list of packages that have an update available asnvchecker-git v0.3.r33.g82c85f0-1 -> 20141103
. -
Update old_ver.txt with
nvtake nvchecker.ini <package that you just updated>
. This will copy the version information for that package fromnew_ver.txt
intoold_ver.txt
, so that it won't be listed again if you repeat the previous step to see what packages are left to be updated. Note that I (Stephen Zhang / zsrkmyn) have added bothold_ver.txt
andnew_ver.txt
to our repo.gitignore
so that those files won't be added to our repo. To avoid mistakes, it is recommended to just repeat the first step to regenerateold_ver.txt
after updating a package instead of usingnvtake...
.
The previous section demonstrates how to check all the packages in the repo, but how can you check only those packages that interest you (like, just the ones you built)? Of course, you could manually enter all your packages along with the current version into old_ver.txt
, but if you've got a lot of packages, how can you automatically generate old_ver.txt
so that it only includes your packages? This seems to be the question posed in the original wiki page I (Colin Keenan) have translated above from Chinese (with the help of Google Translate because I don't read or speak Chinese), but it is in a "To Do" section. There are many answers, but most would require that each package maintainer setup some files for that purpose beyond a configuration source-version file.
I have proposed a solution below that seems to be working for me. Anyone reading this who sees pitfalls/bugs/faster methods, please post the better solution. This works by finding all the packages in which you have done a git commit
, and then searches for those packages using pacman -Ss
to get the current version in our repo.
-
cd ~/repo
-
Make sure you have kept the configuration file in sync with the repo. If you've got too much to add by hand, automatically generate your personal source version file
-
Make your own source-version configuration file Just
cp nvchecker.ini ~/my.ini
and edit~/my.ini
removing everybody else's packages. Or, automatically generate your personal source version file. -
Generate old_ver.txt so that it only contains packages you worked on
git whatchanged --author=<name> | grep "^:" | cut -f2 | cut -f1 -d'/' | uniq | xargs -I% pacman -Ss "^%" | grep "^archlinuxcn/" | cut -f2 -d'/' | cut -f1,2 -d' ' | sort | uniq > ~/old_ver.txt
Don't forget to replace<name>
with a part of your name or email. For example, I would use 'colin'. -
cd ~
-
Generate new_ver.txt
nvchecker my.ini
-
Generate a list of packages that have newer versions available with
nvcmp my.ini
. -
Update old_ver.txt with
nvtake my.ini <package that you just updated>
if the first step is too slow to repeat after finishing each update.
###Automatically generate your personal source version file
-
git whatchanged --author=<name> | grep "^:" | cut -f2 | cut -f1 -d'/' | sort | uniq | xargs -I% printf "[%]\naur=\n\n" > ~/my.ini
making sure to replace<name>
with a part of your name or email. -
Copy and paste the following into the top of
~/my.ini
, replacing the general info with your own (like,Colin Keenan <[email protected]>
):[__config__] oldver = old_ver.txt newver = new_ver.txt # Your Name <email> {{{1
-
Copy and paste the following at the end of
~/my.ini
# unused & vim modeline {{{1 # vim: se fdm=marker:
-
Now you can use this file with
nvchecker
or copy the information intonvchecker.ini
to keep it updated.