1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: obs-service.eclass
6 # maintainer-needed@gentoo.org
7 # @SUPPORTED_EAPIS: 4 5
8 # @BLURB: Reduces code duplication in the Open Build Service services.
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
15 # Typical ebuild using obs-service.eclass:
29 # @ECLASS-VARIABLE: OBS_SERVICE_NAME
31 # Name of the service. If not set, it is taken from ${PN}.
33 # @ECLASS-VARIABLE: ADDITIONAL_FILES
36 # If any additional files are needed.
40 *) die "EAPI=${EAPI} is not supported" ;;
43 HOMEPAGE="http://en.opensuse.org/openSUSE:OSC"
53 [[ -n ${OBS_SERVICE_NAME} ]] || OBS_SERVICE_NAME=${PN/obs-service-/}
54 OBS_PROJECT="openSUSE:Tools"
56 DESCRIPTION="Open Build Service client module - ${OBS_SERVICE_NAME} service"
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"
64 for i in ${ADDITIONAL_FILES}; do
65 SRC_URI+=" ${OBS_URI}/${i} -> ${i}-${PV}"
68 # @FUNCTION: obs-service_src_unpack
70 # Just copy files. Files are not compressed.
71 obs-service_src_unpack() {
72 debug-print-function ${FUNCNAME} "$@"
78 # @FUNCTION: obs-service_src_prepare
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/libexec/suse-build|g' {} +
87 debug-print "Replacing all paths from hardcoded suse libexec"
88 find "${S}" -type f -exec \
89 sed -i 's|/usr/lib/obs|/usr/libexec/obs|g' {} +
92 # @FUNCTION: obs-service_src_install
94 # Does the installation of the downloaded files.
95 obs-service_src_install() {
96 debug-print-function ${FUNCNAME} "$@"
97 debug-print "Installing service \"${OBS_SERVICE_NAME}\""
98 exeinto /usr/libexec/obs/service
99 newexe "${S}"/${OBS_SERVICE_NAME}-${PV} ${OBS_SERVICE_NAME}
100 insinto /usr/libexec/obs/service
101 newins "${S}"/${OBS_SERVICE_NAME}-${PV}.service ${OBS_SERVICE_NAME}.service
102 if [[ -n ${ADDITIONAL_FILES} ]]; then
103 debug-print "Installing following additional files:"
104 debug-print " ${ADDITIONAL_FILES}"
105 exeinto /usr/libexec/obs/service/${OBS_SERVICE_NAME}.files
106 for i in ${ADDITIONAL_FILES}; do
107 newexe "${S}"/${i}-${PV} ${i}
112 EXPORT_FUNCTIONS src_install src_prepare src_unpack