/[gentoo-x86]/eclass/obs-service.eclass
Gentoo

Contents of /eclass/obs-service.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Thu Nov 15 20:06:34 2012 UTC (19 months, 3 weeks ago) by scarabeus
Branch: MAIN
Changes since 1.7: +6 -2 lines
Depend on suse-build as most services require it.

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/obs-service.eclass,v 1.7 2012/11/15 19:52:55 scarabeus Exp $
4
5 # @ECLASS: obs-service.eclass
6 # @MAINTAINER:
7 # suse@gentoo.org
8 # @BLURB: Reduces code duplication in the Open Build Service services.
9 # @DESCRIPTION:
10 # This eclass makes it easier to package Open Build Service services. Based on
11 # provided information it will set all needed variables and takes care of
12 # installation.
13 #
14 # @EXAMPLE:
15 # Typical ebuild using obs-service.eclass:
16 #
17 # @CODE
18 # EAPI=4
19 #
20 # inherit obs-service
21 #
22 # KEYWORDS=""
23 #
24 # DEPEND=""
25 # RDEPEND="${DEPEND}"
26 #
27 # @CODE
28
29 # @ECLASS-VARIABLE: OBS_SERVICE_NAME
30 # @DESCRIPTION:
31 # Name of the service. If not set, it is taken from ${PN}.
32
33 # @ECLASS-VARIABLE: ADDITIONAL_FILES
34 # @DEFAULT_UNSET
35 # @DESCRIPTION:
36 # If any additional files are needed.
37
38 case "${EAPI:-0}" in
39 4|5) : ;;
40 *) die "EAPI=${EAPI} is not supported" ;;
41 esac
42
43 HOMEPAGE="http://en.opensuse.org/openSUSE:OSC"
44 LICENSE="GPL-2"
45 SLOT="0"
46 IUSE=""
47
48 RDEPEND="
49 dev-util/osc
50 dev-util/suse-build
51 "
52
53 [[ -n ${OBS_SERVICE_NAME} ]] || OBS_SERVICE_NAME=${PN/obs-service-/}
54 OBS_PROJECT="openSUSE:Tools"
55
56 DESCRIPTION="Open Build Service client module - ${OBS_SERVICE_NAME} service"
57
58 inherit obs-download
59
60 # As it aint versioned at all use arrows to deal with it
61 SRC_URI="${OBS_URI}/${OBS_SERVICE_NAME} -> ${OBS_SERVICE_NAME}-${PV}"
62 SRC_URI+=" ${OBS_URI}/${OBS_SERVICE_NAME}.service -> ${OBS_SERVICE_NAME}-${PV}.service"
63
64 for i in ${ADDITIONAL_FILES}; do
65 SRC_URI+=" ${OBS_URI}/${i}"
66 done
67
68 # @FUNCTION: obs-service_src_unpack
69 # @DESCRIPTION:
70 # Just copy files. Files are not compressed.
71 obs-service_src_unpack() {
72 debug-print-function ${FUNCNAME} "$@"
73 cd "${DISTDIR}"
74 mkdir -p "${S}"
75 cp ${A} "${S}"
76 }
77
78 # @FUNCTION: obs-service_src_prepare
79 # @DESCRIPTION:
80 # Replaces all /usr/lib/build directories with /usr/share/suse-build to reflect
81 # where suse-build is installed in Gentoo.
82 obs-service_src_prepare() {
83 debug-print-function ${FUNCNAME} "$@"
84 debug-print "Replacing all paths to find suse-build in Gentoo"
85 find "${S}" -type f -exec \
86 sed -i 's|/usr/lib/build|/usr/share/suse-build|g' {} +
87 }
88
89 # @FUNCTION: obs-service_src_install
90 # @DESCRIPTION:
91 # Does the installation of the downloaded files.
92 obs-service_src_install() {
93 debug-print-function ${FUNCNAME} "$@"
94 debug-print "Installing service \"${OBS_SERVICE_NAME}\""
95 exeinto /usr/lib/obs/service
96 newexe "${S}"/${OBS_SERVICE_NAME}-${PV} ${OBS_SERVICE_NAME}
97 insinto /usr/lib/obs/service
98 newins "${S}"/${OBS_SERVICE_NAME}-${PV}.service ${OBS_SERVICE_NAME}.service
99 if [[ -n ${ADDITIONAL_FILES} ]]; then
100 debug-print "Installing following additional files:"
101 debug-print " ${ADDITIONAL_FILES}"
102 exeinto /usr/lib/obs/service/${OBS_SERVICE_NAME}.files
103 for i in ${ADDITIONAL_FILES}; do
104 doexe "${S}"/${i}
105 done
106 fi
107 }
108
109 EXPORT_FUNCTIONS src_install src_prepare src_unpack

  ViewVC Help
Powered by ViewVC 1.1.20