opkg-compare-versions: Adapted to the latest opkg upstream.

Adapted to the latest opkg upstream implemenation for comparing
versions.

This is part of the bug fixing [YOCTO #2233].

Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
opkg-make-index: don't error out when some package disappears

* If we're building an image and some package rebuilds while this is
  happening some package can be removed/added to the ipk deploy
  directory. The image will not depend on this package so we can
  safely ignore these cases rather than error out.

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg-make-index: convert mtime to int before comparing it

* The st_mtime attribute (which is a float) is compared against a value
  from the timestamp database, which was stored as an integer there.

* When working on a filesystem with precise timestamps the comparision
  will fail nearly everytime hence.

* Although it might be possible to enhance the database to store the
  fractional part too, this will complicate things more than we would
  gain by this change.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg.py: Add knowledge about License field in ipk headers

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
arfile.py: handle six digit UIDs

* Essentially, the problem is that arfile.py is splitting the ar header with
  white-space instead of fixed-width fields, so two fields would get treated
  as a single field.  This makes things better than before as it now honors
  the fixed field widths.

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Use python via the PATH, rather than hardcoding /usr/bin/python

Signed-off-by: Christopher Larson <kergoth@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg.py: use hashlib instead of old md5 module

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg.py, arfile.py: report which file has wrong format and use the same test

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
arfile: decode read lines as ascii string before getting fields from it

* python3 returns them as byte sequence

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2to3: use subprocess instead of commands

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2to3: print fixes

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2to3: dictionary fixes

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2to3: exception handling fixes

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg-make-index: show OSError/IOError

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg.py: use string funtcions directly on string variable

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg.py: catch TypeError when reading control file, to show which one is failing

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
arfile: fix test

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg-make-index: don't use stdout for Packages output and use __str__ instead of __repr__

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg.py: cast lines from controlfile as string

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
opkg.py: computeFileMD5 only when we have fn, otherwise fails to read None file

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>