convert: Now use slot for category name

This commit is contained in:
Daniele Rondina 2020-10-18 19:58:15 +02:00
parent 07dff7f197
commit c0cc9ec703
2 changed files with 8 additions and 1 deletions

View File

@ -28,7 +28,7 @@ import (
) )
var convertCmd = &cobra.Command{ var convertCmd = &cobra.Command{
Use: "convert", Use: "convert [portage-tree] [luet-tree]",
Short: "convert other package manager tree into luet", Short: "convert other package manager tree into luet",
Long: `Parses external PM and produces a luet parsable tree`, Long: `Parses external PM and produces a luet parsable tree`,
PreRun: func(cmd *cobra.Command, args []string) { PreRun: func(cmd *cobra.Command, args []string) {

View File

@ -353,6 +353,12 @@ func (ep *SimpleEbuildParser) ScanEbuild(path string) (pkg.Packages, error) {
return pkg.Packages{}, err return pkg.Packages{}, err
} }
// Retrieve slot
slot, ok := vars["SLOT"]
if ok && slot.String() != "0" {
pack.SetCategory(fmt.Sprintf("%s-%s", gp.Category, slot.String()))
}
// TODO: Handle this a bit better // TODO: Handle this a bit better
iuse, ok := vars["IUSE"] iuse, ok := vars["IUSE"]
if ok { if ok {
@ -417,6 +423,7 @@ func (ep *SimpleEbuildParser) ScanEbuild(path string) (pkg.Packages, error) {
for _, d := range gRDEPEND.GetDependencies() { for _, d := range gRDEPEND.GetDependencies() {
//TODO: Resolve to db or create a new one. //TODO: Resolve to db or create a new one.
//TODO: handle SLOT too.
dep := &pkg.DefaultPackage{ dep := &pkg.DefaultPackage{
Name: d.Dep.Name, Name: d.Dep.Name,
Version: d.Dep.Version + d.Dep.VersionSuffix, Version: d.Dep.Version + d.Dep.VersionSuffix,