rex-9999.ebuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. if [[ ${PV} == 9999 ]]; then
  5. GITHUB_USER=RexOps
  6. GITHUB_REPO=Rex
  7. EGIT_REPO_URI="https://github.com/${GITHUB_USER}/${GITHUB_REPO}.git"
  8. EGIT_BRANCH="development-1.x"
  9. EGIT_CHECKOUT_DIR="${WORKDIR}/${PN}-git"
  10. VCS_ECLASS="git-r3"
  11. else
  12. # This is intentional to stop perl-module.eclass doing magic things when it
  13. # shouldn't. Like making ${S} contain "Rex" when the git clone has "rex"
  14. # Also prevents perl-module.eclass provisioning SRC_URI
  15. DIST_AUTHOR=JFRIED
  16. DIST_NAME=Rex
  17. KEYWORDS="~amd64 ~x86"
  18. fi
  19. inherit perl-module ${VCS_ECLASS}
  20. DESCRIPTION="(R)?ex is a small script to ease the execution of remote commands"
  21. SLOT="0"
  22. IUSE="test"
  23. DZIL_DEPENDS="
  24. dev-perl/Dist-Zilla
  25. dev-perl/Dist-Zilla-Plugin-MakeMaker-Awesome
  26. dev-perl/Dist-Zilla-Plugin-MetaProvides-Package
  27. dev-perl/Dist-Zilla-Plugin-OSPrereqs
  28. dev-perl/Dist-Zilla-Plugin-OurPkgVersion
  29. dev-perl/Dist-Zilla-Plugin-Test-MinimumVersion
  30. dev-perl/Dist-Zilla-Plugin-Test-Perl-Critic
  31. "
  32. RDEPEND="
  33. dev-perl/Data-Validate-IP
  34. dev-perl/DBI
  35. dev-perl/Devel-Caller
  36. dev-perl/Digest-HMAC
  37. dev-perl/Digest-SHA1
  38. dev-perl/Expect
  39. dev-perl/Hash-Merge
  40. dev-perl/IO-String
  41. dev-perl/IO-Tty
  42. dev-perl/IPC-Shareable
  43. dev-perl/JSON-XS
  44. dev-perl/List-MoreUtils
  45. dev-perl/Net-OpenSSH
  46. dev-perl/Net-SFTP-Foreign
  47. dev-perl/Parallel-ForkManager
  48. dev-perl/Sort-Naturally
  49. dev-perl/String-Escape
  50. dev-perl/TermReadKey
  51. dev-perl/Test-Deep
  52. dev-perl/Text-Glob
  53. dev-perl/URI
  54. dev-perl/XML-LibXML
  55. dev-perl/XML-Simple
  56. dev-perl/libwww-perl
  57. dev-perl/YAML
  58. virtual/perl-Carp
  59. virtual/perl-Data-Dumper
  60. virtual/perl-Digest-MD5
  61. virtual/perl-Exporter
  62. virtual/perl-File-Spec
  63. virtual/perl-MIME-Base64
  64. virtual/perl-Scalar-List-Utils
  65. virtual/perl-Storable
  66. virtual/perl-Time-HiRes
  67. "
  68. DEPEND="
  69. ${RDEPEND}
  70. test? (
  71. dev-perl/Test-UseAllModules
  72. virtual/perl-File-Temp
  73. )
  74. "
  75. [[ ${PV} == 9999 ]] && DEPEND+=" ${DZIL_DEPENDS}"
  76. src_unpack() {
  77. if [[ $PV == 9999 ]]; then
  78. "${VCS_ECLASS}"_src_unpack
  79. mkdir -p "${S}" || die "Can't make ${S}"
  80. else
  81. default
  82. fi
  83. }
  84. dzil_to_distdir() {
  85. local dzil_root dest has_missing modname dzil_version
  86. dzil_root="$1"
  87. dest="$2"
  88. cd "${dzil_root}" || die "Can't enter git workdir '${dzil_root}'";
  89. dzil_version="$(dzil version)" || die "Error invoking 'dzil version'"
  90. einfo "Generating CPAN dist with ${dzil_version}"
  91. has_missing=""
  92. einfo "Checking dzil authordeps"
  93. while IFS= read -d $'\n' -r modname; do
  94. if [[ -z "${has_missing}" ]]; then
  95. has_missing=1
  96. eerror "'dzil authordeps' indicates missing build dependencies"
  97. eerror "These will prevent building, please report a bug"
  98. eerror "Missing:"
  99. fi
  100. eerror " ${modname}"
  101. done < <( dzil authordeps --missing --versions )
  102. [[ -z "${has_missing}" ]] || die "Satisfy all missing authordeps first"
  103. einfo "Checking dzil build deps"
  104. while IFS= read -d $'\n' -r modname; do
  105. if [[ -z "${has_missing}" ]]; then
  106. has_missing=1
  107. ewarn "'dzil listdeps' indicates missing build dependencies"
  108. ewarn "These may prevent building, please report a bug if they do"
  109. ewarn "Missing:"
  110. fi
  111. ewarn " ${modname}"
  112. done < <( dzil listdeps --missing --versions --author )
  113. einfo "Generating release"
  114. dzil build --notgz --in "${dest}" || die "Unable to build CPAN dist in '${dest}'"
  115. }
  116. src_prepare() {
  117. if [[ ${PV} == 9999 ]]; then
  118. # Uses git sources in WORKDIR/rex-git
  119. # to generate a CPAN-style tree in ${S}
  120. # before letting perl-module.eclass do the rest
  121. dzil_to_distdir "${EGIT_CHECKOUT_DIR}" "${S}"
  122. fi
  123. cd "${S}" || die "Can't enter build dir"
  124. perl-module_src_prepare
  125. }