pmbootstrap/pmb/parse
Oliver Smith 33a09ea1c7
Fix dependency resolver being stuck after reboot (#1359)
When the native arch (e.g. `x86_64`) `APKINDEX` files are outdated, and
`pmbootstrap` gets instructed to build a linux package for a foreign
arch, then the `APKINDEX` cache did not get used anymore for the
current session. This means that every lookup of a package in an
`APKINDEX` caused the whole `APKINDEX` file to get parsed again instead
of using the cached version. This slowed it down so much that it felt
like `pmbootstrap` was looping forever.

How this happens in detail:
* Whenever pmbootstrap parses an `APKINDEX`, it fills up the
  `args.cache["apkindex"]` dict with the parsed information and the
  last modified date of the file.
* `pmbootstrap` checks the last modified date of the `APKINDEX` files
  and updates them if they are older than 4 hours.
* When the bug appeared, then the cache was already filled up, then an
  update happened and then `pmbootstrap` tried to read from the cache.
* So when reading from the `APKINDEX`, the cache gets ignored because
  the last modified date is different.
* Up to this commit, the cache does not get deleted and filled up
  again!

How to test:
Try these commands once without this commit, and then with this commit
applied:
```
$ sudo touch -m -t 201801010000 \
    ~/.local/var/pmbootstrap/cache_apk_x86_64/APKINDEX.*
$ pmbootstrap -v build linux-postmarketos-mainline --arch=armhf
```

Without the patch, you can see in `pmbootstrap log` that it is
resolving the dependencies properly, but very slowly. With the patch
the resolving happens almost instantly.
2018-03-24 16:31:31 +00:00
..
__init__.py Make proprietary drivers optional (1/2): pmbootstrap changes (#1254) 2018-02-24 21:49:10 +00:00
_apkbuild.py aportgen: Gracefully handle old aports_upstream (#1291) 2018-03-11 14:18:21 +00:00
apkindex.py Fix dependency resolver being stuck after reboot (#1359) 2018-03-24 16:31:31 +00:00
arch.py Enable running pmbootstrap on x86 architecture (#1155) 2018-01-24 00:56:11 +00:00
arguments.py pmbootstrap newapkbuild: Properly parse arguments (#1320) 2018-03-15 21:42:34 +00:00
binfmt_info.py Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
bootimg.py Fix building packages by provides name (#1303) 2018-03-08 21:30:55 +00:00
depends.py Index parser: support multiple package providers (#1202) 2018-02-20 19:52:28 +00:00
deviceinfo.py deviceinfo: remove external_disk_install and external_disk, use external_storage instead (#1301) 2018-03-07 22:35:02 +00:00
kconfig.py Check kernel config options based on the architecture (#1233) 2018-02-17 13:37:35 +00:00
version.py version.py: fix validation of 6.0_0002 (#1160) 2018-01-25 18:23:55 +00:00