2022-01-06 00:34:40 +00:00
|
|
|
#!/usr/bin/python
|
2021-12-03 14:49:14 +00:00
|
|
|
|
|
|
|
from datetime import datetime
|
|
|
|
from matplotlib import pyplot as plt
|
|
|
|
|
2022-02-09 16:38:15 +00:00
|
|
|
|
2021-12-03 14:49:14 +00:00
|
|
|
with open('/var/log/pacman.log', 'r') as f:
|
|
|
|
cnt = 0
|
2022-02-09 16:38:15 +00:00
|
|
|
installed = 0
|
|
|
|
removed = 0
|
2021-12-03 14:49:14 +00:00
|
|
|
x = []
|
|
|
|
y = []
|
|
|
|
for line in f.readlines():
|
2022-02-09 16:38:15 +00:00
|
|
|
if '[ALPM]' not in line or 'warning' in line:
|
|
|
|
# Ignore operations
|
2021-12-03 14:49:14 +00:00
|
|
|
continue
|
2022-02-09 04:00:49 +00:00
|
|
|
|
|
|
|
if ' installed' in line:
|
2021-12-03 14:49:14 +00:00
|
|
|
cnt += 1
|
2022-02-09 16:38:15 +00:00
|
|
|
installed += 1
|
2021-12-03 14:49:14 +00:00
|
|
|
elif 'removed' in line:
|
|
|
|
cnt -= 1
|
2022-02-09 16:38:15 +00:00
|
|
|
removed += 1
|
2021-12-03 14:49:14 +00:00
|
|
|
else:
|
|
|
|
continue
|
2022-02-09 04:00:49 +00:00
|
|
|
|
2021-12-03 14:49:14 +00:00
|
|
|
x.append(datetime.fromisoformat(line[1:23] + ':00'))
|
|
|
|
y.append(cnt)
|
|
|
|
|
2022-02-09 16:38:15 +00:00
|
|
|
|
|
|
|
print('Currently installed packages:', cnt)
|
|
|
|
print('Total installed packages:', installed)
|
|
|
|
print('Total removed packages:', removed)
|
|
|
|
plt.plot(x, y)
|
2021-12-03 14:49:14 +00:00
|
|
|
plt.show()
|