-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathreinstall-localhost-packages
More file actions
executable file
·41 lines (34 loc) · 1.03 KB
/
reinstall-localhost-packages
File metadata and controls
executable file
·41 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import pisi
def main():
install_db = pisi.db.installdb.InstallDB()
packages = []
# Update index
os.system("pisi ur")
# filter out out-of-repo packages
for package in install_db.list_installed_with_build_host("localhost"):
try:
package_info = pisi.api.info_name(package)
except:
pass
else:
packages.append(package)
if packages:
print "\nThe following packages will be reinstalled:"
print "\n".join(packages)
while True:
try:
print "\nDo you want to continue? (y/n)",
input = raw_input()
if input.startswith("n"):
return 1
elif input.startswith("y"):
os.system("pisi install %s --reinstall -vd" % " ".join(packages))
return 0
except KeyboardInterrupt:
return 1
if __name__ == "__main__":
sys.exit(main())