euscanwww: fixing merge
Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
94b814481b
commit
f43ab3ae3d
@ -87,61 +87,51 @@ class ScanPortage(object):
|
|||||||
parser = iterparse(output, ["start", "end"])
|
parser = iterparse(output, ["start", "end"])
|
||||||
parser.next() # read root tag just for testing output
|
parser.next() # read root tag just for testing output
|
||||||
except ParseError:
|
except ParseError:
|
||||||
if not query:
|
self.logger.error(
|
||||||
return
|
self.style.ERROR(
|
||||||
if self.purge_packages:
|
"Unknown package '%s'" % query
|
||||||
self.logger.info('- [p] %s' % (query))
|
|
||||||
if '/' in query:
|
|
||||||
cat, pkg = portage.catsplit(query)
|
|
||||||
Package.objects.filter(category=cat, name=pkg).delete()
|
|
||||||
else:
|
|
||||||
Package.objects.filter(name=query).delete()
|
|
||||||
else:
|
|
||||||
self.logger.error(
|
|
||||||
self.style.ERROR(
|
|
||||||
"Unknown package '%s'" % query
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
return
|
)
|
||||||
|
else:
|
||||||
|
cat, pkg, homepage, desc = ("", "", "", "")
|
||||||
|
versions = []
|
||||||
|
packages_alive = set()
|
||||||
|
|
||||||
cat, pkg, homepage, desc = ("", "", "", "")
|
for event, elem in parser:
|
||||||
versions = []
|
if event == "start": # on tag opening
|
||||||
packages_alive = set()
|
if elem.tag == "category":
|
||||||
|
cat = elem.attrib["name"]
|
||||||
|
if elem.tag == "package":
|
||||||
|
pkg = elem.attrib["name"]
|
||||||
|
if elem.tag == "description":
|
||||||
|
desc = elem.text or ""
|
||||||
|
if elem.tag == "homepage":
|
||||||
|
homepage = elem.text or ""
|
||||||
|
if elem.tag == "version":
|
||||||
|
# append version data to versions
|
||||||
|
cpv = "%s/%s-%s" % (cat, pkg, elem.attrib["id"])
|
||||||
|
slot = elem.attrib.get("slot", "")
|
||||||
|
overlay = elem.attrib.get("overlay", "")
|
||||||
|
versions.append((cpv, slot, overlay))
|
||||||
|
|
||||||
for event, elem in parser:
|
elif event == "end": # on tag closing
|
||||||
if event == "start": # on tag opening
|
if elem.tag == "package":
|
||||||
if elem.tag == "category":
|
# package tag has been closed, saving everything!
|
||||||
cat = elem.attrib["name"]
|
with commit_on_success():
|
||||||
if elem.tag == "package":
|
package = self.store_package(cat, pkg, homepage,
|
||||||
pkg = elem.attrib["name"]
|
desc)
|
||||||
if elem.tag == "description":
|
packages_alive.add('%s/%s' % (cat, pkg))
|
||||||
desc = elem.text or ""
|
for cpv, slot, overlay in versions:
|
||||||
if elem.tag == "homepage":
|
self.store_version(package, cpv, slot, overlay)
|
||||||
homepage = elem.text or ""
|
|
||||||
if elem.tag == "version":
|
|
||||||
# append version data to versions
|
|
||||||
cpv = "%s/%s-%s" % (cat, pkg, elem.attrib["id"])
|
|
||||||
slot = elem.attrib.get("slot", "")
|
|
||||||
overlay = elem.attrib.get("overlay", "")
|
|
||||||
versions.append((cpv, slot, overlay))
|
|
||||||
|
|
||||||
elif event == "end": # on tag closing
|
# clean old data
|
||||||
if elem.tag == "package":
|
pkg, homepage, desc = ("", "", "")
|
||||||
# package tag has been closed, saving everything!
|
versions = []
|
||||||
with commit_on_success():
|
|
||||||
package = self.store_package(cat, pkg, homepage, desc)
|
|
||||||
packages_alive.add('%s/%s' % (cat, pkg))
|
|
||||||
for cpv, slot, overlay in versions:
|
|
||||||
self.store_version(package, cpv, slot, overlay)
|
|
||||||
|
|
||||||
# clean old data
|
if elem.tag == "category":
|
||||||
pkg, homepage, desc = ("", "", "")
|
# clean old data
|
||||||
versions = []
|
cat = ""
|
||||||
|
elem.clear()
|
||||||
if elem.tag == "category":
|
|
||||||
# clean old data
|
|
||||||
cat = ""
|
|
||||||
elem.clear()
|
|
||||||
|
|
||||||
if self.purge_packages:
|
if self.purge_packages:
|
||||||
for package in current_packages:
|
for package in current_packages:
|
||||||
@ -271,7 +261,6 @@ class ScanPortage(object):
|
|||||||
Version.objects.filter(packaged=True, alive=False).delete()
|
Version.objects.filter(packaged=True, alive=False).delete()
|
||||||
|
|
||||||
|
|
||||||
@commit_on_success
|
|
||||||
def scan_portage(packages=None, no_log=False, purge_packages=False,
|
def scan_portage(packages=None, no_log=False, purge_packages=False,
|
||||||
purge_versions=False, prefetch=False, logger=None):
|
purge_versions=False, prefetch=False, logger=None):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user