summaryrefslogtreecommitdiffstats
path: root/build_tools/bin
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2010-11-11 18:22:39 (GMT)
committerJames Meyer <james.meyer@operamail.com>2010-11-11 18:22:39 (GMT)
commitbbe9f180abd551b6ebee978cbbab9adbc5eb70a4 (patch)
treeb6ca15ba01ede12bcb49ca56642ccbde38ebb9c8 /build_tools/bin
parent6eda31e90db020e8e2b8bd7bcd2bef38ec59fc6a (diff)
downloadlinhes_dev-bbe9f180abd551b6ebee978cbbab9adbc5eb70a4.zip
updated checkpackages.py and introduced massupdate_linhes.py.
massupdate will scan /var/abs and tell you which linhes pkg's are outdated when comared against arch src.
Diffstat (limited to 'build_tools/bin')
-rwxr-xr-xbuild_tools/bin/check_repo.sh2
-rwxr-xr-xbuild_tools/bin/check_repo/check_packages.py6
-rw-r--r--build_tools/bin/massupdate_linhes.py170
3 files changed, 174 insertions, 4 deletions
diff --git a/build_tools/bin/check_repo.sh b/build_tools/bin/check_repo.sh
index d8e61fc..9c95d02 100755
--- a/build_tools/bin/check_repo.sh
+++ b/build_tools/bin/check_repo.sh
@@ -2,5 +2,5 @@
cd /build_tools/bin
#extra-testing will do both core and extra -testing
#check_repo/check_packages.py --abs-tree=/data/LinHES-PKGBUILD/abs --repos=extra --repo-dir=/data/pkg_repo/i686
-check_repo/check_packages.py --abs-tree=/data/LinHES-PKGBUILD/abs --repos=extra-testing --repo-dir=/data/pkg_repo/i686
+check_repo/check_packages.py --abs-tree=/data/linhes_pkgbuild/abs --repos=extra --repo-dir=/data/pkg_repo/i686
cd -
diff --git a/build_tools/bin/check_repo/check_packages.py b/build_tools/bin/check_repo/check_packages.py
index 39ac4fb..101e14e 100755
--- a/build_tools/bin/check_repo/check_packages.py
+++ b/build_tools/bin/check_repo/check_packages.py
@@ -114,7 +114,7 @@ def parse_dbs(repos,arch):
dbpkgs = {}
for repo in repos:
pkgs = set([])
- db = tarfile.open(os.path.join(repodir,repo,repo + DBEXT))
+ db = tarfile.open(os.path.join(repodir,repo+"-testing",repo+"-testing" + DBEXT))
for line in db.getnames():
if not '/' in line:
pkgs.add(line.rsplit('-',2)[0])
@@ -406,7 +406,7 @@ for absroot in absroots:
print "Error : the abs tree " + absroot + " does not exist"
sys.exit()
for repo in repos:
- repopath = absroot + "/" + repo
+ repopath = absroot + "/" + repo
if not os.path.isdir(repopath):
print "Error : the repository " + repo + " does not exist in " + absroot
sys.exit()
@@ -415,7 +415,7 @@ if not os.path.isdir(repodir):
sys.exit()
for repo in repos:
#path = os.path.join(repodir,repo,repo + DBEXT)
- path = os.path.join(repodir,repo,repo + DBEXT)
+ path = os.path.join(repodir,repo+"-testing",repo+"-testing" + DBEXT)
if not os.path.isfile(path):
print "Error : repo DB %s : File not found" % path
sys.exit()
diff --git a/build_tools/bin/massupdate_linhes.py b/build_tools/bin/massupdate_linhes.py
new file mode 100644
index 0000000..3202964
--- /dev/null
+++ b/build_tools/bin/massupdate_linhes.py
@@ -0,0 +1,170 @@
+# -*- coding: utf-8 -*-
+import os
+import re
+import commands
+
+def create_pkglist(repodir):
+ group_list={}
+ os.chdir(str(repodir))
+ dir_list = os.listdir(".")
+ for dir in dir_list:
+ if os.path.isdir(dir):
+ #print "found a dir:%s" %dir
+
+ dir_walk = dir
+ for root, dirs, files in os.walk(dir_walk):
+ #print "walking %s,%s" %(root,dirs)
+ for file in [f for f in files]:
+ if file == "PKGBUILD" :
+ topdir="%s/%s" %(repodir, root)
+ if "linhes_pkgbuild" in topdir:
+ if ("core" in topdir) or ("extra" in topdir):
+ pass
+ else:
+ print "%s not LINHES" %topdir
+ print "skipping"
+ continue
+
+ currentfile = topdir + "/PKGBUILD"
+ if os.path.isfile(currentfile):
+ pkgname="unknown"
+ pkgversion="unknown"
+ pkgdescription="unknown"
+ pkggroup=[]
+ try:
+ f= open(currentfile,"r")
+ file_contents= f.readlines()
+ f.close()
+ for line in file_contents:
+ if line.strip().startswith("pkgname"):
+ pkgname=line.partition("=")[2].strip()
+
+ elif line.strip().startswith("pkgver"):
+ pkgversion=line.partition("=")[2]
+
+ elif line.strip().startswith("pkgdesc"):
+ pkgdescription=line.partition("=")[2]
+
+ elif line.strip().startswith("groups"):
+ l=line.partition("=")[2].strip()
+ for c in ['(',')',"'"]:
+ l = l.replace( c, '' )
+ pkggroup=l.split()
+ except:
+ pass
+
+ #temptuple=(pkgname,topdir)
+ #group_list.append(temptuple)
+ group_list[pkgname] = topdir
+ #print repodir
+ #print root
+ #print dirs
+ #print file
+ os.chdir("..")
+ return group_list
+
+def updatepkg(abslocation,linheslocation):
+ print "\n\n"
+ print "%s - > %s " %(abslocation, linheslocation)
+ print "---------------------------------------------------------------"
+ cmd = '''rsync -avchp -delete-after --stats --exclude="src" %s/ %s''' %(abslocation, linheslocation)
+ totalfiles=0
+ global updated
+ global failed
+ global no_update
+ rc,output = commands.getstatusoutput(cmd)
+ # print output
+ for line in output.split("\n"):
+ #print line
+ sline=line.strip()
+ if line.startswith("Number of files transferred"):
+ totalfiles=line.split(":")[1].strip()
+ if rc == 0:
+ #print totalfiles
+ totalfiles = int(totalfiles.strip())
+ if totalfiles >= 1 :
+ # print "total files transferred is more then 0"
+ cmd = "touch %s/.updated" %linheslocation
+ os.system(cmd)
+ updated = updated + 1
+ else:
+ cmd = "touch %s/.no_update" %linheslocation
+ os.system(cmd)
+ no_update = no_update +1
+ else:
+ cmd = "touch %s/.updated_failed" %linheslocation
+ os.system(cmd)
+ failed = failed + 1
+
+ print " updated: %s " %updated
+ print "no_update: %s " %no_update
+ print " failed: %s " %failed
+
+
+
+
+skip_changelist="/tmp/update_list/changelist"
+updatedlist="/tmp/update_list/updatedlist"
+not_in_abs="/tmp/update_list/not_in_abs"
+
+skipfile = open(skip_changelist,"w")
+updatefile = open(updatedlist,"w")
+not_absfile = open(not_in_abs,"w")
+
+
+abslist = create_pkglist("/var/abs")
+linheslist = create_pkglist("/data/linhes_pkgbuild/abs")
+
+global updated
+global failed
+global no_update
+updated=0
+failed=0
+no_update=0
+
+for pkgname, pkglocation in linheslist.iteritems():
+
+ #print pkgname, pkglocation
+ if "mv-core" in pkglocation :
+ continue
+ if "mythtv" in pkglocation :
+ continue
+ if ("core" in pkglocation) or ("extra" in pkglocation):
+ pass
+ else:
+ continue
+
+
+ abslocation = ''
+ try:
+ abslocation = abslist[pkgname]
+ except:
+ # print "pkg is not found in abs %s" %pkgname
+ outline = "%s : %s \n" %(pkgname, pkglocation)
+ not_absfile.write(outline)
+ continue
+
+
+ #print "ABSLOCATION %s" %abslocation
+ #print "LINHES LOCATION %s" %pkglocation
+ changelog = pkglocation + "/__changelog"
+ if os.path.isfile(changelog):
+ # print "%s: pkg has linhes changelog, skipping" %pkgname
+ outline = "%s : %s \n" %(pkgname, pkglocation)
+ skipfile.write(outline)
+ else:
+ #print "%s: updating from ABS" %pkgname
+ outline = "%s : %s | %s \n" %(pkgname, pkglocation, abslocation)
+ updatefile.write(outline)
+# updatepkg(abslocation,pkglocation)
+
+
+
+skipfile.close()
+updatefile.close()
+not_absfile.close()
+
+
+
+
+