diff --git a/pkg/package/package.go b/pkg/package/package.go index a2483892..2ff894ae 100644 --- a/pkg/package/package.go +++ b/pkg/package/package.go @@ -68,6 +68,15 @@ type Package interface { SetPath(string) GetPath() string Rel(string) string + + GetDescription() string + SetDescription(string) + + AddURI(string) + GetURI() []string + + SetLicense(string) + GetLicense() string } type Tree interface { @@ -125,6 +134,10 @@ type DefaultPackage struct { // Path is set only internally when tree is loaded from disk Path string `json:"path,omitempty"` + + Description string `json:"description"` + Uri []string `json:"uri"` + License string `json:"license"` } // State represent the package state @@ -223,11 +236,27 @@ func (p *DefaultPackage) GetName() string { func (p *DefaultPackage) GetVersion() string { return p.Version } - +func (p *DefaultPackage) GetDescription() string { + return p.Description +} +func (p *DefaultPackage) SetDescription(s string) { + p.Description = s +} +func (p *DefaultPackage) GetLicense() string { + return p.License +} +func (p *DefaultPackage) SetLicense(s string) { + p.License = s +} +func (p *DefaultPackage) AddURI(s string) { + p.Uri = append(p.Uri, s) +} +func (p *DefaultPackage) GetURI() []string { + return p.Uri +} func (p *DefaultPackage) GetCategory() string { return p.Category } - func (p *DefaultPackage) SetCategory(s string) { p.Category = s } diff --git a/pkg/package/package_test.go b/pkg/package/package_test.go index 738caa77..74ff7c84 100644 --- a/pkg/package/package_test.go +++ b/pkg/package/package_test.go @@ -45,6 +45,35 @@ var _ = Describe("Package", func() { }) }) + Context("Check description", func() { + a := NewPackage("A", ">=1.0", []*DefaultPackage{}, []*DefaultPackage{}) + a.SetDescription("Description A") + + It("Set and get correctly a description", func() { + Expect(a.GetDescription()).To(Equal("Description A")) + }) + }) + + Context("Check licenses", func() { + a := NewPackage("A", ">=1.0", []*DefaultPackage{}, []*DefaultPackage{}) + a.SetLicense("MIT") + + It("Set and get correctly a license", func() { + Expect(a.GetLicense()).To(Equal("MIT")) + }) + }) + + Context("Check URI", func() { + a := NewPackage("A", ">=1.0", []*DefaultPackage{}, []*DefaultPackage{}) + a.AddURI("ftp://ftp.freeradius.org/pub/radius/freearadius-server-3.0.20.tar.gz") + + It("Set and get correctly an uri", func() { + Expect(a.GetURI()).To(Equal([]string{ + "ftp://ftp.freeradius.org/pub/radius/freearadius-server-3.0.20.tar.gz", + })) + }) + }) + Context("revdeps", func() { a := NewPackage("A", "1.0", []*DefaultPackage{}, []*DefaultPackage{}) b := NewPackage("B", "1.0", []*DefaultPackage{a}, []*DefaultPackage{}) diff --git a/pkg/tree/builder/gentoo/gentoo.go b/pkg/tree/builder/gentoo/gentoo.go index 09983e5e..0831bcc7 100644 --- a/pkg/tree/builder/gentoo/gentoo.go +++ b/pkg/tree/builder/gentoo/gentoo.go @@ -124,7 +124,9 @@ func (gb *GentooBuilder) Generate(dir string) (pkg.PackageDatabase, error) { if info.IsDir() { return nil } - if strings.Contains(info.Name(), "ebuild") { + // Ensure that only file with suffix .ebuild are elaborated. + // and ignore .swp files or files with string ebuild on name + if strings.HasSuffix(info.Name(), ".ebuild") { toScan <- path } return nil diff --git a/pkg/tree/builder/gentoo/gentoo_test.go b/pkg/tree/builder/gentoo/gentoo_test.go index daeba248..f1772d9c 100644 --- a/pkg/tree/builder/gentoo/gentoo_test.go +++ b/pkg/tree/builder/gentoo/gentoo_test.go @@ -16,6 +16,7 @@ package gentoo_test import ( + "fmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -46,4 +47,131 @@ var _ = Describe("GentooBuilder", func() { } }) + Context("Parse ebuild1", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/overlay/app-crypt/pinentry-gnome/pinentry-gnome-1.0.0-r2.ebuild") + It("parses correctly deps", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(pkgs[0].GetLicense()).To(Equal("GPL-2")) + Expect(pkgs[0].GetDescription()).To(Equal("GNOME 3 frontend for pinentry")) + }) + }) + + Context("Parse ebuild2", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/mod_dav_svn-1.12.2.ebuild") + + It("Parsing ebuild2", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(pkgs[0].GetLicense()).To(Equal("Subversion")) + Expect(pkgs[0].GetDescription()).To(Equal("Subversion WebDAV support")) + }) + }) + + Context("Parse ebuild3", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/linux-sources-1.ebuild") + + It("Check parsing of the ebuild3", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(0)) + Expect(pkgs[0].GetLicense()).To(Equal("")) + Expect(pkgs[0].GetDescription()).To(Equal("Virtual for Linux kernel sources")) + }) + }) + + Context("Parse ebuild4", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/sabayon-mce-1.1-r5.ebuild") + + It("Check parsing of the ebuild4", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(2)) + Expect(pkgs[0].GetLicense()).To(Equal("GPL-2")) + Expect(pkgs[0].GetDescription()).To(Equal("Sabayon Linux Media Center Infrastructure")) + }) + }) + + Context("Parse ebuild5", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/libreoffice-l10n-meta-6.2.8.2.ebuild") + + It("Check parsing of the ebuild5", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(146)) + Expect(pkgs[0].GetLicense()).To(Equal("LGPL-2")) + Expect(pkgs[0].GetDescription()).To(Equal("LibreOffice.org localisation meta-package")) + }) + }) + + Context("Parse ebuild6", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/pkgs-checker-0.2.0.ebuild") + + It("Check parsing of the ebuild6", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(0)) + Expect(pkgs[0].GetLicense()).To(Equal("GPL-3")) + Expect(pkgs[0].GetDescription()).To(Equal("Sabayon Packages Checker")) + }) + }) + + Context("Parse ebuild7", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/calamares-sabayon-base-modules-1.15.ebuild") + + It("Check parsing of the ebuild7", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(2)) + Expect(pkgs[0].GetLicense()).To(Equal("CC-BY-SA-4.0")) + Expect(pkgs[0].GetDescription()).To(Equal("Sabayon Official Calamares base modules")) + }) + }) + + Context("Parse ebuild8", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/subversion-1.12.0.ebuild") + + It("Check parsing of the ebuild8", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(25)) + Expect(pkgs[0].GetLicense()).To(Equal("Subversion GPL-2")) + Expect(pkgs[0].GetDescription()).To(Equal("Advanced version control system")) + }) + }) + + Context("Parse ebuild9", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/kodi-raspberrypi-16.0.ebuild") + + PIt("Check parsing of the ebuild9", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(66)) + Expect(pkgs[0].GetLicense()).To(Equal("GPL-2")) + Expect(pkgs[0].GetDescription()).To(Equal("Kodi is a free and open source media-player and entertainment hub")) + }) + }) + + Context("Parse ebuild10", func() { + parser := &SimpleEbuildParser{} + pkgs, err := parser.ScanEbuild("../../../../tests/fixtures/parser/tango-icon-theme-0.8.90-r1.ebuild") + + It("Check parsing of the ebuild10", func() { + Expect(err).ToNot(HaveOccurred()) + fmt.Println("PKG ", pkgs[0]) + Expect(len(pkgs[0].GetRequires())).To(Equal(2)) + Expect(pkgs[0].GetLicense()).To(Equal("public-domain")) + Expect(pkgs[0].GetDescription()).To(Equal("SVG and PNG icon theme from the Tango project")) + }) + }) + }) diff --git a/pkg/tree/builder/gentoo/simpleparser.go b/pkg/tree/builder/gentoo/simpleparser.go index ef78ecef..98ee6efa 100644 --- a/pkg/tree/builder/gentoo/simpleparser.go +++ b/pkg/tree/builder/gentoo/simpleparser.go @@ -24,6 +24,7 @@ import ( "fmt" "io/ioutil" "path/filepath" + "regexp" "strings" "time" @@ -31,9 +32,13 @@ import ( _gentoo "github.com/Sabayon/pkgs-checker/pkg/gentoo" pkg "github.com/mudler/luet/pkg/package" - "mvdan.cc/sh/expand" - "mvdan.cc/sh/shell" - "mvdan.cc/sh/syntax" + "mvdan.cc/sh/v3/expand" + "mvdan.cc/sh/v3/shell" + "mvdan.cc/sh/v3/syntax" +) + +const ( + uriRegex = "(.*[.]tar[.].*|.*[.]zip|.*[.]run|.*[.]png|.*[.]rpm|.*[.]gz)" ) // SimpleEbuildParser ignores USE flags and generates just 1-1 package @@ -66,15 +71,15 @@ func NewGentooDependency(pkg, use string) (*GentooDependency, error) { if pkg != "" { ans.Dep, err = _gentoo.ParsePackageStr(pkg) + if err != nil { + return nil, err + } // TODO: Fix this on parsing phase for handle correctly ${PV} if strings.HasSuffix(ans.Dep.Name, "-") { ans.Dep.Name = ans.Dep.Name[:len(ans.Dep.Name)-1] } - if err != nil { - return nil, err - } } return ans, nil @@ -143,6 +148,7 @@ func (r *GentooRDEPEND) GetDependencies() []*GentooDependency { func ParseRDEPEND(rdepend string) (*GentooRDEPEND, error) { var lastdep []*GentooDependency = make([]*GentooDependency, 0) var pendingDep = false + var orDep = false var dep *GentooDependency var err error @@ -158,20 +164,34 @@ func ParseRDEPEND(rdepend string) (*GentooRDEPEND, error) { continue } + if strings.HasPrefix(rr, "|| (") { + orDep = true + continue + } + + if orDep { + rr = strings.TrimSpace(rr) + if rr == ")" { + orDep = false + } + continue + } + if strings.Index(rr, "?") > 0 { // use flag present if pendingDep { dep, err = lastdep[len(lastdep)-1].AddSubDependency("", rr[:strings.Index(rr, "?")]) if err != nil { - return nil, err + Debug("Ignoring subdependency ", rr[:strings.Index(rr, "?")]) } } else { dep, err = NewGentooDependency("", rr[:strings.Index(rr, "?")]) if err != nil { - return nil, err + Debug("Ignoring dep", rr) + } else { + ans.Dependencies = append(ans.Dependencies, dep) } - ans.Dependencies = append(ans.Dependencies, dep) } if strings.Index(rr, ")") < 0 { @@ -179,6 +199,11 @@ func ParseRDEPEND(rdepend string) (*GentooRDEPEND, error) { lastdep = append(lastdep, dep) } + if strings.Index(rr, "|| (") >= 0 { + // Ignore dep in or + continue + } + fields := strings.Split(rr[strings.Index(rr, "?")+1:], " ") for _, f := range fields { f = strings.TrimSpace(f) @@ -188,7 +213,7 @@ func ParseRDEPEND(rdepend string) (*GentooRDEPEND, error) { _, err = dep.AddSubDependency(f, "") if err != nil { - return nil, err + Debug("Ignoring subdependency ", f) } } @@ -213,11 +238,31 @@ func ParseRDEPEND(rdepend string) (*GentooRDEPEND, error) { } } else { - dep, err := NewGentooDependency(rr, "") - if err != nil { - return nil, err + rr = strings.TrimSpace(rr) + // Check if there multiple deps in single row + + fields := strings.Split(rr, " ") + if len(fields) > 1 { + for _, rrr := range fields { + rrr = strings.TrimSpace(rrr) + if rrr == "" { + continue + } + dep, err := NewGentooDependency(rrr, "") + if err != nil { + Debug("Ignoring dep", rr) + } else { + ans.Dependencies = append(ans.Dependencies, dep) + } + } + } else { + dep, err := NewGentooDependency(rr, "") + if err != nil { + Debug("Ignoring dep", rr) + } else { + ans.Dependencies = append(ans.Dependencies, dep) + } } - ans.Dependencies = append(ans.Dependencies, dep) } } @@ -232,14 +277,45 @@ func SourceFile(ctx context.Context, path string, pkg *_gentoo.GentooPackage) (m if err != nil { return nil, fmt.Errorf("could not open: %v", err) } + scontent := string(content) + // Add default Genoo Variables ebuild := fmt.Sprintf("P=%s\n", pkg.GetP()) + fmt.Sprintf("PN=%s\n", pkg.GetPN()) + fmt.Sprintf("PV=%s\n", pkg.GetPV()) + - fmt.Sprintf("PVR=%s\n", pkg.GetPVR()) + - string(content) + fmt.Sprintf("PVR=%s\n", pkg.GetPVR()) - file, err := syntax.NewParser(syntax.StopAt("src")).Parse(strings.NewReader(ebuild), path) + // Disable inherit + scontent = strings.ReplaceAll(scontent, "inherit", "#inherit") + // Disable function from eclass (TODO: check how fix better this) + scontent = strings.ReplaceAll(scontent, "need_apache", "#need_apache") + scontent = strings.ReplaceAll(scontent, "want_apache", "#want_apache") + + regexFuncs := regexp.MustCompile( + "[a-zA-Z]+.*[_][a-z]+[(][)][\\s]{", + ) + matches := regexFuncs.FindAllIndex([]byte(scontent), -1) + // Drop section after functions (src_*, *() {) + if len(matches) > 0 { + ebuild = ebuild + scontent[:matches[0][0]] + } else { + ebuild = ebuild + scontent + } + + // [[ ${PV} == "9999" ]] is not supported. Workaround but we need a better solution. + regexDoubleBrakets := regexp.MustCompile( + //"[[][[].*", + "^[[][[].*", + //"^.*\[\[.*\]\]", + ) + matchDB := regexDoubleBrakets.FindAllIndex([]byte(ebuild), -1) + if len(matchDB) > 0 { + ebuild = ebuild[:matchDB[0][0]] + "#" + ebuild[matchDB[0][0]:] + } + + //fmt.Println("EBUILD ", ebuild) + + file, err := syntax.NewParser().Parse(strings.NewReader(ebuild), path) if err != nil { return nil, fmt.Errorf("could not parse: %v", err) } @@ -263,17 +339,18 @@ func (ep *SimpleEbuildParser) ScanEbuild(path string) ([]pkg.Package, error) { Name: gp.Name, Version: fmt.Sprintf("%s%s", gp.Version, gp.VersionSuffix), Category: gp.Category, + Uri: make([]string, 0), } - Debug("Prepare package ", pack) + Debug("Prepare package ", pack.Category+"/"+pack.Name+"-"+pack.Version) // Adding a timeout of 60secs, as with some bash files it can hang indefinetly timeout, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel() vars, err := SourceFile(timeout, path, gp) if err != nil { - return []pkg.Package{pack}, nil - // return []pkg.Package{}, err + Error("Error on source file ", pack.Name, ": ", err) + return []pkg.Package{}, err } // TODO: Handle this a bit better @@ -285,10 +362,49 @@ func (ep *SimpleEbuildParser) ScanEbuild(path string) ([]pkg.Package, error) { } } + // Retrieve package description + descr, ok := vars["DESCRIPTION"] + if ok { + pack.SetDescription(descr.String()) + } + // Retrieve package license + license, ok := vars["LICENSE"] + if ok { + pack.SetLicense(license.String()) + } + uri, ok := vars["SRC_URI"] + if ok { + // TODO: handle mirror: + uris := strings.Split(uri.String(), "\n") + for _, u := range uris { + u = strings.TrimSpace(u) + + if u == "" { + continue + } + if match, _ := regexp.Match(uriRegex, []byte(u)); match { + if strings.Index(u, "(") >= 0 { + regexUri := regexp.MustCompile("(http|ftp|mirror).*[ ]") + matches := regexUri.FindAllIndex([]byte(u), -1) + if len(matches) > 0 { + u = u[matches[0][0]:matches[0][1]] + } else { + continue + } + } + pack.AddURI(u) + Debug("Add uri ", u) + } else { + Debug("Skip uri ", u) + } + } + } + rdepend, ok := vars["RDEPEND"] if ok { gRDEPEND, err := ParseRDEPEND(rdepend.String()) if err != nil { + Warning("Error on parsing RDEPEND for package ", pack.Category+"/"+pack.Name, err) return []pkg.Package{pack}, nil // return []pkg.Package{}, err } diff --git a/pkg/tree/recipes_test.go b/pkg/tree/recipes_test.go index 7240421b..af05ca69 100644 --- a/pkg/tree/recipes_test.go +++ b/pkg/tree/recipes_test.go @@ -120,7 +120,7 @@ var _ = Describe("Recipe", func() { s := solver.NewSolver(pkg.NewInMemoryDatabase(false), tree, tree) solution, err := s.Install([]pkg.Package{pack}) Expect(err).ToNot(HaveOccurred()) - Expect(len(solution)).To(Equal(10)) + Expect(len(solution)).To(Equal(33)) var allSol string for _, sol := range solution { diff --git a/tests/fixtures/parser/calamares-sabayon-base-modules-1.15.ebuild b/tests/fixtures/parser/calamares-sabayon-base-modules-1.15.ebuild new file mode 100644 index 00000000..bd3ac825 --- /dev/null +++ b/tests/fixtures/parser/calamares-sabayon-base-modules-1.15.ebuild @@ -0,0 +1,25 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +DESCRIPTION="Sabayon Official Calamares base modules" +HOMEPAGE="http://www.sabayon.org/" +SRC_URI="https://github.com/Sabayon/calamares-sabayon/archive/v${PV}.tar.gz -> ${P}.tar.gz" +LICENSE="CC-BY-SA-4.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="app-admin/calamares[networkmanager,upower]" +RDEPEND="${DEPEND} + >=sys-kernel/dracut-049" + +S="${WORKDIR}/calamares-sabayon-${PV}" + +src_install() { + insinto "/etc/calamares/" + doins -r "${FILESDIR}/modules-conf/"* + insinto "/usr/lib/calamares/modules/" + doins -r "${S}/"* +} diff --git a/tests/fixtures/parser/kodi-raspberrypi-16.0.ebuild b/tests/fixtures/parser/kodi-raspberrypi-16.0.ebuild new file mode 100644 index 00000000..8bc39624 --- /dev/null +++ b/tests/fixtures/parser/kodi-raspberrypi-16.0.ebuild @@ -0,0 +1,265 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="5" + +# Does not work with py3 here +# It might work with py:2.5 but I didn't test that +PYTHON_COMPAT=( python2_7 ) +PYTHON_REQ_USE="sqlite" + +inherit eutils linux-info python-single-r1 multiprocessing autotools systemd + +CODENAME="Jarvis" +case ${PV} in +9999) + EGIT_REPO_URI="git://github.com/xbmc/xbmc.git" + inherit git-r3 + ;; +*|*_p*) + MY_PV=${PV/_p/_r} + MY_P="kodi-${MY_PV}" + SRC_URI="http://mirrors.kodi.tv/releases/source/${MY_PV}-${CODENAME}.tar.gz -> ${P}.tar.gz + https://github.com/xbmc/xbmc/archive/${PV}-${CODENAME}.tar.gz -> ${P}.tar.gz + !java? ( http://mirrors.kodi.tv/releases/source/${MY_P}-generated-addons.tar.xz )" + KEYWORDS="~arm" + S=${WORKDIR}/xbmc-${PV}-${CODENAME} + ;; +esac + +DESCRIPTION="Kodi is a free and open source media-player and entertainment hub" +HOMEPAGE="http://kodi.tv/ http://kodi.wiki/" + +LICENSE="GPL-2" +SLOT="0" +IUSE="airplay +alsa avahi bluetooth bluray caps +cec css dbus debug java joystick midi mysql +nfs profile -projectm pulseaudio rtmp +samba sftp test +texturepacker udisks upnp upower +usb vaapi vdpau webserver -X" +REQUIRED_USE=" + udisks? ( dbus ) + upower? ( dbus ) +" + +COMMON_DEPEND="${PYTHON_DEPS} + app-arch/bzip2 + app-arch/unzip + app-arch/zip + app-i18n/enca + airplay? ( app-pda/libplist ) + dev-libs/boost + dev-libs/expat + dev-libs/fribidi + dev-libs/libcdio[-minimal] + cec? ( >=dev-libs/libcec-3.0 ) + dev-libs/libpcre[cxx] + dev-libs/libxml2 + sys-apps/lsb-release + dev-libs/libxslt + >=dev-libs/lzo-2.04 + dev-libs/tinyxml[stl] + dev-libs/yajl + dev-python/simplejson[${PYTHON_USEDEP}] + media-fonts/corefonts + media-fonts/roboto + alsa? ( media-libs/alsa-lib ) + media-libs/flac + media-libs/fontconfig + media-libs/freetype + media-libs/jasper + x11-apps/xrefresh + media-libs/jbigkit + >=media-libs/libass-0.9.7 + net-libs/libssh + bluray? ( >=media-libs/libbluray-0.7.0 ) + css? ( media-libs/libdvdcss ) + media-libs/libmad + media-libs/libmodplug + media-libs/libmpeg2 + media-libs/libogg + media-libs/libpng:0= + media-libs/libsamplerate + joystick? ( media-libs/libsdl2 ) + >=media-libs/taglib-1.8 + media-libs/libvorbis + media-libs/tiff:0= + media-sound/dcadec + pulseaudio? ( media-sound/pulseaudio ) + media-sound/wavpack + media-video/omxplayer + rtmp? ( media-video/rtmpdump ) + avahi? ( net-dns/avahi ) + nfs? ( net-fs/libnfs:= ) + webserver? ( net-libs/libmicrohttpd[messages] ) + sftp? ( net-libs/libssh[sftp] ) + net-misc/curl + samba? ( >=net-fs/samba-3.4.6[smbclient(+)] ) + bluetooth? ( net-wireless/bluez ) + dbus? ( sys-apps/dbus ) + caps? ( sys-libs/libcap ) + sys-libs/zlib + virtual/jpeg:0= + usb? ( virtual/libusb:1 ) + mysql? ( virtual/mysql ) + media-libs/mesa[gles2] + vaapi? ( x11-libs/libva[opengl] ) + vdpau? ( + || ( >=x11-libs/libvdpau-1.1 >=x11-drivers/nvidia-drivers-180.51 ) + ) + X? ( + x11-apps/xdpyinfo + x11-apps/mesa-progs + x11-libs/libXinerama + x11-libs/libXrandr + x11-libs/libXrender + )" +RDEPEND="${COMMON_DEPEND} + !media-tv/xbmc + !media-tv/kodi + udisks? ( sys-fs/udisks:0 ) + upower? ( || ( sys-power/upower sys-power/upower-pm-utils ) )" +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + dev-lang/swig + media-video/ffmpeg + dev-libs/crossguid + dev-util/gperf + X? ( x11-proto/xineramaproto ) + dev-util/cmake + x86? ( dev-lang/nasm ) + java? ( virtual/jre ) + test? ( dev-cpp/gtest ) + virtual/pkgconfig" +# Force java for latest git version to avoid having to hand maintain the +# generated addons package. #488118 +[[ ${PV} == "9999" ]] && DEPEND+=" virtual/jre" + +CONFIG_CHECK="~IP_MULTICAST" +ERROR_IP_MULTICAST=" +In some cases Kodi needs to access multicast addresses. +Please consider enabling IP_MULTICAST under Networking options. +" + +pkg_setup() { + check_extra_config + python-single-r1_pkg_setup +} + +src_unpack() { + [[ ${PV} == "9999" ]] && git-r3_src_unpack || default +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-9999-no-arm-flags.patch #400617 + epatch "${FILESDIR}"/${PN}-9999-texturepacker.patch + epatch "${FILESDIR}"/${PN}-16-ffmpeg3.patch + + # some dirs ship generated autotools, some dont + multijob_init + local d dirs=( + tools/depends/native/TexturePacker/src/configure + $(printf 'f:\n\t@echo $(BOOTSTRAP_TARGETS)\ninclude bootstrap.mk\n' | emake -f - f) + ) + for d in "${dirs[@]}" ; do + [[ -e ${d} ]] && continue + pushd ${d/%configure/.} >/dev/null || die + AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" \ + multijob_child_init eautoreconf + popd >/dev/null + done + multijob_finish + elibtoolize + + [[ ${PV} == "9999" ]] && emake -f codegenerator.mk + + # Disable internal func checks as our USE/DEPEND + # stuff handles this just fine already #408395 + export ac_cv_lib_avcodec_ff_vdpau_vc1_decode_picture=yes + + # Fix the final version string showing as "exported" + # instead of the SVN revision number. + export HAVE_GIT=no GIT_REV=${EGIT_VERSION:-exported} + + # avoid long delays when powerkit isn't running #348580 + sed -i \ + -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \ + xbmc/linux/*.cpp || die + + epatch_user #293109 + + # Tweak autotool timestamps to avoid regeneration + find . -type f -exec touch -r configure {} + +} + +src_configure() { + # Disable documentation generation + export ac_cv_path_LATEX=no + # Avoid help2man + export HELP2MAN=$(type -P help2man || echo true) + # No configure flage for this #403561 + export ac_cv_lib_bluetooth_hci_devid=$(usex bluetooth) + # Requiring java is asine #434662 + [[ ${PV} != "9999" ]] && export ac_cv_path_JAVA_EXE=$(which $(usex java java true)) + + econf \ + --docdir=/usr/share/doc/${PF} \ + --disable-gl \ + --enable-gles \ + --with-platform=raspberry-pi \ + --disable-sdl \ + --enable-optimizations \ + --disable-x11 \ + --disable-goom \ + --disable-xrandr \ + --disable-mid \ + --enable-nfs \ + --disable-profiling \ + --enable-rsxs \ + --disable-debug \ + --disable-joystick \ + --disable-vaapi \ + --disable-vdpau \ + --disable-avahi \ + --enable-libcec \ + --disable-pulse \ + --disable-projectm \ + --disable-optical-drive \ + --disable-dvdcss \ + --disable-vtbdecoder \ + --enable-alsa \ + --enable-player=omxplayer +} + +src_compile() { + emake V=1 +} + +src_install() { + default + rm "${ED}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}* || die + + domenu tools/Linux/kodi.desktop + newicon media/icon48x48.png kodi.png + + insinto /etc/udev/rules.d + newins "${FILESDIR}/99-input.rules" 99-input.rules + + # Remove fonconfig settings that are used only on MacOSX. + # Can't be patched upstream because they just find all files and install + # them into same structure like they have in git. + rm -rf "${ED}"/usr/share/kodi/system/players/dvdplayer/etc + + # Replace bundled fonts with system ones + # teletext.ttf: unknown + # bold-caps.ttf: unknown + # roboto: roboto-bold, roboto-regular + # arial.ttf: font mashed from droid/roboto, not removed wrt bug#460514 + rm -rf "${ED}"/usr/share/kodi/addons/skin.confluence/fonts/Roboto-* || die + dosym /usr/share/fonts/roboto/Roboto-Regular.ttf \ + /usr/share/kodi/addons/skin.confluence/fonts/Roboto-Regular.ttf + dosym /usr/share/fonts/roboto/Roboto-Bold.ttf \ + /usr/share/kodi/addons/skin.confluence/fonts/Roboto-Bold.ttf + + python_domodule tools/EventClients/lib/python/xbmcclient.py + python_newscript "tools/EventClients/Clients/Kodi Send/kodi-send.py" kodi-send + dobin "${FILESDIR}"/startkodi + systemd_dounit "${FILESDIR}"/${PN}.service + +} diff --git a/tests/fixtures/parser/libreoffice-l10n-meta-6.2.8.2.ebuild b/tests/fixtures/parser/libreoffice-l10n-meta-6.2.8.2.ebuild new file mode 100644 index 00000000..a88cd697 --- /dev/null +++ b/tests/fixtures/parser/libreoffice-l10n-meta-6.2.8.2.ebuild @@ -0,0 +1,32 @@ +# Copyright 2004-2008 Sabayon Linux +# Distributed under the terms of the GNU General Public License v2 + +EAPI=4 + +DESCRIPTION="LibreOffice.org localisation meta-package" +HOMEPAGE="http://www.documentfoundation.org" +LICENSE="LGPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +SRC_URI="" +RDEPEND="" +DEPEND="" +IUSE="" + +SPELL_DIRS="af bg ca cs cy da de el en eo es et fo fr ga gl he hr hu ia id it \ +lt lv mi mk nb nl pl pt ro ru sk sl sv sw tn uk zu" + +LANGS="af am ar as ast be bg bn bo br brx bs ca cs cy da de dgo dz el \ +en_GB en_US en_ZA eo es et eu fa fi fr ga gd gl gu gug he hi hr hu id is it ja ka kk km kn \ +ko kok ks lb lo lt lv mai mk ml mn mni mr my nb ne nl nn nr nso oc om or pa_IN \ +pl pt pt_BR ro ru rw sa_IN sat sd si sid sk sl sq sr ss st sv sw_TZ ta te tg \ +th tn tr ts tt ug uk uz ve vi xh zh_CN zh_TW zu" + +for X in ${LANGS}; do + IUSE+=" linguas_${X}" + RDEPEND+=" linguas_${X}? ( ~app-office/libreoffice-l10n-${X}-${PV} )" +done +for X in ${SPELL_DIRS}; do + IUSE+=" linguas_${X}" + RDEPEND+=" linguas_${X}? ( app-dicts/myspell-${X} )" +done diff --git a/tests/fixtures/parser/linux-sources-1.ebuild b/tests/fixtures/parser/linux-sources-1.ebuild new file mode 100644 index 00000000..dfe872e3 --- /dev/null +++ b/tests/fixtures/parser/linux-sources-1.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=2 + +DESCRIPTION="Virtual for Linux kernel sources" +HOMEPAGE="" +SRC_URI="" + +LICENSE="" +SLOT="0" +KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~x86" +IUSE="firmware" + +SABAYON_SOURCES="sys-kernel/sabayon-sources + sys-kernel/server-sources + sys-kernel/rt-sources + sys-kernel/efikamx-sources + sys-kernel/odroid-sources + sys-kernel/beagle-sources + sys-kernel/beaglebone-sources" + +DEPEND="firmware? ( sys-kernel/linux-firmware )" +RDEPEND="|| ( + ${SABAYON_SOURCES} + sys-kernel/gentoo-sources + sys-kernel/vanilla-sources + sys-kernel/ck-sources + sys-kernel/git-sources + sys-kernel/hardened-sources + sys-kernel/mips-sources + sys-kernel/openvz-sources + sys-kernel/pf-sources + sys-kernel/rsbac-sources + sys-kernel/sparc-sources + sys-kernel/tuxonice-sources + sys-kernel/usermode-sources + sys-kernel/vserver-sources + sys-kernel/xbox-sources + sys-kernel/xen-sources + sys-kernel/zen-sources + )" diff --git a/tests/fixtures/parser/mod_dav_svn-1.12.2.ebuild b/tests/fixtures/parser/mod_dav_svn-1.12.2.ebuild new file mode 100644 index 00000000..611b2922 --- /dev/null +++ b/tests/fixtures/parser/mod_dav_svn-1.12.2.ebuild @@ -0,0 +1,298 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +WANT_AUTOMAKE="none" +MY_P="${P/_/-}" + +MY_SVN_PN="subversion" +MY_SVN_P="${MY_SVN_PN}-${PV}" +MY_SVN_PF="${MY_SVN_PN}-${PVR}" + +inherit autotools db-use depend.apache flag-o-matic libtool multilib xdg-utils + +DESCRIPTION="Subversion WebDAV support" +HOMEPAGE="https://subversion.apache.org/" +SRC_URI="mirror://apache/${MY_SVN_PN}/${MY_SVN_P}.tar.bz2 + https://dev.gentoo.org/~polynomial-c/${MY_SVN_PN}-1.10.0_rc1-patches-1.tar.xz" +S="${WORKDIR}/${MY_SVN_P}" + +LICENSE="Subversion" +SLOT="0" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="berkdb debug +dso nls sasl" +# w/o: ctypes-python doc extras gnome-keyring java kde perl python ruby +# test vim-syntax; implicit: apache2, http + +# This is an ebuild that provides mod_dav_svn and friends (it does more or +# less the same as when USE="apache2 http" is added to dev-vcs/subversion - basically +# provides three Apache modules and a configuration file), suitable for binary +# packages. +# Some flags in IUSE and their handling are only used to enforce the code be +# compiled sufficiently the same way Subversion itself was - extra carefulness. +# In the process of building libraries for WebDAV, a few unused libraries are +# also built (not the whole Subversion, though, which is a win). Some build +# time dependencies here are just for them. + +# If you are building it for yourself, you don't need it. +# USE=apache2 emerge dev-vcs/subversion will do what you want. +# However, you can use this ebuild too. + +# variable specific to www-apache/mod_dav_svn +MY_CDEPS=" + ~dev-vcs/subversion-${PV}[berkdb=,debug=,dso=,nls=,sasl=,http] + app-arch/bzip2 + app-arch/lz4 + >=dev-db/sqlite-3.7.12 + >=dev-libs/apr-1.3:1 + >=dev-libs/apr-util-1.3:1 + dev-libs/expat + dev-libs/libutf8proc:= + sys-apps/file + sys-libs/zlib + berkdb? ( >=sys-libs/db-4.0.14:= ) +" + +DEPEND="${MY_CDEPS} + >=net-libs/serf-1.3.4 + sasl? ( dev-libs/cyrus-sasl ) + virtual/pkgconfig + !!/dev/null)")" + einfo "SVN_BDB_VERSION variable isn't set. You can set it to enforce using of specific version of Berkeley DB." + fi + fi + einfo "Using: Berkeley DB ${SVN_BDB_VERSION}" + einfo + + if [[ -n "${apu_bdb_version}" && "${SVN_BDB_VERSION}" != "${apu_bdb_version}" ]]; then + eerror "APR-Util is linked against Berkeley DB ${apu_bdb_version}, but you are trying" + eerror "to build Subversion with support for Berkeley DB ${SVN_BDB_VERSION}." + eerror "Rebuild dev-libs/apr-util or set SVN_BDB_VERSION=\"${apu_bdb_version}\"." + eerror "Aborting to avoid possible run-time crashes." + die "Berkeley DB version mismatch" + fi + fi + + # depend.apache_pkg_setup + + # https://issues.apache.org/jira/browse/SVN-4813#comment-16813739 + append-cppflags -P + + if use debug ; then + append-cppflags -DSVN_DEBUG -DAP_DEBUG + fi + + # http://mail-archives.apache.org/mod_mbox/subversion-dev/201306.mbox/%3C51C42014.3060700@wandisco.com%3E + [[ ${CHOST} == *-solaris2* ]] && append-cppflags -D__EXTENSIONS__ + + # Allow for custom repository locations. + SVN_REPOS_LOC="${SVN_REPOS_LOC:-${EPREFIX}/var/svn}" +} + +src_prepare() { + eapply "${WORKDIR}/patches" + eapply_user + + chmod +x build/transform_libtool_scripts.sh || die + + sed -i \ + -e "s/\(BUILD_RULES=.*\) bdb-test\(.*\)/\1\2/g" \ + -e "s/\(BUILD_RULES=.*\) test\(.*\)/\1\2/g" configure.ac + + # this bites us in particular on Solaris + sed -i -e '1c\#!/usr/bin/env sh' build/transform_libtool_scripts.sh || \ + die "/bin/sh is not POSIX shell!" + + eautoconf + elibtoolize + + #sed -e 's/\(libsvn_swig_py\)-\(1\.la\)/\1-$(EPYTHON)-\2/g' \ + #-i build-outputs.mk || die "sed failed" + + xdg_environment_reset +} + +src_configure() { + local myconf=( + --libdir="${EPREFIX%/}/usr/$(get_libdir)" + --with-apache-libexecdir + --with-apxs="${EPREFIX}"/usr/bin/apxs + $(use_with berkdb berkeley-db "db.h:${EPREFIX%/}/usr/include/db${SVN_BDB_VERSION}::db-${SVN_BDB_VERSION}") + --without-ctypesgen + $(use_enable dso runtime-module-search) + --without-gnome-keyring + --disable-javahl + --without-jdk + --without-kwallet + $(use_enable nls) + $(use_with sasl) + --with-serf + --with-apr="${EPREFIX%/}/usr/bin/apr-1-config" + --with-apr-util="${EPREFIX%/}/usr/bin/apu-1-config" + --disable-experimental-libtool + --without-jikes + --disable-mod-activation + --disable-static + --enable-svnxx + ) + + #use python || use perl || use ruby + myconf+=( --without-swig ) + + #use java + myconf+=( --without-junit ) + + case ${CHOST} in + *-aix*) + # avoid recording immediate path to sharedlibs into executables + append-ldflags -Wl,-bnoipath + ;; + *-cygwin*) + # no LD_PRELOAD support, no undefined symbols + myconf+=( --disable-local-library-preloading LT_LDFLAGS=-no-undefined ) + ;; + *-interix*) + # loader crashes on the LD_PRELOADs... + myconf+=( --disable-local-library-preloading ) + ;; + *-solaris*) + # need -lintl to link + use nls && append-libs intl + # this breaks installation, on x64 echo replacement is 32-bits + myconf+=( --disable-local-library-preloading ) + ;; + *-mint*) + myconf+=( --enable-all-static --disable-local-library-preloading ) + ;; + *) + # inject LD_PRELOAD entries for easy in-tree development + myconf+=( --enable-local-library-preloading ) + ;; + esac + + #workaround for bug 387057 + has_version =dev-vcs/subversion-1.6* && myconf+=( --disable-disallowing-of-undefined-references ) + + #version 1.7.7 again tries to link against the older installed version and fails, when trying to + #compile for x86 on amd64, so workaround this issue again + #check newer versions, if this is still/again needed + #myconf+=( --disable-disallowing-of-undefined-references ) + + # allow overriding Python include directory + #ac_cv_path_RUBY=$(usex ruby "${EPREFIX%/}/usr/bin/ruby${RB_VER}" "none") + #ac_cv_path_RDOC=(usex ruby "${EPREFIX%/}/usr/bin/rdoc${RB_VER}" "none") + ac_cv_python_includes='-I$(PYTHON_INCLUDEDIR)' \ + econf "${myconf[@]}" +} + +src_compile() { + emake apache-mod +} + +src_install() { + emake DESTDIR="${D}" install-mods-shared + + # Install Apache module configuration. + #use apache2 + keepdir "${APACHE_MODULES_CONFDIR}" + insinto "${APACHE_MODULES_CONFDIR}" + doins "${FILESDIR}/47_mod_dav_svn.conf" +} + +pkg_preinst() { + # Compare versions of Berkeley DB, bug 122877. + if use berkdb && [[ -f "${EROOT}/usr/bin/svn" ]] ; then + OLD_BDB_VERSION="$(scanelf -nq "${EROOT}/usr/$(get_libdir)/libsvn_subr-1$(get_libname 0)" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")" + NEW_BDB_VERSION="$(scanelf -nq "${ED%/}/usr/$(get_libdir)/libsvn_subr-1$(get_libname 0)" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")" + if [[ "${OLD_BDB_VERSION}" != "${NEW_BDB_VERSION}" ]] ; then + CHANGED_BDB_VERSION="1" + fi + fi +} + +pkg_postinst() { + if [[ -n "${CHANGED_BDB_VERSION}" ]] ; then + ewarn "You upgraded from an older version of Berkeley DB and may experience" + ewarn "problems with your repository. Run the following commands as root to fix it:" + ewarn " db4_recover -h ${SVN_REPOS_LOC}/repos" + ewarn " chown -Rf apache:apache ${SVN_REPOS_LOC}/repos" + fi + + #ewarn "If you run subversion as a daemon, you will need to restart it to avoid module mismatches." + + # from src_install in Gentoo ebuild: + ##adjust default user and group with disabled apache2 USE flag, bug 381385 + #use apache2 || sed -e "s\USER:-apache\USER:-svn\g" \ + # -e "s\GROUP:-apache\GROUP:-svnusers\g" \ + # -i "${ED}"etc/init.d/svnserve || die + #use apache2 || sed -e "0,/apache/s//svn/" \ + # -e "s:apache:svnusers:" \ + # -i "${ED}"etc/xinetd.d/svnserve || die + # We need to address it here with a message (when Subversion ebuild is + # intented to be build with USE=-apache2). + # Also, user doesn't need to tweak init.d script - user and group can + # be changed in conf.d. + elog "svnserve users: You may want to change user and group in /etc/conf.d/svnserve" + elog "and /etc/xinetd.d/svnserve from current svn:svnusers to apache:apache," + elog "especially if you want to make use of emerge --config ${CATEGORY}/${PN}" + elog "and its default ownership settings." +} + +#pkg_postrm() + +pkg_config() { + # Remember: Don't use ${EROOT}${SVN_REPOS_LOC} since ${SVN_REPOS_LOC} + # already has EPREFIX in it + einfo "Initializing the database in ${SVN_REPOS_LOC}..." + if [[ -e "${SVN_REPOS_LOC}/repos" ]] ; then + echo "A Subversion repository already exists and I will not overwrite it." + echo "Delete \"${SVN_REPOS_LOC}/repos\" first if you're sure you want to have a clean version." + else + mkdir -p "${SVN_REPOS_LOC}/conf" + + einfo "Populating repository directory..." + # Create initial repository. + "${EROOT}/usr/bin/svnadmin" create "${SVN_REPOS_LOC}/repos" + + einfo "Setting repository permissions..." + SVNSERVE_USER="$(. "${EROOT}/etc/conf.d/svnserve"; echo "${SVNSERVE_USER}")" + SVNSERVE_GROUP="$(. "${EROOT}/etc/conf.d/svnserve"; echo "${SVNSERVE_GROUP}")" + #use apache2 + [[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="apache" + [[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="apache" + #use !apache2 + #[[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="svn" + #[[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="svnusers" + + chmod -Rf go-rwx "${SVN_REPOS_LOC}/conf" + chmod -Rf o-rwx "${SVN_REPOS_LOC}/repos" + echo "Please create \"${SVNSERVE_GROUP}\" group if it does not exist yet." + echo "Afterwards please create \"${SVNSERVE_USER}\" user with homedir \"${SVN_REPOS_LOC}\"" + echo "and as part of the \"${SVNSERVE_GROUP}\" group if it does not exist yet." + echo "Finally, execute \"chown -Rf ${SVNSERVE_USER}:${SVNSERVE_GROUP} ${SVN_REPOS_LOC}/repos\"" + echo "to finish the configuration." + fi +} diff --git a/tests/fixtures/parser/pkgs-checker-0.2.0.ebuild b/tests/fixtures/parser/pkgs-checker-0.2.0.ebuild new file mode 100644 index 00000000..500296e5 --- /dev/null +++ b/tests/fixtures/parser/pkgs-checker-0.2.0.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +EGO_PN="github.com/Sabayon/${PN}" +S="${WORKDIR}/${P}/src/${EGO_PN}" + +if [[ ${PV} == *9999 ]]; then + inherit golang-vcs +else +# SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64" + RESTRICT="mirror" + inherit golang-vcs git-r3 + EGIT_REPO_URI="https://${EGO_PN}" + EGIT_COMMIT="1ede3280570fd9aec9af1e5df1990797996510ab" + EGIT_CHECKOUT_DIR="${S}" +fi + +inherit golang-build user systemd +DESCRIPTION="Sabayon Packages Checker" +HOMEPAGE="https://github.com/Sabayon/pkgs-checker" + +LICENSE="GPL-3" +SLOT="0" +IUSE="systemd" +DEPEND="" +RDEPEND="" + +src_install() { + dobin pkgs-checker +} + diff --git a/tests/fixtures/parser/sabayon-mce-1.1-r5.ebuild b/tests/fixtures/parser/sabayon-mce-1.1-r5.ebuild new file mode 100644 index 00000000..4c67d837 --- /dev/null +++ b/tests/fixtures/parser/sabayon-mce-1.1-r5.ebuild @@ -0,0 +1,54 @@ +# Copyright 2004-2013 Sabayon +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +inherit eutils systemd + +DESCRIPTION="Sabayon Linux Media Center Infrastructure" +HOMEPAGE="http://www.sabayon.org/" +SRC_URI="" + +RESTRICT="nomirror" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 arm x86" +IUSE="" + +RDEPEND="media-tv/kodi app-misc/sabayon-live" +DEPEND="" + +S="${WORKDIR}" + +src_install () { + local dir="${FILESDIR}/${PV}" + + doinitd "${dir}/init.d/sabayon-mce" + systemd_dounit "${dir}"/systemd/* + + dodir /usr/bin + exeinto /usr/bin + doexe "${dir}"/bin/* + + dodir /usr/libexec + exeinto /usr/libexec + doexe "${dir}"/libexec/* + + dodir /usr/share/xsessions + insinto /usr/share/xsessions + doins "${dir}"/xsession/*.desktop +} + +pkg_postinst() { + # create new user sabayonmce + local mygroups="users" + local gr="lp wheel uucp audio cdrom scanner video " + gr+="cdrw usb plugdev polkituser" + + for mygroup in ${gr}; do + if [[ -n $(egetent group "${mygroup}") ]]; then + mygroups+=",${mygroup}" + fi + done + enewuser sabayonmce -1 /bin/sh /var/sabayonmce "${mygroups}" +} diff --git a/tests/fixtures/parser/subversion-1.12.0.ebuild b/tests/fixtures/parser/subversion-1.12.0.ebuild new file mode 100644 index 00000000..ffabb2c6 --- /dev/null +++ b/tests/fixtures/parser/subversion-1.12.0.ebuild @@ -0,0 +1,506 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 ) +USE_RUBY="ruby26 ruby25 ruby24" +DISTUTILS_OPTIONAL=1 +WANT_AUTOMAKE="none" +GENTOO_DEPEND_ON_PERL="no" + +inherit autotools bash-completion-r1 db-use depend.apache distutils-r1 elisp-common flag-o-matic libtool multilib perl-module ruby-single xdg-utils + +MY_P="${P/_/-}" +DESCRIPTION="Advanced version control system" +HOMEPAGE="https://subversion.apache.org/" +SRC_URI="mirror://apache/${PN}/${MY_P}.tar.bz2 + https://dev.gentoo.org/~polynomial-c/${PN}-1.10.0_rc1-patches-1.tar.xz" +S="${WORKDIR}/${MY_P}" + +LICENSE="Subversion GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~x86" + +IUSE="apache2 berkdb ctypes-python debug doc +dso extras gnome-keyring +http java kwallet nls perl python ruby sasl test vim-syntax" + +COMMON_DEPEND=" + app-arch/bzip2 + app-arch/lz4 + >=dev-db/sqlite-3.7.12 + >=dev-libs/apr-1.3:1 + >=dev-libs/apr-util-1.3:1 + dev-libs/expat + dev-libs/libutf8proc:= + sys-apps/file + sys-libs/zlib + berkdb? ( >=sys-libs/db-4.0.14:= ) + ctypes-python? ( ${PYTHON_DEPS} ) + gnome-keyring? ( + dev-libs/glib:2 + gnome-base/libgnome-keyring + sys-apps/dbus + ) + http? ( >=net-libs/serf-1.3.4 ) + kwallet? ( + dev-qt/qtcore:5 + dev-qt/qtdbus:5 + dev-qt/qtgui:5 + kde-frameworks/kcoreaddons:5 + kde-frameworks/ki18n:5 + kde-frameworks/kwallet:5 + sys-apps/dbus + ) + perl? ( dev-lang/perl:= ) + python? ( ${PYTHON_DEPS} ) + ruby? ( ${RUBY_DEPS} ) + sasl? ( dev-libs/cyrus-sasl )" +RDEPEND="${COMMON_DEPEND} + apache2? ( www-servers/apache[apache2_modules_dav] ) + nls? ( virtual/libintl ) + perl? ( dev-perl/URI )" +# Note: ctypesgen doesn't need PYTHON_USEDEP, it's used once +DEPEND="${COMMON_DEPEND} + !!/dev/null)")" + einfo "SVN_BDB_VERSION variable isn't set. You can set it to enforce using of specific version of Berkeley DB." + fi + fi + einfo "Using: Berkeley DB ${SVN_BDB_VERSION}" + einfo + + if [[ -n "${apu_bdb_version}" && "${SVN_BDB_VERSION}" != "${apu_bdb_version}" ]]; then + eerror "APR-Util is linked against Berkeley DB ${apu_bdb_version}, but you are trying" + eerror "to build Subversion with support for Berkeley DB ${SVN_BDB_VERSION}." + eerror "Rebuild dev-libs/apr-util or set SVN_BDB_VERSION=\"${apu_bdb_version}\"." + eerror "Aborting to avoid possible run-time crashes." + die "Berkeley DB version mismatch" + fi + fi + + depend.apache_pkg_setup + + if ! use http ; then + ewarn "WebDAV support is disabled. You need WebDAV to" + ewarn "access repositories through the HTTP protocol." + ewarn "Consider enabling \"http\" USE flag" + echo -ne "\a" + fi + + # https://issues.apache.org/jira/browse/SVN-4813#comment-16813739 + append-cppflags -P + + if use debug ; then + append-cppflags -DSVN_DEBUG -DAP_DEBUG + fi + + # http://mail-archives.apache.org/mod_mbox/subversion-dev/201306.mbox/%3C51C42014.3060700@wandisco.com%3E + [[ ${CHOST} == *-solaris2* ]] && append-cppflags -D__EXTENSIONS__ + + # Allow for custom repository locations. + SVN_REPOS_LOC="${SVN_REPOS_LOC:-${EPREFIX}/var/svn}" + + if use ruby ; then + local rbslot + RB_VER="" + for rbslot in $(sed 's@\([[:digit:]]\+\)\([[:digit:]]\)@\1.\2@g' <<< ${USE_RUBY//ruby}) ; do + if has_version dev-lang/ruby:${rbslot} ; then + RB_VER="${rbslot/.}" + break + fi + done + [[ -z "${RB_VER}" ]] && die "No useable ruby version found" + fi +} + +src_prepare() { + eapply "${WORKDIR}/patches" + eapply "${FILESDIR}"/${PN}-1.11.1-allow-apr-1.7.0+.patch + eapply_user + + fperms +x build/transform_libtool_scripts.sh + + sed -i \ + -e "s/\(BUILD_RULES=.*\) bdb-test\(.*\)/\1\2/g" \ + -e "s/\(BUILD_RULES=.*\) test\(.*\)/\1\2/g" configure.ac + + # this bites us in particular on Solaris + sed -i -e '1c\#!/usr/bin/env sh' build/transform_libtool_scripts.sh || \ + die "/bin/sh is not POSIX shell!" + + eautoconf + elibtoolize + + sed -e 's/\(libsvn_swig_py\)-\(1\.la\)/\1-$(EPYTHON)-\2/g' \ + -i build-outputs.mk || die "sed failed" + + if use python ; then + # XXX: make python_copy_sources accept path + S=${S}/subversion/bindings/swig/python python_copy_sources + rm -r "${S}"/subversion/bindings/swig/python || die + fi + + xdg_environment_reset +} + +src_configure() { + local myconf=( + --libdir="${EPREFIX%/}/usr/$(get_libdir)" + $(use_with apache2 apache-libexecdir) + $(use_with apache2 apxs "${EPREFIX}"/usr/bin/apxs) + $(use_with berkdb berkeley-db "db.h:${EPREFIX%/}/usr/include/db${SVN_BDB_VERSION}::db-${SVN_BDB_VERSION}") + $(use_with ctypes-python ctypesgen "${EPREFIX%/}/usr") + $(use_enable dso runtime-module-search) + $(use_with gnome-keyring) + --disable-javahl + $(use_with java jdk "${JAVA_HOME}") + $(use_with kwallet) + $(use_enable nls) + $(use_with sasl) + $(use_with http serf) + --with-apr="${EPREFIX%/}/usr/bin/apr-1-config" + --with-apr-util="${EPREFIX%/}/usr/bin/apu-1-config" + --disable-experimental-libtool + --without-jikes + --disable-mod-activation + --disable-static + --enable-svnxx + ) + + if use python || use perl || use ruby; then + myconf+=( --with-swig ) + else + myconf+=( --without-swig ) + fi + + case ${CHOST} in + *-aix*) + # avoid recording immediate path to sharedlibs into executables + append-ldflags -Wl,-bnoipath + ;; + *-cygwin*) + # no LD_PRELOAD support, no undefined symbols + myconf+=( --disable-local-library-preloading LT_LDFLAGS=-no-undefined ) + ;; + *-interix*) + # loader crashes on the LD_PRELOADs... + myconf+=( --disable-local-library-preloading ) + ;; + *-solaris*) + # need -lintl to link + use nls && append-libs intl + # this breaks installation, on x64 echo replacement is 32-bits + myconf+=( --disable-local-library-preloading ) + ;; + *-mint*) + myconf+=( --enable-all-static --disable-local-library-preloading ) + ;; + *) + # inject LD_PRELOAD entries for easy in-tree development + myconf+=( --enable-local-library-preloading ) + ;; + esac + + #version 1.7.7 again tries to link against the older installed version and fails, when trying to + #compile for x86 on amd64, so workaround this issue again + #check newer versions, if this is still/again needed + #myconf+=( --disable-disallowing-of-undefined-references ) + + # for build-time scripts + if use ctypes-python || use python || use test; then + python_setup + fi + + if use python && [[ ${CHOST} == *-darwin* ]] ; then + export ac_cv_python_link="$(tc-getCC) "'$(PYTHON_CFLAGS) -bundle -undefined dynamic_lookup $(PYTHON_LIBS)' + export ac_cv_python_libs='$(PYTHON_CFLAGS) -bundle -undefined dynamic_lookup $(PYTHON_LIBS)' + export ac_cv_python_compile="$(tc-getCC)" + fi + + # allow overriding Python include directory + ac_cv_path_RUBY=$(usex ruby "${EPREFIX%/}/usr/bin/ruby${RB_VER}" "none") \ + ac_cv_path_RDOC=$(usex ruby "${EPREFIX%/}/usr/bin/rdoc${RB_VER}" "none") \ + ac_cv_python_includes='-I$(PYTHON_INCLUDEDIR)' \ + econf "${myconf[@]}" +} + +src_compile() { + emake local-all + + if use ctypes-python ; then + # pre-generate .py files + use ctypes-python && emake ctypes-python + + pushd subversion/bindings/ctypes-python >/dev/null || die + distutils-r1_src_compile + popd >/dev/null || die + fi + + if use python ; then + swig_py_compile() { + local p=subversion/bindings/swig/python + rm -f ${p} || die + ln -s "${BUILD_DIR}" ${p} || die + + python_export PYTHON_INCLUDEDIR + emake swig-py \ + swig_pydir="$(python_get_sitedir)/libsvn" \ + swig_pydir_extra="$(python_get_sitedir)/svn" + } + + # this will give us proper BUILD_DIR for symlinking + BUILD_DIR=python \ + python_foreach_impl swig_py_compile + fi + + if use perl ; then + emake swig-pl + fi + + if use ruby ; then + emake swig-rb + fi + + if use extras ; then + emake tools + fi + + if use doc ; then + doxygen doc/doxygen.conf || die "Building of Subversion HTML documentation failed" + fi +} + +src_test() { + if has_version ~${CATEGORY}/${P} ; then + default + + if use ctypes-python ; then + python_test() { + "${PYTHON}" subversion/bindings/ctypes-python/test/run_all.py \ + || die "ctypes-python tests fail with ${EPYTHON}" + } + + distutils-r1_src_test + fi + + if use python ; then + swig_py_test() { + pushd "${BUILD_DIR}" >/dev/null || die + "${PYTHON}" tests/run_all.py || die "swig-py tests fail with ${EPYTHON}" + popd >/dev/null || die + } + + BUILD_DIR=subversion/bindings/swig/python \ + python_foreach_impl swig_py_test + fi + else + ewarn "The test suite shows errors when there is an older version of" + ewarn "${CATEGORY}/${PN} installed. Please install =${CATEGORY}/${P}*" + ewarn "before running the test suite." + ewarn "Test suite skipped." + fi +} + +src_install() { + emake -j1 DESTDIR="${D}" local-install + + if use ctypes-python ; then + pushd subversion/bindings/ctypes-python >/dev/null || die + distutils-r1_src_install + popd >/dev/null || die + fi + + if use python ; then + swig_py_install() { + local p=subversion/bindings/swig/python + rm -f ${p} || die + ln -s "${BUILD_DIR}" ${p} || die + + emake \ + DESTDIR="${D}" \ + swig_pydir="$(python_get_sitedir)/libsvn" \ + swig_pydir_extra="$(python_get_sitedir)/svn" \ + install-swig-py + } + + BUILD_DIR=python \ + python_foreach_impl swig_py_install + fi + + if use perl ; then + emake DESTDIR="${D}" INSTALLDIRS="vendor" install-swig-pl + perl_delete_localpod + find "${ED}" \( -name .packlist -o -name "*.bs" \) -delete || die + fi + + if use ruby ; then + emake DESTDIR="${D}" install-swig-rb + fi + + # Install Apache module configuration. + if use apache2 ; then + keepdir "${APACHE_MODULES_CONFDIR}" + insinto "${APACHE_MODULES_CONFDIR}" + doins "${FILESDIR}/47_mod_dav_svn.conf" + fi + + # Install Bash Completion, bug 43179. + newbashcomp tools/client-side/bash_completion svn + bashcomp_alias svn svn{admin,dumpfilter,look,sync,version} + rm -f tools/client-side/bash_completion + + # Install hot backup script, bug 54304. + newbin tools/backup/hot-backup.py svn-hot-backup + rm -fr tools/backup + + # Install svnserve init-script and xinet.d snippet, bug 43245. + newinitd "${FILESDIR}"/svnserve.initd3 svnserve + newconfd "${FILESDIR}"/svnserve.confd svnserve + insinto /etc/xinetd.d + newins "${FILESDIR}"/svnserve.xinetd svnserve + + #adjust default user and group with disabled apache2 USE flag, bug 381385 + if ! use apache2 ; then + sed -e "s\USER:-apache\USER:-svn\g" \ + -e "s\GROUP:-apache\GROUP:-svnusers\g" \ + -i "${ED%/}"/etc/init.d/svnserve || die + sed -e "0,/apache/s//svn/" \ + -e "s:apache:svnusers:" \ + -i "${ED%/}"/etc/xinetd.d/svnserve || die + fi + + # Install documentation. + dodoc CHANGES COMMITTERS README + dodoc tools/xslt/svnindex.{css,xsl} + rm -fr tools/xslt + + # Install extra files. + if use extras ; then + cat <<- EOF > 80subversion-extras + PATH="${EPREFIX}/usr/$(get_libdir)/subversion/bin" + ROOTPATH="${EPREFIX}/usr/$(get_libdir)/subversion/bin" + EOF + doenvd 80subversion-extras + + emake DESTDIR="${D}" toolsdir="/usr/$(get_libdir)/subversion/bin" install-tools + + find tools \( -name "*.bat" -o -name "*.in" -o -name ".libs" \) -print0 | xargs -0 rm -fr + rm -fr tools/client-side/svnmucc + rm -fr tools/server-side/{svn-populate-node-origins-index,svnauthz-validate}* + rm -fr tools/{buildbot,dev,diff,po} + + insinto /usr/share/${PN} + find tools -name '*.py' -exec sed -i -e '1s:python:&2:' {} + || die + doins -r tools + fi + + if use doc ; then + docinto html + dodoc -r doc/doxygen/html/* + fi + + prune_libtool_files --all + + cd "${ED%/}"/usr/share/locale + for i in * ; do + if [[ ${i} != *${LINGUAS}* ]] ; then + rm -r ${i} || die + fi + done +} + +pkg_preinst() { + # Compare versions of Berkeley DB, bug 122877. + if use berkdb && [[ -f "${EROOT}/usr/bin/svn" ]] ; then + OLD_BDB_VERSION="$(scanelf -nq "${EROOT}/usr/$(get_libdir)/libsvn_subr-1$(get_libname 0)" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")" + NEW_BDB_VERSION="$(scanelf -nq "${ED%/}/usr/$(get_libdir)/libsvn_subr-1$(get_libname 0)" | grep -Eo "libdb-[[:digit:]]+\.[[:digit:]]+" | sed -e "s/libdb-\(.*\)/\1/")" + if [[ "${OLD_BDB_VERSION}" != "${NEW_BDB_VERSION}" ]] ; then + CHANGED_BDB_VERSION="1" + fi + fi +} + +pkg_postinst() { + if [[ -n "${CHANGED_BDB_VERSION}" ]] ; then + ewarn "You upgraded from an older version of Berkeley DB and may experience" + ewarn "problems with your repository. Run the following commands as root to fix it:" + ewarn " db4_recover -h ${SVN_REPOS_LOC}/repos" + ewarn " chown -Rf apache:apache ${SVN_REPOS_LOC}/repos" + fi + + ewarn "If you run subversion as a daemon, you will need to restart it to avoid module mismatches." +} + +pkg_postrm() { + : +} + +pkg_config() { + # Remember: Don't use ${EROOT}${SVN_REPOS_LOC} since ${SVN_REPOS_LOC} + # already has EPREFIX in it + einfo "Initializing the database in ${SVN_REPOS_LOC}..." + if [[ -e "${SVN_REPOS_LOC}/repos" ]] ; then + echo "A Subversion repository already exists and I will not overwrite it." + echo "Delete \"${SVN_REPOS_LOC}/repos\" first if you're sure you want to have a clean version." + else + mkdir -p "${SVN_REPOS_LOC}/conf" + + einfo "Populating repository directory..." + # Create initial repository. + "${EROOT}/usr/bin/svnadmin" create "${SVN_REPOS_LOC}/repos" + + einfo "Setting repository permissions..." + SVNSERVE_USER="$(. "${EROOT}/etc/conf.d/svnserve"; echo "${SVNSERVE_USER}")" + SVNSERVE_GROUP="$(. "${EROOT}/etc/conf.d/svnserve"; echo "${SVNSERVE_GROUP}")" + if use apache2 ; then + [[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="apache" + [[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="apache" + else + [[ -z "${SVNSERVE_USER}" ]] && SVNSERVE_USER="svn" + [[ -z "${SVNSERVE_GROUP}" ]] && SVNSERVE_GROUP="svnusers" + fi + chmod -Rf go-rwx "${SVN_REPOS_LOC}/conf" + chmod -Rf o-rwx "${SVN_REPOS_LOC}/repos" + echo "Please create \"${SVNSERVE_GROUP}\" group if it does not exist yet." + echo "Afterwards please create \"${SVNSERVE_USER}\" user with homedir \"${SVN_REPOS_LOC}\"" + echo "and as part of the \"${SVNSERVE_GROUP}\" group if it does not exist yet." + echo "Finally, execute \"chown -Rf ${SVNSERVE_USER}:${SVNSERVE_GROUP} ${SVN_REPOS_LOC}/repos\"" + echo "to finish the configuration." + fi +} diff --git a/tests/fixtures/parser/tango-icon-theme-0.8.90-r1.ebuild b/tests/fixtures/parser/tango-icon-theme-0.8.90-r1.ebuild new file mode 100644 index 00000000..f646d2c9 --- /dev/null +++ b/tests/fixtures/parser/tango-icon-theme-0.8.90-r1.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=4 +SLREV=4 +inherit gnome2-utils + +DESCRIPTION="SVG and PNG icon theme from the Tango project" +HOMEPAGE="http://tango.freedesktop.org" +SRC_URI="http://tango.freedesktop.org/releases/${P}.tar.gz + branding? ( mirror://sabayon/x11-themes/fdo-icons-sabayon${SLREV}.tar.gz )" + +LICENSE="public-domain" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="branding minimal png" + +RDEPEND="!hppa? ( !minimal? ( x11-themes/adwaita-icon-theme ) ) + >=x11-themes/hicolor-icon-theme-0.12" +DEPEND="${RDEPEND} + dev-util/intltool + virtual/pkgconfig + >=gnome-base/librsvg-2.34 + virtual/imagemagick-tools[png?] + sys-devel/gettext + >=x11-misc/icon-naming-utils-0.8.90" + +RESTRICT="binchecks strip" + +DOCS="AUTHORS ChangeLog README" + +src_prepare() { + sed -i -e '/svgconvert_prog/s:rsvg:&-convert:' configure || die #413183 + + # https://bugs.gentoo.org/472766 + shopt -s nullglob + cards=$(echo -n /dev/dri/card* | sed 's/ /:/g') + if test -n "${cards}"; then + addpredict "${cards}" + fi + shopt -u nullglob +} + +src_configure() { + econf \ + $(use_enable png png-creation) \ + $(use_enable png icon-framing) +} + +src_install() { + addwrite /root/.gnome2 + default + + if use branding; then + # replace tango icon start-here.{png,svg} with Sabayon ones + for dir in "${D}"/usr/share/icons/Tango/*/places; do + base_dir=$(dirname "${dir}") + icon_dir=$(basename "${base_dir}") + sabayon_svg_file="${WORKDIR}"/fdo-icons-sabayon/scalable/places/start-here.svg + if [ "${icon_dir}" = "scalable" ]; then + cp "${sabayon_svg_file}" "${dir}/start-here.svg" || die + else + convert -background none -resize \ + "${icon_dir}" "${sabayon_svg_file}" \ + "${dir}/start-here.png" || die + fi + done + fi +} + +pkg_preinst() { gnome2_icon_savelist; } +pkg_postinst() { gnome2_icon_cache_update; } +pkg_postrm() { gnome2_icon_cache_update; }