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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/usr/bin/python
#Checks the aur version and compares it to the /data/dev/linhes_pkgbuild/linhes directory.
import os,sys
import shutil
import urllib.request, urllib.error, urllib.parse
import re
import subprocess
import glob
def getArchVer():
try:
archVer = subprocess.check_output(["package-query", "-A", "-i", "-f %v", "--nocolor", currDirName])
archVer = archVer.strip().decode('utf-8')
return archVer
except:
return "None"
def getLHVer():
pkgfile = currDir + "/PKGBUILD"
if not os.path.isfile(pkgfile):
print(currDirName + " version in LH PKGBUILD is: Unknown")
print(" Can't find",pkgfile)
#sys.exit(2)
else:
LHVer=""
variables=["pkgbase", "pkgname", "pkgver", "pkgrel", "epoch"]
# Loop over contents to get our variables
# Use bash to do it because PKGBUILDs are very loose with their format
for item in variables:
v = subprocess.Popen(['/bin/bash','-c', 'source ' +
pkgfile +
'; echo ${' + item + '[@]}'],
stdout = subprocess.PIPE,)
value = v.communicate()[0].strip(b'\n')
value = value.decode('utf-8')
if item == "pkgbase":
pkgbase = value
elif item == "pkgname":
pkgname = value
pkglist = list(value.split())
elif item == "epoch":
if value:
epoch = "%s:" %value
LHVer=epoch
elif item == "pkgver":
pkgver = value
elif item == "pkgrel":
pkgrel = value
LHVer=LHVer + pkgver + "-" + pkgrel
return LHVer
# print(currDirName + " version in LH PKGBUILD is: " + LHVer)
def main():
global currDirName
global currDir
LHdir="/data/dev/linhes_pkgbuild/linhes/*"
for currDir in glob.glob(LHdir):
if os.path.isdir(currDir):
currDirName = os.path.basename(currDir)
if currDirName == "mythtv":
continue
archVer = getArchVer()
if archVer == "None":
continue
#print("Searching for " + currDirName + " on archlinux.org...")
#print("AUR:",archVer)
LHVer = getLHVer()
#print("LH:",LHVer)
if archVer != LHVer:
print(currDirName,"needs update: [AUR]:",archVer,"[LH]:",LHVer)
if __name__ == "__main__":
print("--------------------------")
main()
print("--------------------------")
|