1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: obs-service.eclass
7 # @BLURB: Reduces code duplication in the Open Build Service services.
9 # This eclass makes it easier to package Open Build Service services. Based on
10 # provided information it will set all needed variables and takes care of
14 # Typical ebuild using obs-service.eclass:
28 # @ECLASS-VARIABLE: OBS_SERVICE_NAME
30 # Name of the service. If not set, it is taken from ${PN}.
32 # @ECLASS-VARIABLE: ADDITIONAL_FILES
35 # If any additional files are needed.
39 *) die "EAPI=${EAPI} is not supported" ;;
42 HOMEPAGE="http://en.opensuse.org/openSUSE:OSC"
52 [[ -n ${OBS_SERVICE_NAME} ]] || OBS_SERVICE_NAME=${PN/obs-service-/}
53 OBS_PROJECT="openSUSE:Tools"
55 DESCRIPTION="Open Build Service client module - ${OBS_SERVICE_NAME} service"
59 # As it aint versioned at all use arrows to deal with it
60 SRC_URI="${OBS_URI}/${OBS_SERVICE_NAME} -> ${OBS_SERVICE_NAME}-${PV}"
61 SRC_URI+=" ${OBS_URI}/${OBS_SERVICE_NAME}.service -> ${OBS_SERVICE_NAME}-${PV}.service"
63 for i in ${ADDITIONAL_FILES}; do
64 SRC_URI+=" ${OBS_URI}/${i} -> ${i}-${PV}"
67 # @FUNCTION: obs-service_src_unpack
69 # Just copy files. Files are not compressed.
70 obs-service_src_unpack() {
71 debug-print-function ${FUNCNAME} "$@"
77 # @FUNCTION: obs-service_src_prepare
79 # Replaces all /usr/lib/build directories with /usr/share/suse-build to reflect
80 # where suse-build is installed in Gentoo.
81 obs-service_src_prepare() {
82 debug-print-function ${FUNCNAME} "$@"
83 debug-print "Replacing all paths to find suse-build in Gentoo"
84 find "${S}" -type f -exec \
85 sed -i 's|/usr/lib/build|/usr/libexec/suse-build|g' {} +
86 debug-print "Replacing all paths from hardcoded suse libexec"
87 find "${S}" -type f -exec \
88 sed -i 's|/usr/lib/obs|/usr/libexec/obs|g' {} +
91 # @FUNCTION: obs-service_src_install
93 # Does the installation of the downloaded files.
94 obs-service_src_install() {
95 debug-print-function ${FUNCNAME} "$@"
96 debug-print "Installing service \"${OBS_SERVICE_NAME}\""
97 exeinto /usr/libexec/obs/service
98 newexe "${S}"/${OBS_SERVICE_NAME}-${PV} ${OBS_SERVICE_NAME}
99 insinto /usr/libexec/obs/service
100 newins "${S}"/${OBS_SERVICE_NAME}-${PV}.service ${OBS_SERVICE_NAME}.service
101 if [[ -n ${ADDITIONAL_FILES} ]]; then
102 debug-print "Installing following additional files:"
103 debug-print " ${ADDITIONAL_FILES}"
104 exeinto /usr/libexec/obs/service/${OBS_SERVICE_NAME}.files
105 for i in ${ADDITIONAL_FILES}; do
106 newexe "${S}"/${i}-${PV} ${i}
111 EXPORT_FUNCTIONS src_install src_prepare src_unpack