public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-17 17:05 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-17 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     a85343a66d9657b6cfde5e7fa8caf977b99b6be0
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Wed Jul 17 17:05:12 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Wed Jul 17 17:05:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=a85343a6

gs_ctan/ctan_db: fetch and load data

---
 gs_ctan/ctan_db.py | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 0014c6c..f055823 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -23,14 +23,13 @@ class CtanDB(PackageDB):
     def __init__(self, directory, repo_uri="", db_uri=""):
         super(CtanDB, self).__init__(directory, repo_uri, db_uri)
 
-    def generate_tree(self):
-        tempdir = TemporaryDirectory()
-
-        print(self.repo_uri)
-        tlpdb_uri = self.repo_uri + '/tlpkg/texlive.tlpdb.xz'
-        if wget(tlpdb_uri, tempdir.name):
-            raise SyncError('sync failed: ' + self.repo_uri)
-
-        del tempdir
-
-        print("works")
+    def get_download_uries(self):
+        tlpdb_uri = self.repo_uri + "/tlpkg/texlive.tlpdb.xz"
+        return [tlpdb_uri]
+        
+    def load_data(self, data_f):
+        data = data_f.read()
+        return data
+
+    def parse_data(self, data):
+        print(data)


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-17 23:19 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-17 23:19 UTC (permalink / raw
  To: gentoo-commits

commit:     f992111f9c194ded1401744745dc8708a50cfd23
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Wed Jul 17 23:19:36 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Wed Jul 17 23:19:36 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=f992111f

gs_ctan/ctan_db: parse_data implemented

---
 gs_ctan/ctan_db.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 5 deletions(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 65ff4ba..adb6544 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -11,12 +11,10 @@
     :license: GPL-2, see LICENSE for more details.
 """
 
+import itertools
 import os
 
-from g_sorcery.compatibility import TemporaryDirectory
-from g_sorcery.g_collections import Package
 from g_sorcery.package_db import PackageDB
-from g_sorcery.fileutils import wget
 from g_sorcery.exceptions import SyncError
 
 class CtanDB(PackageDB):
@@ -29,7 +27,51 @@ class CtanDB(PackageDB):
         
     def parse_data(self, data_f):
         data = data_f.read()
-        return data
+        
+        data = data.split("\n")
+        
+        #entries are separated by new lines
+        data = \
+        [list(group) for key, group in itertools.groupby(data, bool) if key]
+
+        #we need only Package entries
+        data = \
+        [entry for entry in data if entry[1] == "category Package"]
+
+        result = []
+
+        KEY = 0
+        VALUE = 1
+        FILES_LENGTH = len("files")
+        
+        for entry in data:
+            res_entry = {}
+            previous_key = ""
+            current_key = ""
+            for line in entry:
+                line = line.split(" ")
+                if line[KEY][-FILES_LENGTH:] == "files":
+                    current_key = line[KEY]
+                    res_entry[current_key] = {}
+                    for value in line[VALUE:]:
+                        key, val = value.split("=")
+                        res_entry[current_key][key] = val
+                    res_entry[current_key]["files"] = []
+                elif not line[KEY]:
+                    res_entry[current_key]["files"].append(" ".join(line[VALUE:]))
+                else:
+                    if previous_key == line[KEY]:
+                        res_entry[previous_key] += " " + " ".join(line[VALUE:])
+                    else:
+                        res_entry[line[KEY]] = " ".join(line[VALUE:])
+                        previous_key = line[KEY]
+                        current_key = ""
+            result.append(res_entry)
+        
+        return result
 
     def process_data(self, data):
-        print(data)
+        for entry in data["texlive.tlpdb"]:
+            for key, value in entry.items():
+                print(key + ": " + str(value))
+            print


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-18  0:12 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-18  0:12 UTC (permalink / raw
  To: gentoo-commits

commit:     ec162079db8533c7988b0b8a6bbbe8de29cf8426
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Thu Jul 18 00:11:32 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Thu Jul 18 00:11:32 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=ec162079

gs_ctan/ctan_db: parse_data, dependency parsing

---
 gs_ctan/ctan_db.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index adb6544..47d7160 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -59,6 +59,11 @@ class CtanDB(PackageDB):
                     res_entry[current_key]["files"] = []
                 elif not line[KEY]:
                     res_entry[current_key]["files"].append(" ".join(line[VALUE:]))
+                elif line[KEY] == "depend":
+                    if "depend" in res_entry:
+                        res_entry["depend"].append(" ".join(line[VALUE:]))
+                    else:
+                        res_entry["depend"] = [" ".join(line[VALUE:])]
                 else:
                     if previous_key == line[KEY]:
                         res_entry[previous_key] += " " + " ".join(line[VALUE:])


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-18  0:12 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-18  0:12 UTC (permalink / raw
  To: gentoo-commits

commit:     72e80df4afd6561b240f076471790bfdeda6df62
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Thu Jul 18 00:12:14 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Thu Jul 18 00:12:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=72e80df4

gs_ctan/ctan_db: process_data, some progress ;-)

---
 gs_ctan/ctan_db.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 47d7160..a85488e 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -76,7 +76,54 @@ class CtanDB(PackageDB):
         return result
 
     def process_data(self, data):
+
+        self.add_category('dev-tex')
+
         for entry in data["texlive.tlpdb"]:
-            for key, value in entry.items():
-                print(key + ": " + str(value))
+
+            realname = entry["name"]
+            
+            #todo: work on common data vars processing: external deps, filtering etc.
+            #at the moment just copy necessary code from elpa_db.py
+            allowed_ords = set(range(ord('a'), ord('z'))) | set(range(ord('A'), ord('Z'))) | \
+              set(range(ord('0'), ord('9'))) | set(list(map(ord,
+                    ['+', '_', '-', ' ', '.', '(', ')', '[', ']', '{', '}', ','])))
+
+            if "shortdesc" in entry:                
+                description = entry["shortdesc"]
+            else:
+                description = entry["name"]
+            description = "".join([x for x in description if ord(x) in allowed_ords])
+
+            if "longdesc" in entry:
+                longdescription = entry["longdesc"]
+                longdescription = "".join([x for x in longdescription if ord(x) in allowed_ords])
+            else:
+                longdescription = description
+
+            if "catalogue-version" in entry:
+                version = entry["catalogue-version"]
+            else:
+                version = entry["revision"]
+
+            #todo: convert to gentoo licenses
+            if "catalogue-license" in entry:
+                license = entry["catalogue-license"]
+            else:
+                license = "unknown"
+
+            if "catalogue-ctan" in entry:
+                source_type = "zip"
+                base_src_uri = "http://www.ctan.org/tex-archive"
+                catalogue = entry["catalogue-ctan"]
+            else:
+                source_type = "tar.xz"
+                base_src_uri = "http://mirror.ctan.org/systems/texlive/tlnet/archive"
+                catalogue = ""
+
+            print("dev-tex/" + realname + "-" + version)
+            print("    license: " + license)
+            print("    " + description)
+            print
+            print("    " + longdescription)
             print


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-18 22:29 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-18 22:29 UTC (permalink / raw
  To: gentoo-commits

commit:     01ba09173a010a2ac8d9b7f0a2d165ad3319b4e1
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Thu Jul 18 22:29:07 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Thu Jul 18 22:29:07 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=01ba0917

gs_ctan/ctan_db: generation of ebuild data implemented

---
 gs_ctan/ctan_db.py | 94 ++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 85 insertions(+), 9 deletions(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index a85488e..99c16c6 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -13,13 +13,30 @@
 
 import itertools
 import os
+import re
+import sys
 
+import portage
+
+from g_sorcery.g_collections import Dependency, Package, serializable_elist
+from g_sorcery.logger import Logger
 from g_sorcery.package_db import PackageDB
 from g_sorcery.exceptions import SyncError
 
 class CtanDB(PackageDB):
     def __init__(self, directory, repo_uri="", db_uri=""):
         super(CtanDB, self).__init__(directory, repo_uri, db_uri)
+        
+        logger = Logger()
+        gentoo_arch = portage.settings['ARCH']
+        self.arch = ""
+        if gentoo_arch == "x86":
+            self.arch = "i386-linux"
+        elif gentoo_arch == "amd64":
+            self.arch = "x86_64-linux"
+        else:
+            logger.warning("not supported arch: " + gentoo_arch)
+
 
     def get_download_uries(self):
         tlpdb_uri = self.repo_uri + "/tlpkg/texlive.tlpdb.xz"
@@ -44,7 +61,7 @@ class CtanDB(PackageDB):
         VALUE = 1
         FILES_LENGTH = len("files")
         
-        for entry in data:
+        for entry in data:     
             res_entry = {}
             previous_key = ""
             current_key = ""
@@ -71,16 +88,30 @@ class CtanDB(PackageDB):
                         res_entry[line[KEY]] = " ".join(line[VALUE:])
                         previous_key = line[KEY]
                         current_key = ""
+
+            parts = res_entry["name"].split(".")
+            if len(parts) > 1:
+                if parts[1] != self.arch:
+                    continue
+
             result.append(res_entry)
         
         return result
 
     def process_data(self, data):
+        
+        category = "dev-tex"
+        
+        self.add_category(category)
+
+        ARCH_LENGTH = len("ARCH")
 
-        self.add_category('dev-tex')
+        data = data["texlive.tlpdb"]
 
-        for entry in data["texlive.tlpdb"]:
+        self.number_of_packages = len(data)
+        self.written_number = 0
 
+        for entry in data:
             realname = entry["name"]
             
             #todo: work on common data vars processing: external deps, filtering etc.
@@ -103,6 +134,10 @@ class CtanDB(PackageDB):
 
             if "catalogue-version" in entry:
                 version = entry["catalogue-version"]
+                #todo better version checking and processing
+                match_object = re.match("^[0-9\.]+[a-z]?$", version)
+                if not match_object:
+                    version = entry["revision"]
             else:
                 version = entry["revision"]
 
@@ -121,9 +156,50 @@ class CtanDB(PackageDB):
                 base_src_uri = "http://mirror.ctan.org/systems/texlive/tlnet/archive"
                 catalogue = ""
 
-            print("dev-tex/" + realname + "-" + version)
-            print("    license: " + license)
-            print("    " + description)
-            print
-            print("    " + longdescription)
-            print
+            dependencies = serializable_elist(separator="\n\t")
+
+            if "depend" in entry:
+                for dependency in entry["depend"]:
+                    if dependency[-ARCH_LENGTH:] == "ARCH":
+                        dependency = dependency[:-ARCH_LENGTH] + self.arch
+                    dependencies.append(Dependency(category, dependency))
+
+            ebuild_data = {"realname" : realname,
+                           "description" : description,
+                           "homepage" : "http://tug.org/texlive/",
+                           "license" : license,
+                           "source_type" : source_type,
+                           "base_src_uri" : base_src_uri,
+                           "catalogue" : catalogue,
+                           "dependencies" : dependencies,
+                           "depend" : dependencies,
+                           "rdepend" : dependencies,
+            #eclass entry
+            #'eclasses' : ['gs-ctan'],
+            #metadata entries
+                          'maintainer' : [{'email' : 'piatlicki@gmail.com',
+                                           'name' : 'Jauhien Piatlicki'}],
+                          'longdescription' : longdescription
+                          }
+
+            self.add_package(Package(category, realname, version), ebuild_data)
+
+        logger = Logger()
+        logger.info("writing database")
+
+    def additional_write_version(self, category, package, version):
+        chars = ['-','\\','|','/']
+        show = chars[self.written_number % 4]
+        percent = (self.written_number * 100)/self.number_of_packages
+        length = 20
+        progress = (percent * 20)/100
+        blank = 20 - progress
+        
+        sys.stdout.write("\r %s [%s%s] %s%%" % (show, "#" * progress, " " * blank, percent))
+        sys.stdout.flush()
+        self.written_number += 1
+
+    def additional_write_category(self, category):
+        sys.stdout.write("\r %s [%s] %s%%" % ("-", "#" * 20, 100))
+        sys.stdout.flush()
+        print("")


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-19  8:36 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-19  8:36 UTC (permalink / raw
  To: gentoo-commits

commit:     48b49d40155690736428eb38d008d6de6961383a
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Fri Jul 19 08:36:24 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Fri Jul 19 08:36:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=48b49d40

gs_ctan/ctan_db: CtanDB.additional_write_version, division fix for py3k

---
 gs_ctan/ctan_db.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 99c16c6..7d38385 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -190,9 +190,9 @@ class CtanDB(PackageDB):
     def additional_write_version(self, category, package, version):
         chars = ['-','\\','|','/']
         show = chars[self.written_number % 4]
-        percent = (self.written_number * 100)/self.number_of_packages
+        percent = (self.written_number * 100)//self.number_of_packages
         length = 20
-        progress = (percent * 20)/100
+        progress = (percent * 20)//100
         blank = 20 - progress
         
         sys.stdout.write("\r %s [%s%s] %s%%" % (show, "#" * progress, " " * blank, percent))


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-19 11:10 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-19 11:10 UTC (permalink / raw
  To: gentoo-commits

commit:     31803028cc86bfd54dbdc5d7162bba3187b5616b
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Fri Jul 19 08:52:38 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Fri Jul 19 08:52:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=31803028

gs_ctan/ebuild: ebuild generator for user side overlays

---
 gs_ctan/backend.py |  3 ++-
 gs_ctan/ebuild.py  | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/gs_ctan/backend.py b/gs_ctan/backend.py
index a9d0581..fe1f7a3 100644
--- a/gs_ctan/backend.py
+++ b/gs_ctan/backend.py
@@ -20,6 +20,7 @@ from g_sorcery.eclass import EclassGenerator
 from g_sorcery.fileutils import get_pkgpath
 
 from .ctan_db import CtanDB
+from .ebuild import CtanEbuildWithoutDigestGenerator
 
 
 class CtanEclassGenerator(EclassGenerator):
@@ -28,5 +29,5 @@ class CtanEclassGenerator(EclassGenerator):
         
 
 instance = Backend(CtanDB,
-                   EbuildGenerator, EbuildGenerator,
+                   EbuildGenerator, CtanEbuildWithoutDigestGenerator,
                    CtanEclassGenerator, MetadataGenerator, sync_db=False)

diff --git a/gs_ctan/ebuild.py b/gs_ctan/ebuild.py
new file mode 100644
index 0000000..151a61f
--- /dev/null
+++ b/gs_ctan/ebuild.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+    ebuild.py
+    ~~~~~~~~~
+    
+    ebuild generation
+    
+    :copyright: (c) 2013 by Jauhien Piatlicki
+    :license: GPL-2, see LICENSE for more details.
+"""
+
+import collections
+import os
+
+from g_sorcery.ebuild import DefaultEbuildGenerator
+
+Layout = collections.namedtuple("Layout",
+    ["vars_before_inherit", "inherit", "vars_after_description", "vars_after_keywords"])
+  
+
+class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator):
+    def __init__(self, package_db):
+
+        vars_before_inherit = \
+          ["base_src_uri", "catalogue", "source_type", "realname"]
+
+        inherit = ["gs-ctan"]
+        
+        vars_after_description = \
+          ["homepage", "license"]
+
+        vars_after_keywords = \
+          ["depend", "rdepend"]
+
+        layout = Layout(vars_before_inherit, inherit, vars_after_description, vars_after_keywords)
+
+        super(CtanEbuildWithoutDigestGenerator, self).__init__(package_db, layout)


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-19 11:23 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-19 11:23 UTC (permalink / raw
  To: gentoo-commits

commit:     0f405aa40f4bb6b7c2811d476c80a84f5d991975
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Fri Jul 19 11:22:55 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Fri Jul 19 11:22:55 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=0f405aa4

gs_ctan/ctan_db: homepage

---
 gs_ctan/ctan_db.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 034f98d..1623375 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -150,11 +150,14 @@ class CtanDB(PackageDB):
             if "catalogue-ctan" in entry:
                 source_type = "zip"
                 base_src_uri = "ftp://tug.ctan.org/pub/tex-archive"
-                catalogue = entry["catalogue-ctan"][:-len(realname)]
+                catalogue = entry["catalogue-ctan"]
+                homepage = "http://www.ctan.org/tex-archive" + catalogue
+                catalogue = catalogue[:-len(realname)]
             else:
                 source_type = "tar.xz"
                 base_src_uri = "http://mirror.ctan.org/systems/texlive/tlnet/archive/"
                 catalogue = ""
+                homepage = "http://www.ctan.org/tex-archive/systems/texlive/tlnet"
 
             dependencies = serializable_elist(separator="\n\t")
 
@@ -166,7 +169,7 @@ class CtanDB(PackageDB):
 
             ebuild_data = {"realname" : realname,
                            "description" : description,
-                           "homepage" : "http://tug.org/texlive/",
+                           "homepage" : homepage,
                            "license" : license,
                            "source_type" : source_type,
                            "base_src_uri" : base_src_uri,


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-19 16:56 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-19 16:56 UTC (permalink / raw
  To: gentoo-commits

commit:     302229eb110ae80f1b485f5fb8053890d8896060
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Fri Jul 19 16:55:46 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Fri Jul 19 16:55:46 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=302229eb

gs_ctan/ctan_db: fix binary packages names

---
 gs_ctan/ctan_db.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index c0f91a9..f46c5e3 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -113,6 +113,10 @@ class CtanDB(PackageDB):
 
         for entry in data:
             realname = entry["name"]
+
+            parts = realname.split(".")
+            if len(parts) > 1:
+                realname = "_".join(parts)
             
             #todo: work on common data vars processing: external deps, filtering etc.
             #at the moment just copy necessary code from elpa_db.py
@@ -163,7 +167,7 @@ class CtanDB(PackageDB):
             if "depend" in entry:
                 for dependency in entry["depend"]:
                     if dependency[-ARCH_LENGTH:] == "ARCH":
-                        dependency = dependency[:-ARCH_LENGTH] + self.arch
+                        dependency = dependency[:-ARCH_LENGTH-1] + "_" + self.arch
                     dependencies.append(Dependency(category, dependency))
 
             ebuild_data = {"realname" : realname,


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-22 16:57 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-22 16:57 UTC (permalink / raw
  To: gentoo-commits

commit:     5f45cf6e5713806562709d53a31b086c3a28c5b2
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Mon Jul 22 16:56:53 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Mon Jul 22 16:56:53 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=5f45cf6e

CTAN backend: at the moment work only with source packages

---
 gs_ctan/ctan_db.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 0a60744..0c52395 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -153,6 +153,7 @@ class CtanDBGenerator(DBGenerator):
                 homepage = "http://www.ctan.org/tex-archive" + catalogue
                 catalogue = catalogue[:-len(realname)]
             else:
+                continue #todo: work with tlpkg packages
                 source_type = "tar.xz"
                 base_src_uri = "http://mirror.ctan.org/systems/texlive/tlnet/archive/"
                 catalogue = ""


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-07-31 23:29 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-07-31 23:29 UTC (permalink / raw
  To: gentoo-commits

commit:     7c2756f615bc744c135db0911a98157ee051e21f
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Wed Jul 31 23:10:09 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Wed Jul 31 23:10:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=7c2756f6

gs_ctan/ctan_db fixed, so it generates correct realname for binary packages

---
 gs_ctan/ctan_db.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 1139304..39195e8 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -110,11 +110,12 @@ class CtanDBGenerator(DBGenerator):
         for entry in data:
             realname = entry["name"]
 
-            parts = realname.split(".")
+            pkgname = realname
+            parts = pkgname.split(".")
             if len(parts) > 1:
-                realname = "_".join(parts)
+                pkgname = "_".join(parts)
 
-            if self.in_config([common_config, config], "exclude", realname):
+            if self.in_config([common_config, config], "exclude", pkgname):
                 continue
             
             #todo: work on common data vars processing: external deps, filtering etc.
@@ -187,4 +188,4 @@ class CtanDBGenerator(DBGenerator):
                            'longdescription' : longdescription
                           }
 
-            pkg_db.add_package(Package(category, realname, version), ebuild_data)
+            pkg_db.add_package(Package(category, pkgname, version), ebuild_data)


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/
@ 2013-08-01 15:58 Jauhien Piatlicki
  0 siblings, 0 replies; 12+ messages in thread
From: Jauhien Piatlicki @ 2013-08-01 15:58 UTC (permalink / raw
  To: gentoo-commits

commit:     d12a62bf86564cda836c25546ff8059335fbe7c7
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Thu Aug  1 15:58:05 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Thu Aug  1 15:58:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=d12a62bf

CTAN backend: Docstrings and different fixes

---
 gs_ctan/backend.py |  4 ++++
 gs_ctan/ctan_db.py | 25 ++++++++++++++++++++++---
 gs_ctan/ebuild.py  |  6 ++++++
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/gs_ctan/backend.py b/gs_ctan/backend.py
index 42a4a83..92245e6 100644
--- a/gs_ctan/backend.py
+++ b/gs_ctan/backend.py
@@ -23,10 +23,14 @@ from .ebuild import CtanEbuildWithoutDigestGenerator, CtanEbuildWithDigestGenera
 
 
 class CtanEclassGenerator(EclassGenerator):
+    """
+    Implementation of eclass generator. Only specifies a data directory.
+    """
     def __init__(self):
         super(CtanEclassGenerator, self).__init__(os.path.join(get_pkgpath(__file__), 'data'))
         
 
+#Backend instance to be loaded by g_sorcery
 instance = Backend(CtanDBGenerator,
                    CtanEbuildWithDigestGenerator, CtanEbuildWithoutDigestGenerator,
                    CtanEclassGenerator, MetadataGenerator)

diff --git a/gs_ctan/ctan_db.py b/gs_ctan/ctan_db.py
index 39195e8..0f7d939 100644
--- a/gs_ctan/ctan_db.py
+++ b/gs_ctan/ctan_db.py
@@ -12,17 +12,18 @@
 """
 
 import itertools
-import os
 import re
 
 import portage
 
 from g_sorcery.g_collections import Dependency, Package, serializable_elist
 from g_sorcery.package_db import DBGenerator
-from g_sorcery.exceptions import SyncError
 from g_sorcery.logger import Logger
 
 class CtanDBGenerator(DBGenerator):
+    """
+    Implementation of database generator for CTAN LaTeX backend.
+    """
     def __init__(self, package_db_class):
         super(CtanDBGenerator, self).__init__(package_db_class)
         
@@ -38,10 +39,25 @@ class CtanDBGenerator(DBGenerator):
 
 
     def get_download_uries(self, common_config, config):
+        """
+        Get download URI.
+        """
         tlpdb_uri = config["repo_uri"] + "/tlpkg/texlive.tlpdb.xz"
         return [tlpdb_uri]
         
     def parse_data(self, data_f):
+        """
+        Parse downloaded data.
+
+        Parsed data is a list of dictionaries.
+        Each dictionary corresponds to one package.
+
+        Args:
+            data_f: Open file wit data.
+
+        Returns:
+            Parsed data.
+        """
         data = data_f.read()
         
         data = data.split("\n")
@@ -98,7 +114,10 @@ class CtanDBGenerator(DBGenerator):
         return result
 
     def process_data(self, pkg_db, data, common_config, config):
-        
+        """
+        Process parsed data and fill database.
+        """
+
         category = "dev-tex"
         
         pkg_db.add_category(category)

diff --git a/gs_ctan/ebuild.py b/gs_ctan/ebuild.py
index a800cbd..d8b4f65 100644
--- a/gs_ctan/ebuild.py
+++ b/gs_ctan/ebuild.py
@@ -21,6 +21,9 @@ Layout = collections.namedtuple("Layout",
   
 
 class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator):
+    """
+    Implementation of ebuild generator without sources digesting.
+    """
     def __init__(self, package_db):
 
         vars_before_inherit = \
@@ -39,6 +42,9 @@ class CtanEbuildWithoutDigestGenerator(DefaultEbuildGenerator):
         super(CtanEbuildWithoutDigestGenerator, self).__init__(package_db, layout)
 
 class CtanEbuildWithDigestGenerator(DefaultEbuildGenerator):
+    """
+    Implementation of ebuild generator with sources digesting.
+    """
     def __init__(self, package_db):
 
         vars_before_inherit = \


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-08-01 15:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-01 15:58 [gentoo-commits] proj/g-sorcery:master commit in: gs_ctan/ Jauhien Piatlicki
  -- strict thread matches above, loose matches on Subject: below --
2013-07-31 23:29 Jauhien Piatlicki
2013-07-22 16:57 Jauhien Piatlicki
2013-07-19 16:56 Jauhien Piatlicki
2013-07-19 11:23 Jauhien Piatlicki
2013-07-19 11:10 Jauhien Piatlicki
2013-07-19  8:36 Jauhien Piatlicki
2013-07-18 22:29 Jauhien Piatlicki
2013-07-18  0:12 Jauhien Piatlicki
2013-07-18  0:12 Jauhien Piatlicki
2013-07-17 23:19 Jauhien Piatlicki
2013-07-17 17:05 Jauhien Piatlicki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox