Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 913922 | Differences between
and this patch

Collapse All | Expand All

(-)/var/portage/dev-ruby/asciidoctor-diagram/asciidoctor-diagram-2.2.12.ebuild (-15 / +78 lines)
Lines 20-36 Link Here
20
LICENSE="MIT"
20
LICENSE="MIT"
21
SLOT="0"
21
SLOT="0"
22
KEYWORDS="~amd64"
22
KEYWORDS="~amd64"
23
24
# Supported backends dictionary: <backend-name> <dependencies> <removal-function>
25
# backend-name: The name of the USE flag, a gem spec file in ./spec, a directory in ./lib/asciidoctor-diagram/, and a require directive in ./lib/asciidoctor.rb which will be removed if the former is unset.
26
# dependencies: Dependencies for RDEPEND if the USE flag is set, and for DEPEND if the "test" USE flag is set.
27
# removal-function: Additional commands to evaluate, if the USE flag is unset.
28
#
29
# NB: Do not implicitly use functions following a naming scheme instead of an explicit <removal-function> to prevent accidental or malicious injection from functions exported in the parent environment.
30
backend_dict_stride=3
31
backends=(
32
 	"barcode" "dev-ruby/rqrcode dev-ruby/barby" ""
33
 	"ditaa" "media-gfx/ditaa virtual/jre" "remove_ditaa"
34
 	"gnuplot" "sci-visualization/gnuplot" ""
35
 	"graphviz" "media-gfx/graphviz" ""
36
 	"lilypond" "media-sound/lilypond" ""
37
 	"meme" "media-gfx/imagemagick[png]" ""
38
 	"mscgen" "media-gfx/mscgen[png]" ""
39
 	"plantuml" "media-gfx/plantuml virtual/jre" "remove_plantuml"
40
 	"tikz" "dev-tex/pgf" ""
41
)
42
43
remove_plantuml() {
44
    rm -f "spec/salt.rb"
45
    sed -i "/\\/salt'/d" "lib/asciidoctor-diagram.rb"
46
    sed -i "/plantuml/d" "asciidoctor-diagram.gemspec"
47
}
48
49
remove_ditaa() {
50
    sed -i "/ditaa/d" "asciidoctor-diagram.gemspec"
51
}
52
23
IUSE=""
53
IUSE=""
54
DEPEND+="test? ("
55
56
i=0
57
while (( i < ${#backends[@]} ))
58
do
59
    	backend="${backends[i]}"
60
    	deps="${backends[i+1]}"
61
62
    	IUSE+=" $backend"
63
    	RDEPEND+=" $backend? ( $deps )"
64
    	DEPEND+=" $deps"
65
66
    	((i+=backend_dict_stride))
67
done
68
69
DEPEND+=" )"
24
70
25
RDEPEND+=" virtual/jre"
26
DEPEND+=" test? (
27
	dev-texlive/texlive-latex
28
	dev-texlive/texlive-latexextra
29
	media-gfx/imagemagick[png,postscript]
30
	media-gfx/graphviz
31
	media-sound/lilypond
32
	sci-visualization/gnuplot
33
)"
34
ruby_add_rdepend ">=dev-ruby/asciidoctor-1.5.7 <dev-ruby/asciidoctor-3"
71
ruby_add_rdepend ">=dev-ruby/asciidoctor-1.5.7 <dev-ruby/asciidoctor-3"
35
72
36
all_ruby_prepare() {
73
all_ruby_prepare() {
Lines 39-51 Link Here
39
		-e '/logger.*DEBUG/ s:^:#:' \
76
		-e '/logger.*DEBUG/ s:^:#:' \
40
		-i spec/test_helper_methods.rb || die
77
		-i spec/test_helper_methods.rb || die
41
78
42
	# Remove some diagram dependencies that contains vendored code and
79
        # Delete everything related to unsupported backends. Obtain list of backends from spec/
43
	# are currently not packaged. Please file a bug if you have a need
80
        for spec in spec/*_spec.rb
44
	# for these diagram types.
81
        do
45
	sed -i -e '/\(ditaamini\|plantuml\)/ s:^:#:' ${RUBY_FAKEGEM_GEMSPEC} || die
82
        	backend="${spec##spec/}"
83
        	backend="${backend%%_spec.rb}"
84
85
        	backend_index=0
86
87
        	get_backend_index() {
88
                    local i=0
89
                    while (( i < ${#backends[@]} ))
90
                    do
91
                        if [[ "${backends[i]}" == "$backend" ]]
92
                        then
93
                            echo "$i"
94
                            return 1
95
                        fi
96
                        ((i+=backend_dict_stride))
97
                    done
98
                }
46
99
47
	# Avoid specs for unpackaged tools
100
		if backend_index="$(get_backend_index)" || ! use "$backend"
48
	rm -f spec/{a2s,barcode,blockdiag,bpmn,bytefield,d2,dbml,diagrams,ditaa,dpic,erd,graphviz_py,mermaid,msc,nomnoml,pikchr,plantuml,shaape,smcat,structurizr,svgbob,symbolator,syntrax,umlet,vega,wavedrom}_spec.rb || die
101
                then
102
			rm -f "spec/$backend_spec.rb"
103
			rm -Rf "lib/asciidoctor-diagram/"{"$backend.rb","$backend"}
104
			sed -i "/\\/$backend'/d" "lib/asciidoctor-diagram.rb"
105
			removal="${backends[backend_index+2]}"
106
			if [[ "$removal" ]]
107
			then
108
        			"$removal"
109
    			fi
110
        	fi
111
        done
49
}
112
}
50
113
51
all_ruby_install() {
114
all_ruby_install() {

Return to bug 913922