[devel] [kojima на conectiva.com.br: Re: [Apt-rpm] meta packages ?]

Alexander Bokovoy =?iso-8859-1?q?ab_=CE=C1_avilink=2Enet?=
Пт Фев 9 17:31:19 MSK 2001


----- Forwarded message from "Alfredo K. Kojima" <kojima на conectiva.com.br> -----

From: "Alfredo K. Kojima" <kojima на conectiva.com.br>
To: "Matilainen Panu (NRC/Helsinki)" <panu.matilainen на nokia.com>
cc: "Hiller, Thomas" <Thomas.Hiller на compaq.com>,
        "'apt-rpm на distro.conectiva.com.br'" <apt-rpm на distro.conectiva.com.br>
Subject: Re: [Apt-rpm] meta packages ?
Date: Thu, 8 Feb 2001 14:56:10 -0200 (BRST)

I have this one (quick&dirty) attached.

--
Alfredo


On Thu, 8 Feb 2001, Matilainen Panu (NRC/Helsinki) wrote:

> On Wed, 7 Feb 2001, ext Alfredo K. Kojima wrote:
> 
> >
> >
> > We use the same approach as Debian for that, which are task packages.
> > You just make an empty package that contains only a bunbh
> > of Requires for each package you want installed. Then install that task
> > package. You can easily convert a comps file to a set of task packages
> > with some script.
> 
> You wouldn't, by any chance, have written such a script? :)
> 
> 	- Panu -
> 
> >
> > --
> > Alfredo
> >
> >
> > On Wed, 7 Feb 2001, Hiller, Thomas wrote:
> >
> > > Hi,
> > >
> > > I'm looking for some kind of meta package support in apt-get. I think it
> > > would be nice to have at least some grouping like that from the "comps" file
> > > in RedHat.
> > > Is this possible with apt-get ? What must be done for it ?
> > > Is there a solution for installing with apt-get (from scratch) ? I'm working
> > > on a universal installation server. Do you have some pointers ? I would
> > > really appreciate it, if I can install all my servers from installation
> > > servers and not be bound to kickstart or similiar solutions.
> > >
> > > Thanks.
> > >
> > > Regards,
> > > Thomas
> > >
> > > Thomas Hiller
> > >
> > > COMPAQ Computer Corporation
> > > Global SAP Solution Center
> > > SAP LinuxLab
> > > Altrottstr. 31, D-69190 Walldorf - Germany
> > >
> > > *	Phone:  ++49/6227/7-45426
> > > *	Fax:      ++49/6227/7-55426
> > > *	Mobil:   ++49/172/7282550
> > > *E* mailto:  thomas.hiller на compaq.com
> > >
> > > _______________________________________________
> > > Apt-rpm mailing list
> > > Apt-rpm на distro.conectiva.com.br
> > > http://distro.conectiva.com.br/mailman/listinfo/apt-rpm
> > >
> >
> > _______________________________________________
> > Apt-rpm mailing list
> > Apt-rpm на distro.conectiva.com.br
> > http://distro.conectiva.com.br/mailman/listinfo/apt-rpm
> >
> 
> -- 
> 

#!/usr/bin/python


import time
import sys
from string import *


nl="\n"

def nameToTName(name):
    name = lower(strip(name))
    name = replace(name, " ", "_")
    name = replace(name, "/", "_")
    return name




def taskalize(arch, version, name, packages):

    fname = "task--"+nameToTName(name)+".spec"
    
    f = open(fname, "w+")    
    
    f.write("Summary: Metapackage for "+name+nl)
    f.write("Name: task--"+nameToTName(name)+nl)
    f.write("Version: "+version+nl)
    f.write("Release: 1"+nl)
    f.write("License: to kill"+nl)
    f.write("Group: Tasks"+nl)
    
    for p in packages:
	if p[0]=="@":
	    f.write("Requires: task--"+nameToTName(p[1:])+nl)
	else:
	    tok = split(p)
	    if len(tok) == 2:
		if (tok[0]=="!" and tok[0]!=arch) or \
		    (tok[0]!="!" and tok[0]==arch):
		    f.write("Requires: "+strip(tok[1])+nl)
	    else:
		f.write("Requires: "+p+nl)
    f.write("BuildArch: "+arch+nl)
    f.write("BuildRoot: %{_tmppath}/%{name}-%{version}-root"+nl)
    
    f.write(nl+"%description"+nl)
    f.write("Auto-generated meta package to install things for "+name+"."+nl)
    f.write(nl+"%files"+nl)
    
    f.close()
    
    print "Created", fname



def taskalizeFile(file, arch, version):
    try:
	f = open(file, "r")
    except:
	print "comps file",file,"could not be opened."
	sys.exit(1)
    
    while 1:
	# garbage
	line = f.readline()
	if not line:
	    break
	line = strip(line[:-1])
	if not line:
	    continue
	if line[-1]!="{":
	    continue
	tokens = split(strip(line[1:-1]))
	if tokens[0][:2]=="--":
	    del tokens[0]

	name = join(tokens)

	pl = []
	while 1:
	    line = f.readline()
	    if not line:
		print "ERROR: File ended with incomplete data"
		sys.exit(1)
	    line=line[:-1]
	    if line=="}":
		break
	    pl.append(strip(line))


	taskalize(arch, version, name, pl)


    f.close()
    
    
t=time.localtime(time.time())
y=`t[0]`
m=`t[1]`
if len(m)==1:
    m="0"+m
d=`t[2]`
if len(d)==1:
    d="0"+d
version=y+m+d

taskalizeFile(sys.argv[1], "i386", version)


print "Use rpm -ba <filename.spec> to create the packages"



----- End forwarded message -----

-- 
Sincerely yours, Alexander Bokovoy 
  The Midgard Project   | www.midgard-project.org |    Aurora R&D team 
Minsk Linux Users Group |    www.minsk-lug.net    |  www.aurora-linux.com  
   IPLabs Linux Team    |     linux.iplabs.ru     | Architecte Open Source
-- Whoever would lie usefully should lie seldom.
_______________________________________________
Devel mailing list
Devel на linux.iplabs.ru
http://www.logic.ru/mailman/listinfo/devel



Подробная информация о списке рассылки Devel