public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/commandlineparser/, dev-dotnet/commandlineparser/files/
@ 2016-01-15 13:20 Heather Cynede
  0 siblings, 0 replies; only message in thread
From: Heather Cynede @ 2016-01-15 13:20 UTC (permalink / raw
  To: gentoo-commits

commit:     f4059f02fcc47b30e4fe1b20f3a8bf996a30b86f
Author:     ArsenShnurkov <Arsen.Shnurkov <AT> gmail <DOT> com>
AuthorDate: Fri Jan 15 13:08:34 2016 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Fri Jan 15 13:08:34 2016 +0000
URL:        https://gitweb.gentoo.org/proj/dotnet.git/commit/?id=f4059f02

initial versionn

 .../commandlineparser-0.6.0_p20160115.ebuild       | 231 +++++++++++++++++++++
 .../files/commandlineparser.nuspec                 |  18 ++
 .../commandlineparser/files/commandlineparser.png  | Bin 0 -> 2568 bytes
 dev-dotnet/commandlineparser/metadata.xml          |  23 ++
 4 files changed, 272 insertions(+)

diff --git a/dev-dotnet/commandlineparser/commandlineparser-0.6.0_p20160115.ebuild b/dev-dotnet/commandlineparser/commandlineparser-0.6.0_p20160115.ebuild
new file mode 100644
index 0000000..d8acb6d
--- /dev/null
+++ b/dev-dotnet/commandlineparser/commandlineparser-0.6.0_p20160115.ebuild
@@ -0,0 +1,231 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6 # >=portage-2.2.25
+KEYWORDS="~x86 ~amd64"
+
+USE_DOTNET="net45"
+# debug = debug configuration (symbols and defines for debugging)
+# developer = generate symbols information (to view line numbers in stack traces, either in debug or release configuration)
+# test = allow NUnit tests to run
+# nupkg = create .nupkg file from .nuspec
+# gac = install into gac
+# pkg-config = register in pkg-config database
+IUSE="${USE_DOTNET} debug test +developer +aot +nupkg +gac +pkg-config"
+
+inherit nupkg
+
+HOMEPAGE="https://github.com/mgrosperrin/commandlineparser/releases"
+DESCRIPTION="command line parser on System.ComponentModel.DataAnnotations"
+LICENSE="MIT"
+LICENSE_URL="https://raw.githubusercontent.com/mgrosperrin/commandlineparser/master/LICENSE"
+
+SLOT="0"
+
+# to unpack archive
+REPOSITORY_NAME="commandlineparser"
+REPOSITORY_URL="https://github.com/ArsenShnurkov/${REPOSITORY_NAME}"
+EGIT_COMMIT="2203477397a68885fdf004ae4eb2300a2d271347"
+SRC_URI="${REPOSITORY_URL}/archive/${EGIT_COMMIT}.zip -> ${P}.zip
+	mirror://gentoo/mono.snk.bz2"
+S="${WORKDIR}/${REPOSITORY_NAME}-${EGIT_COMMIT}"
+
+COMMON_DEPENDENCIES="|| ( >=dev-lang/mono-4.2 <dev-lang/mono-9999 )"
+RDEPEND="${COMMON_DEPENDENCIES}
+"
+DEPEND="${COMMON_DEPENDENCIES}
+"
+
+METAFILETOBUILD=MGR.CommandLineParser.linux.sln
+
+NUSPEC_FILENAME="commandlineparser.nuspec"
+NUSPEC_ID="${REPOSITORY_NAME}"
+COMMIT_DATE_INDEX=$(get_version_component_count ${PV} )
+COMMIT_DATE=$(get_version_component_range $COMMIT_DATE_INDEX ${PV} )
+NUSPEC_VERSION=$(get_version_component_range 1-3)"${COMMIT_DATE//p/.}${PR//r/}"
+ICON_FILENAME=commandlineparser.png
+ICON_FINALNAME=${NUSPEC_ID}.${NUSPEC_VERSION}.png
+ICON_PATH=$(get_nuget_trusted_icons_location)/${ICON_FINALNAME}
+
+# https://devmanual.gentoo.org/ebuild-writing/functions/pkg_setup/
+# https://devmanual.gentoo.org/ebuild-writing/functions/index.html
+# pkg_setup is executed before both - src_unpack (for source ebuilds) and pkg_preinst (for binary ebuilds)
+pkg_setup() {
+	addwrite "/usr/share/.mono/keypairs"
+	mozroots --import --sync --machine
+
+	# some kind of "default" from "detnet.eclass"
+	# https://github.com/gentoo/dotnet/blob/master/eclass/dotnet.eclass#L42-L78
+	dotnet_pkg_setup
+}
+
+src_unpack()
+{
+	default
+	# delete untrusted executables
+	find "${S}" -iname "*.exe" -delete || die
+	find "${S}" -iname "*.dll" -delete || die
+}
+
+src_prepare() {
+	# TODO: disable package restore in .csproj file
+	# see http://bartwullems.blogspot.ru/2012/08/disable-nuget-package-restore.html
+
+	# replace package versions in projects
+	# for example 2.6.2 -> 2.6.4 (for NUnit)
+
+	# prepare nuspec file
+	elog "${S}/${NUSPEC_FILENAME}"
+	cp "${FILESDIR}/${NUSPEC_FILENAME}" "${S}/${NUSPEC_FILENAME}" || die
+	patch_nuspec_file "${S}/${NUSPEC_FILENAME}"
+
+	# restore dependencies from local repository
+	# EnableNuGetPackageRestore somehow implied to be used by exbuild
+	# export EnableNuGetPackageRestore="true"
+	enuget_restore "${METAFILETOBUILD}"
+
+	# prepare sources for signing
+	if use gac; then
+		find . -iname "*.csproj" -print0 | xargs -0 \
+		sed -i 's/<DefineConstants>/<DefineConstants>SIGNED;/g' || die
+		#PUBLIC_KEY=`sn -q -p ${SNK_FILENAME} /dev/stdout | hexdump -e '"%02x"'`
+		#find . -iname "AssemblyInfo.cs" -print0 | xargs -0 sed -i "s/PublicKey=[0-9a-fA-F]*/PublicKey=${PUBLIC_KEY}/g" || die
+		find . -iname "AssemblyInfo.cs" -print0 | xargs -0 sed -i "/InternalsVisibleTo/d" || die
+	fi
+
+	if !use test ; then
+		: ; # todo: remove tests from solution
+	fi
+
+	# apply user patches
+	default
+}
+
+src_configure() {
+	default
+}
+
+# rm -rf /var/tmp/portage/dev-dotnet/commandlineparser-0.6.0-p20160115 && emerge =commandlineparser-0.6.0-p20160115
+src_compile() {
+	exbuild /p:SignAssembly=true "/p:AssemblyOriginatorKeyFile=${WORKDIR}/mono.snk" "${METAFILETOBUILD}"
+
+	NUSPEC_PROPS+="nuget_version=${NUSPEC_VERSION};"
+	NUSPEC_PROPS+="nuget_id=${NUSPEC_ID};"
+	NUSPEC_PROPS+="nuget_projectUrl=${HOMEPAGE};"
+	NUSPEC_PROPS+="nuget_licenseUrl=${LICENSE_URL};"
+	NUSPEC_PROPS+="nuget_description=${DESCRIPTION};"
+	NUSPEC_PROPS+="nuget_iconUrl=file://${ICON_PATH}"
+	elog "NUSPEC_PROPS=${NUSPEC_PROPS}"
+	enuspec -Prop "${NUSPEC_PROPS}" "${S}/${NUSPEC_FILENAME}"
+
+	if use aot; then
+		if use debug; then
+			DIR="Debug"
+		else
+			DIR="Release"
+		fi
+		# Could not load file or assembly or one of its dependencies.
+		# assembly:NuGet.Core, Version=2.8.7.0, Culture=neutral, PublicKeyToken=null type:<unknown type> member:<none>.
+		# Run with MONO_LOG_LEVEL=debug for more information.
+		einfo 'mono --aot -O=all "src/MGR.CommandLineParser/obj/${DIR}/MGR.CommandLineParser.dll"'
+		mono --aot -O=all "src/MGR.CommandLineParser/obj/${DIR}/MGR.CommandLineParser.dll" || die
+	fi
+}
+
+src_test() {
+	default
+	if use debug; then
+		DIR="Debug"
+	else
+		DIR="Release"
+	fi
+	#/usr/bin/nunit264 "${S}/src/MGR.CommandLineParser.Tests/obj/${DIR}/MGR.CommandLineParser.Tests.dll" || die
+}
+
+src_install() {
+	if use debug; then
+		DIR="Debug"
+	else
+		DIR="Release"
+	fi
+
+	#nongac install
+	#insinto "/usr/$(get_libdir)/${PN}/"
+	#doins src/MGR.CommandLineParser/obj/${DIR}/MGR.CommandLineParser.dll
+	#if use developer; then
+	#	"doins src/MGR.CommandLineParser/obj/${DIR}/MGR.CommandLineParser.dll.mdb"
+	#fi
+
+	# gac install
+	if use gac; then
+		# Failure adding assembly src/Core/bin/Release/NuGet.Core.dll to the cache: Attempt to install an assembly without a strong name
+		elog "Installing MGR.CommandLineParser.dll into GAC"
+		egacinstall "src/MGR.CommandLineParser/obj/${DIR}/MGR.CommandLineParser.dll"
+	fi
+
+	# local package install
+	if use nupkg; then
+		enupkg "${WORKDIR}/${NUSPEC_ID}.${NUSPEC_VERSION}.nupkg"
+		insinto /var/calculate/remote/packages/NuGet/icons/
+		# newins - Install a miscellaneous file using the second argument as the name.
+		newins "${FILESDIR}/${ICON_FILENAME}" "${ICON_FINALNAME}"
+	fi
+
+	# Copy the AOT compilation result
+	if use aot; then
+		einfo "Copy the AOT compilation result"
+		insinto "/usr/$(get_libdir)/${PN}/"
+		doins "src/MGR.CommandLineParser/obj/${DIR}/MGR.CommandLineParser.dll.so"
+	fi
+
+	#install_pc_file
+}
+
+patch_nuspec_file()
+{
+	if use nupkg; then
+		if use debug; then
+			DIR="Debug"
+		else
+			DIR="Release"
+		fi
+FILES_STRING=`cat <<-EOF || die "${DIR} files at patch_nuspec_file()"
+	<files> <!-- https://docs.nuget.org/create/nuspec-reference -->
+		<file src="src/MGR.CommandLineParser/bin/${DIR}/MGR.CommandLineParser.*" target="lib\net45\" />
+	</files>
+EOF
+`
+		einfo ${FILES_STRING}
+		replace "</package>" "${FILES_STRING}</package>" -- $1 || die "replace at patch_nuspec_file()"
+	fi
+}
+
+PC_FILE_NAME=${PN}
+
+install_pc_file()
+{
+	if use pkg-config; then
+		dodir /usr/$(get_libdir)/pkgconfig
+		ebegin "Installing ${PC_FILE_NAME}.pc file"
+		sed \
+			-e "s:@LIBDIR@:$(get_libdir):" \
+			-e "s:@PACKAGENAME@:${PC_FILE_NAME}:" \
+			-e "s:@DESCRIPTION@:${DESCRIPTION}:" \
+			-e "s:@VERSION@:${PV}:" \
+			-e 's*@LIBS@*-r:${libdir}'"/mono/${PC_FILE_NAME}/MGR.CommandLineParser.dll"'*' \
+			<<\EOF >"${D}/usr/$(get_libdir)/pkgconfig/${PC_FILE_NAME}.pc" || die
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${exec_prefix}/@LIBDIR@
+Name: @PACKAGENAME@
+Description: @DESCRIPTION@
+Version: @VERSION@
+Libs: @LIBS@
+EOF
+
+		einfo PKG_CONFIG_PATH="${D}/usr/$(get_libdir)/pkgconfig/" pkg-config --exists "${PC_FILE_NAME}"
+		PKG_CONFIG_PATH="${D}/usr/$(get_libdir)/pkgconfig/" pkg-config --exists "${PC_FILE_NAME}" || die ".pc file failed to validate."
+		eend $?
+	fi
+}

diff --git a/dev-dotnet/commandlineparser/files/commandlineparser.nuspec b/dev-dotnet/commandlineparser/files/commandlineparser.nuspec
new file mode 100644
index 0000000..6c40402
--- /dev/null
+++ b/dev-dotnet/commandlineparser/files/commandlineparser.nuspec
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+  <metadata>
+    <id>$nuget_id$</id>
+    <version>$nuget_version$</version>
+    <title>CommandLine parser</title>
+    <description>$nuget_description$</description>
+    <authors>Matthias Grosperrin</authors>
+    <language>en-US</language>
+    <projectUrl>$nuget_projectUrl$</projectUrl>
+    <iconUrl>$nuget_iconUrl$</iconUrl>
+    <licenseUrl>$nuget_licenseUrl$</licenseUrl>
+    <tags>json</tags>
+    <dependencies>
+      <group targetFramework="net45" />
+    </dependencies>
+  </metadata>
+</package>

diff --git a/dev-dotnet/commandlineparser/files/commandlineparser.png b/dev-dotnet/commandlineparser/files/commandlineparser.png
new file mode 100644
index 0000000..688ecaf
Binary files /dev/null and b/dev-dotnet/commandlineparser/files/commandlineparser.png differ

diff --git a/dev-dotnet/commandlineparser/metadata.xml b/dev-dotnet/commandlineparser/metadata.xml
new file mode 100644
index 0000000..b0f2685
--- /dev/null
+++ b/dev-dotnet/commandlineparser/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>dotnet</herd>
+	<maintainer> <!-- https://wiki.gentoo.org/wiki/User:Cynede -->
+		<email>cynede@gentoo.org</email>
+		<name>Heather Cynede</name>
+	</maintainer>
+	<upstream>
+		<bugs-to>https://github.com/mgrosperrin/commandlineparser/issues</bugs-to>
+		<remote-id type="github">ArsenShnurkov/commandlineparser</remote-id>
+	</upstream>
+	<use>
+		<flag name='aot'>compile to machine code and store to disk during install, to save time later during startups</flag>
+		<flag name='pkg-config'>create .pc file(s) for .dll(s) installed to gac</flag>
+	</use>
+	<longdescription lang="en">
+		MGR.CommandLineParser is a multi-command line parser. It uses System.ComponentModel.DataAnnotations to declare and validate the commands.
+	</longdescription>
+	<longdescription lang="ru">
+		Библиотека для написания кода, анализирующего параметры, переданные из интерпретатора командной строки. Использует System.ComponentModel.DataAnnotations
+	</longdescription>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-15 13:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15 13:20 [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/commandlineparser/, dev-dotnet/commandlineparser/files/ Heather Cynede

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