1 |
On Mon, 2012-06-25 at 16:26 +0300, Slava Bacherikov wrote: |
2 |
> Hello all. |
3 |
> |
4 |
> My project task is creating new version of packages.gentoo.org site. |
5 |
> You could find it on |
6 |
> http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=summary |
7 |
> or on https://github.com/bacher09/gentoo-packages |
8 |
> If you want to submit feature request you may do this by assign issue on |
9 |
> github to me. |
10 |
> |
11 |
> Last week I worked on improving collection information and view. I've |
12 |
> added ability to get and store additional information about the overlay, |
13 |
> but came up against a small problem. Name of overlay could be not equal |
14 |
> to name in repo_name. For example haskell overlay in the repo_name file |
15 |
> has name gentoo-haskell. |
16 |
|
17 |
|
18 |
> I partially solved this problem, now if it |
19 |
> could not find equal overlay name it tries add or delete 'gentoo-' prefix. |
20 |
> |
21 |
Sorry, I didn't get the irc channel your using added into my irc |
22 |
client's autojoin. But I have been in #-soc... |
23 |
|
24 |
|
25 |
I ran into this same problem with layman. It was adding the news |
26 |
reporting to layman where I had the problem. Since, layman does not do |
27 |
the news reporting directly. I ran some code to get the correct |
28 |
repo_name from portage. There are some nice convienience functions which |
29 |
I had implemented in portage a few years back (saved doing it in |
30 |
porthole). Then have portage report any new news items in the |
31 |
overlay(s). Pkgcore does not yet have the news reporting feature. |
32 |
|
33 |
Check layman/api.py |
34 |
|
35 |
544 def update_news(self, repos=None): |
36 |
[snip] |
37 |
|
38 |
553 # get the actual repo_name from portage |
39 |
554 # because it may be different than layman's name for it |
40 |
555 repo_names = [] |
41 |
556 for repo in repos: |
42 |
557 ovl = self._get_installed_db().select(repo) |
43 |
558 ovl_path = os.path.join(ovl.config['storage'], repo) |
44 |
559 repo_names.append(portdb.getRepositoryName(ovl_path)) |
45 |
560 self.output.debug("LaymanAPI: update_news(); repo_names = " |
46 |
561 + str(repo_names), 4) |
47 |
562 news_counts = count_unread_news(portdb, vardb, repo_names) |
48 |
563 display_news_notifications(news_counts) |
49 |
... |
50 |
|
51 |
Also note that pkgcore has both the repo_name and path info available, |
52 |
although it does not have convienience funtions to get the other, given |
53 |
one. Here is how we are doing it in porthole's pkgcore backend. |
54 |
|
55 |
|
56 |
def get_overlay_name(self, ovl): |
57 |
541 #debug.dprint("PKGCORE.lib: get_overlay_name(); ovl = " + |
58 |
ovl) |
59 |
542 for repo in self.settings.tree: |
60 |
543 try: |
61 |
544 if repo.location == ovl: |
62 |
545 return repo.repo_id |
63 |
546 except AttributeError: |
64 |
547 continue |
65 |
548 return "" |
66 |
|
67 |
|
68 |
Also if your looking for more pkgcore api's here's the link to the |
69 |
dev_api branch where the backend porting work has been going on. |
70 |
|
71 |
http://porthole.git.sourceforge.net/git/gitweb.cgi?p=porthole/porthole;a=tree;f=pmbackends;hb=refs/heads/dev_api |
72 |
|
73 |
you can look thru the pkgcore and portage sub-pkgs. Bare in mind that |
74 |
some things are in flux, more in the portage backend in order to keep |
75 |
things in line with the pkgcore backend. |
76 |
|
77 |
I just ask that if you find out how to do something in pkgcore that you |
78 |
see has not yet been ported in porthole's pkgcore backend. To please |
79 |
tell me :-) so I can implement it. |
80 |
|
81 |
> I also developed a backends mechanism for scan - now it can collect |
82 |
> information through portage or pkgcore, backend could be select the |
83 |
> settings file. Also implement another scaning backend is very easy, just |
84 |
> need implement special interface. |
85 |
|
86 |
good :-) |
87 |
|
88 |
> |
89 |
> I also worked on the designs and the general improvement of the code. |
90 |
> |
91 |
> Plans for the this week: |
92 |
> I'm gonna document my classes |
93 |
> I also plan work on views, layout and scanning tool. |
94 |
> |
95 |
|
96 |
|
97 |
-- |
98 |
Brian Dolbec <dolsen@g.o> |