public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Shell script help - emerge frontend.
@ 2003-06-20 13:47 Philippe Lafoucrière
  2003-06-20 15:20 ` Michael Kohl
  0 siblings, 1 reply; 16+ messages in thread
From: Philippe Lafoucrière @ 2003-06-20 13:47 UTC (permalink / raw
  To: Gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

Hello

Last month, I took a look at FreeBSD which really surprised me. However,
gentoo rocks so much I can't give it up. I started yesterday to create a
shell script that would help newbies with Gentoo, and especially
PORTAGE.
This script would be very similar to /stand/sysinstall of Freebsd. Are
there some volonteers to work on it with me ? 

(script is attached, don't worry about filename.)


[-- Attachment #2: dia-emerge.sh --]
[-- Type: text/x-sh, Size: 1737 bytes --]

#! /bin/sh

# Front end to emerge and portage (gentoo Linux) using dialog.
# Philippe Lafoucrière <lafou@wanadoo.fr> - 2003
#
# This utility only use dialog so it can be used with a minimal installation.
#

VERSION="0.0.1"

#DIALOG=Xdialog
DIALOG="dialog"

PORTAGE_DIR="/usr/portage"

# Return codes used in this program:
E_SUCCESS=0
E_FAILURE=1


######### EMERGE_MENU #########
emerge_menu() {
    local RESULT=${E_FAILURE}
    local LIST=$(ls ${PORTAGE_DIR})
    local DLIST=
    for N in ${LIST} ; do
        DLIST="${DLIST} $N -"
    done
    CATEGORY=$(dialog --stdout \
            --backtitle "portage categories" \
             --menu "Choose category" 0 0 0\
             ${DLIST})
    RESULT=$?
    select_package_menu
}
######### EMERGE_MENU #########
select_package_menu() {
    local RESULT=${E_FAILURE}
    local LIST=$(ls ${PORTAGE_DIR}/${CATEGORY})
    local DLIST=

    for N in ${LIST} ; do
        DLIST="${DLIST} $N - "
    done
    PACKAGE=$(dialog --stdout \
            --backtitle "Packages in ${CATEGORY}" \
             --menu "Choose Package" 0 0 0\
             ${DLIST})
    RESULT=$?
    return ${RESULT}
}
######### EMERGE_MENU #########
conf_menu() {
    dialog --backtitle 'Configuration' \
    --msgbox "                  Not yet implemented" 5 60
}

######### INTRO #########
intro() {
    dialog --backtitle 'portage' \
    --msgbox "              Welcome to portage utilities" 5 60
}

######### MAIN #########
main_menu () {
    RESULT=$(dialog --stdout \
        --backtitle 'portage' --menu "Select a function" 10  60 0 \
        1   'Install package (emerge)' \
        2   'Configure portage')

    case $RESULT in
        1) emerge_menu;;
        2) conf_menu;;
    esac
}


intro
main_menu
#


[-- Attachment #3: Type: text/plain, Size: 37 bytes --]

--
gentoo-dev@gentoo.org mailing list

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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 13:47 [gentoo-dev] Shell script help - emerge frontend Philippe Lafoucrière
@ 2003-06-20 15:20 ` Michael Kohl
  2003-06-20 16:06   ` Philippe Lafoucrière
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Kohl @ 2003-06-20 15:20 UTC (permalink / raw
  To: lafou; +Cc: Gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

On 20 Jun 2003 15:47:01 +0200
Philippe Lafoucrière <lafou@wanadoo.fr> wrote:

> This script would be very similar to /stand/sysinstall of Freebsd. Are
> there some volonteers to work on it with me ? 

Actually this is something I proposed to this list not that long ago:
http://article.gmane.org/gmane.linux.gentoo.devel/9205

I started doing some work in Python + Dialog, but until after my exams
(Monday till Wednesday) I don't have any time. 

But feel free to contact me offlist if you want to combine our efforts/
discuss a little/whatever...

Michael

-- 
www.cargal.org 
GnuPG-key-ID: 0x90CA09E3
Jabber-ID: citizen428 [at] cargal [dot] org
Registered Linux User #278726

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 15:20 ` Michael Kohl
@ 2003-06-20 16:06   ` Philippe Lafoucrière
  2003-06-20 16:16     ` Philippe Lafoucrière
                       ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Philippe Lafoucrière @ 2003-06-20 16:06 UTC (permalink / raw
  To: Michael Kohl; +Cc: Gentoo-dev

> Actually this is something I proposed to this list not that long ago:
> http://article.gmane.org/gmane.linux.gentoo.devel/9205

Yes, I've red it. But I saw nothing concrete since that. :(

> I started doing some work in Python + Dialog, but until after my exams
> (Monday till Wednesday) I don't have any time. 

Pythondialiog (available in portable) in a very cool product. But I want
to do a sys util. It must run with the minimum packages. (Although,
python is available in miminal installation, since portage using it.). 

> But feel free to contact me offlist if you want to combine our efforts/
> discuss a little/whatever...

Of course. I'll do it

thanx
Philippe


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 16:06   ` Philippe Lafoucrière
@ 2003-06-20 16:16     ` Philippe Lafoucrière
  2003-06-20 16:56       ` Philippe Lafoucrière
  2003-06-20 19:15     ` Svyatogor
  2003-06-21 10:56     ` Michael Kohl
  2 siblings, 1 reply; 16+ messages in thread
From: Philippe Lafoucrière @ 2003-06-20 16:16 UTC (permalink / raw
  To: Michael Kohl; +Cc: Gentoo-dev

> Pythondialiog (available in portable) in a very cool product. But I want
> to do a sys util. It must run with the minimum packages. (Although,
> python is available in miminal installation, since portage using it.). 

Moreover,
pythondialog ebuild is buggy :

>>> import Dialog
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/lib-tk/Dialog.py", line 3, in ?
    from Tkinter import *
  File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 35, in ?
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
>>> 

So, you'll have to install :
- pythondialog
- tcl
- tk

Should we use python + dialog, or only "shell" dialog ?


An advantage of using python would be the use of portage package (haven't thought about 
that).


Could you send me your script please ?


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 16:16     ` Philippe Lafoucrière
@ 2003-06-20 16:56       ` Philippe Lafoucrière
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Lafoucrière @ 2003-06-20 16:56 UTC (permalink / raw
  To: Gentoo-dev

OOOOoopppps

sorry, My fault !!

(pythondialog doc sucks)

This is the correct way :

from dialog import Dialog
(instead of Dialog, which is a tk module).

So pythondialog just need dialog, which is perfect.

This is definitly what we need.


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 19:15     ` Svyatogor
@ 2003-06-20 18:08       ` Philippe Lafoucrière
  2003-06-20 20:24         ` bdharring
  0 siblings, 1 reply; 16+ messages in thread
From: Philippe Lafoucrière @ 2003-06-20 18:08 UTC (permalink / raw
  To: Gentoo-dev

Ok

I've made some test. Python + dialog rocks, and is by far simpler than bash + dialog.

But, after doing :
python
import portage 
help (portage)

I fell a little bit confused. Is there a 'getting started' doc for using python with 
portage ?

--
Philippe 


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 16:06   ` Philippe Lafoucrière
  2003-06-20 16:16     ` Philippe Lafoucrière
@ 2003-06-20 19:15     ` Svyatogor
  2003-06-20 18:08       ` Philippe Lafoucrière
  2003-06-21 10:56     ` Michael Kohl
  2 siblings, 1 reply; 16+ messages in thread
From: Svyatogor @ 2003-06-20 19:15 UTC (permalink / raw
  To: gentoo-dev

Probably Python + ncurses is a wizer solution? Both of them are in minimal 
gentoo system, so you can be sure that everyone has it. On the other hand I 
guess implementing the tool in python will make ti easier to add new modules 
to it. Say we create a new config. tool - it can be easily added as another 
component.

On Friday 20 June 2003 16:06, Philippe Lafoucrière wrote:
> > Actually this is something I proposed to this list not that long ago:
> > http://article.gmane.org/gmane.linux.gentoo.devel/9205
>
> Yes, I've red it. But I saw nothing concrete since that. :(
>
> > I started doing some work in Python + Dialog, but until after my exams
> > (Monday till Wednesday) I don't have any time.
>
> Pythondialiog (available in portable) in a very cool product. But I want
> to do a sys util. It must run with the minimum packages. (Although,
> python is available in miminal installation, since portage using it.).
>
> > But feel free to contact me offlist if you want to combine our efforts/
> > discuss a little/whatever...


-- 
Sergey Kuleshov <svyatogor@gentoo.org>
Let the Force be with us!


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 18:08       ` Philippe Lafoucrière
@ 2003-06-20 20:24         ` bdharring
  2003-06-20 20:31           ` Philippe Lafoucrière
  2003-06-21  3:52           ` Michael Kohl
  0 siblings, 2 replies; 16+ messages in thread
From: bdharring @ 2003-06-20 20:24 UTC (permalink / raw
  To: lafou; +Cc: gentoo-dev

On Friday, June 20, 2003, at 01:08 PM, Philippe Lafoucrière wrote:
> I fell a little bit confused. Is there a 'getting started' doc for 
> using python with
> portage ?

try 'pydoc portage'.  It's about the best I've found to give you a 
summary/idea of what functions/objects there are.  From there, I've 
always just dug into the portage lib/module at 
/usr/lib/python2.2/site-packages/portage.py .
I haven't seen any *specific* docs for using the portage api, if you 
come across any I would like to know of them.
viel gluck.
~brian

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 20:24         ` bdharring
@ 2003-06-20 20:31           ` Philippe Lafoucrière
       [not found]             ` <20030620231603.1aba32dd.genone@genone.homeip.net>
  2003-06-20 21:33             ` bdharring
  2003-06-21  3:52           ` Michael Kohl
  1 sibling, 2 replies; 16+ messages in thread
From: Philippe Lafoucrière @ 2003-06-20 20:31 UTC (permalink / raw
  To: Gentoo-dev

Already seen pydoc portage. but many functions aren't documented, and there's a lot on 
info at a time.

How can I get all the categories (without subpackages)? I mean, I want 

app-emacs
app-emulation
...

and not app-emacs/analog app-emacs/apache-mode etc.


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
       [not found]             ` <20030620231603.1aba32dd.genone@genone.homeip.net>
@ 2003-06-20 21:32               ` Philippe Lafoucrière
  2003-06-20 21:38                 ` bdharring
  0 siblings, 1 reply; 16+ messages in thread
From: Philippe Lafoucrière @ 2003-06-20 21:32 UTC (permalink / raw
  To: Gentoo-dev


> There is a file "categories" in /usr/portage/profiles that lists all
> official categories.

ho thanks a lot Marius.

Please understand my problem : I couldn't guess it :(



--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 20:31           ` Philippe Lafoucrière
       [not found]             ` <20030620231603.1aba32dd.genone@genone.homeip.net>
@ 2003-06-20 21:33             ` bdharring
  1 sibling, 0 replies; 16+ messages in thread
From: bdharring @ 2003-06-20 21:33 UTC (permalink / raw
  To: lafou; +Cc: gentoo-dev


On Friday, June 20, 2003, at 03:31 PM, Philippe Lafoucrière wrote:

> Already seen pydoc portage. but many functions aren't documented, and 
> there's a lot on
> info at a time.
>
> How can I get all the categories (without subpackages)? I mean, I want
>
> app-emacs
> app-emulation
> ...
>
> and not app-emacs/analog app-emacs/apache-mode etc.
I'd start pulling apart the various sections of emerge to figure out 
how it accomplishes everything, but this code (while not guaranteed to 
be the best way) ought to be what you're after.
`
#!/usr/bin/python
import portage
global pdict; pdict = {}
global ptree
ptree = portage.portagetree()
temp = ptree.getallnodes()
for entry in temp:
     base = ''; package = ''
     (base, package) = string.split(entry, '/')
     if pdict.has_key(base):
         pdict[base].append(package)
     else:
         pdict[base] = [package]
for entry in pdict:
	print entry
`
While this is a bit more then you were after (you seemed after just 
categories), you can isolate out what you need by just grabbing the 
keys of pdict.  This leaves you w/ a hash, w/ lists of each package 
w/in each key.
~Brian


--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 21:32               ` Philippe Lafoucrière
@ 2003-06-20 21:38                 ` bdharring
  2003-06-20 21:50                   ` Thomas de Grenier de Latour
  2003-06-20 22:38                   ` Marius Mauch
  0 siblings, 2 replies; 16+ messages in thread
From: bdharring @ 2003-06-20 21:38 UTC (permalink / raw
  To: gentoo-dev


On Friday, June 20, 2003, at 04:32 PM, Philippe Lafoucrière wrote:

>
>> There is a file "categories" in /usr/portage/profiles that lists all
>> official categories.
>
> ho thanks a lot Marius.
>
> Please understand my problem : I couldn't guess it :(
Doh.
That's a bit more straightforward then what I posted... is there a 
particular place/doc you (marius) pulled that from?
~brian

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 21:38                 ` bdharring
@ 2003-06-20 21:50                   ` Thomas de Grenier de Latour
  2003-06-20 22:38                   ` Marius Mauch
  1 sibling, 0 replies; 16+ messages in thread
From: Thomas de Grenier de Latour @ 2003-06-20 21:50 UTC (permalink / raw
  To: gentoo-dev

On Fri, 20 Jun 2003 16:38:06 -0500
bdharring <bdharring@wisc.edu> wrote:

> That's a bit more straightforward then what I posted... is there a 
> particular place/doc you (marius) pulled that from?

$ grep -i categories /usr/lib/python2.2/site-packages/portage.py 

That's what i had to do a few days ago to find out how to add my own
categories to portage_overlay ;) 


-- 
Thomas de Grenier de Latour.

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 21:38                 ` bdharring
  2003-06-20 21:50                   ` Thomas de Grenier de Latour
@ 2003-06-20 22:38                   ` Marius Mauch
  1 sibling, 0 replies; 16+ messages in thread
From: Marius Mauch @ 2003-06-20 22:38 UTC (permalink / raw
  To: gentoo-dev

On Fri, 20 Jun 2003 16:38:06 -0500 bdharring wrote:

> 
> On Friday, June 20, 2003, at 04:32 PM, Philippe Lafoucrière wrote:
> 
> >
> >> There is a file "categories" in /usr/portage/profiles that lists
> >all> official categories.
> >
> > ho thanks a lot Marius.
> >
> > Please understand my problem : I couldn't guess it :(
> Doh.
> That's a bit more straightforward then what I posted... is there a 
> particular place/doc you (marius) pulled that from?

I did a bit of patching to repoman (the program that checks the tree)
and that's the way repoman checks for valid categories :)

Marius

--
gentoo-dev@gentoo.org mailing list


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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 20:24         ` bdharring
  2003-06-20 20:31           ` Philippe Lafoucrière
@ 2003-06-21  3:52           ` Michael Kohl
  1 sibling, 0 replies; 16+ messages in thread
From: Michael Kohl @ 2003-06-21  3:52 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

On Fri, 20 Jun 2003 15:24:04 -0500
bdharring <bdharring@wisc.edu> wrote:

> I haven't seen any *specific* docs for using the portage api, if you 
> come across any I would like to know of them.

Lordvan (Thomas) once gave me a link to a Portage API documentation he
did a while ago:
http://www.lordvan.com/Projects/Linux/Gentoo/Portage/doc/api/

But be careful, he said that it is a little out of date in some places.

HTH,
Michael

-- 
www.cargal.org 
GnuPG-key-ID: 0x90CA09E3
Jabber-ID: citizen428 [at] cargal [dot] org
Registered Linux User #278726

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-dev] Shell script help - emerge frontend.
  2003-06-20 16:06   ` Philippe Lafoucrière
  2003-06-20 16:16     ` Philippe Lafoucrière
  2003-06-20 19:15     ` Svyatogor
@ 2003-06-21 10:56     ` Michael Kohl
  2 siblings, 0 replies; 16+ messages in thread
From: Michael Kohl @ 2003-06-21 10:56 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

On 20 Jun 2003 18:06:08 +0200
Philippe Lafoucrière <lafou@wanadoo.fr> wrote:

> Yes, I've red it. But I saw nothing concrete since that. :(

There wasn't really  a lot of feedback to my suggestion, so I thought
nobody is interested (at least until there is some code to look at)...
 
> Pythondialiog (available in portable) in a very cool product. But I
> want to do a sys util. It must run with the minimum packages.
> (Although, python is available in miminal installation, since portage
> using it.). 

I also went with Pythondialog (which btw works fine here, no problems
like described in your other mail), it's ok, but just covers the basic
features of Dialog. Things like relabeling buttons etc. are missing.

> Moreover, pythondialog ebuild is buggy :

As stated above, it worked for me, but I already had quite a lot of
Tcl/Tk stuff installed (for Tkabber).

> Should we use python + dialog, or only "shell" dialog ? An advantage
> of using python would be the use of portage package
> (haven't thought about that).

The use portage was actually the reason for me to go with Python.
BUT I've never done anything substantially more difficult the "Hello
World" (ok, I did a little more, but no much) in Python, so this project
was also intended as a way to teach me the language.

Sending you the script as it is right now would be of little use, it's
jsut a little something getting me started in Python.

As I said, after my exams are finished I have more time for this...

Michael

-- 
www.cargal.org 
GnuPG-key-ID: 0x90CA09E3
Jabber-ID: citizen428 [at] cargal [dot] org
Registered Linux User #278726


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2003-06-21 10:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-20 13:47 [gentoo-dev] Shell script help - emerge frontend Philippe Lafoucrière
2003-06-20 15:20 ` Michael Kohl
2003-06-20 16:06   ` Philippe Lafoucrière
2003-06-20 16:16     ` Philippe Lafoucrière
2003-06-20 16:56       ` Philippe Lafoucrière
2003-06-20 19:15     ` Svyatogor
2003-06-20 18:08       ` Philippe Lafoucrière
2003-06-20 20:24         ` bdharring
2003-06-20 20:31           ` Philippe Lafoucrière
     [not found]             ` <20030620231603.1aba32dd.genone@genone.homeip.net>
2003-06-20 21:32               ` Philippe Lafoucrière
2003-06-20 21:38                 ` bdharring
2003-06-20 21:50                   ` Thomas de Grenier de Latour
2003-06-20 22:38                   ` Marius Mauch
2003-06-20 21:33             ` bdharring
2003-06-21  3:52           ` Michael Kohl
2003-06-21 10:56     ` Michael Kohl

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