public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [RFC] obs eclasses
@ 2011-09-13 11:11 Michal Hrusecky
  2011-09-13 11:24 ` Amadeusz Żołnowski
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Michal Hrusecky @ 2011-09-13 11:11 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 221 bytes --]

Hi,

please take a look at attached eclasses. Purpose is to make installation
of obs services (plugins for osc) easier.

Comments and improvements are welcome.

Regards

-- 
	Michal Hrusecky <miska@gentoo.org>

[-- Attachment #1.2: obs-download.eclass --]
[-- Type: text/plain, Size: 1516 bytes --]

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: obs-download.eclass
# @MAINTAINER:
# miska@gentoo.org
# @BLURB: Reduces code duplication in the downloading from obs.
# @DESCRIPTION:
# This eclass constructs OBS_URI based on provided project in openSUSE Build
# Service and package name. It can be used later by packages/eclasses to
# download actual files.
#
# All you need to do in order to use it is set OBS_PROJECT and OBS_PACKAGE and
# inherit this eclass. It will provide OBS_URI in return which you will prepend
# to your files and use in SRC_URI. Alternatively you can just set
# OPENSUSE_RELEASE and OBS_PACKAGE and it will give you back OBS_URI for
# downloading files from obs projects corresponding to the specified openSUSE
# release.

# @ECLASS-VARIABLE: OPENSUSE_RELEASE
# @DEFAULT_UNSET
# @DESCRIPTION:
# From which stable openSUSE realease to take files.

# @ECLASS-VARIABLE: OBS_PROJECT
# @DEFAULT_UNSET
# @DESCRIPTION:
# In which obs project pakage is. This variable don't have to be set, if
# OPENSUSE_RELEASE is provided.

# @ECLASS-VARIABLE: OPENSUSE_PACKAGE
# @REQUIRED
# @DESCRIPTION:
# Name of the package we want to take files from.

[[ -z ${OPENSUSE_RELEASE} ]] || OBS_PROJECT="openSUSE:${OPENSUSE_RELEASE}"
[[ -n ${OBS_PROJECT} ]]      || die "OBS_PROJECT not set!"
[[ -n ${OBS_PACKAGE} ]]      || die "OBS_PACKAGE not set!"

OBS_URI="https://api.opensuse.org/public/source/${OBS_PROJECT}/${OBS_PACKAGE}"

[-- Attachment #1.3: obs-service.eclass --]
[-- Type: text/plain, Size: 2375 bytes --]

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: obs-service.eclass
# @MAINTAINER:
# miska@gentoo.org
# @BLURB: Reduces code duplication in the obs services.
# @DESCRIPTION:
# This eclass makes it easier to package obs services. Based on provided
# information it will all neede variables and takes care of installation.
#
# @EXAMPLE:
# Typical ebuild using obs-service.eclass:
#
# @CODE
# EAPI=4
#
# inherit obs-service
#
# KEYWORDS=""
#
# DEPEND=""
# RDEPEND="${DEPEND}"
#
# @CODE

# @ECLASS-VARIABLE: OBS_SERVICE_NAME
# @DESCRIPTION:
# Name of the service. If not set, it is taken from ${PN}.

# @ECLASS-VARIABLE: OPENSUSE_RELEASE
# @DESCRIPTION:
# From which stable openSUSE realease to take a package.

# @ECLASS-VARIABLE: ADDITIONAL_FILES
# @DEFAULT_UNSET
# @DESCRIPTION:
# If any additional files are needed.

case "${EAPI:-0}" in
	4) : ;;
	*) die "EAPI=${EAPI} is not supported" ;;
esac

HOMEPAGE="http://en.opensuse.org/openSUSE:OSC"
LICENSE="GPL-2"
SLOT="0"
IUSE=""
RDEPEND+="dev-util/osc"

[[ -n ${OBS_SERVICE_NAME} ]] || OBS_SERVICE_NAME=${PN/obs-service-/}
[[ -n ${OPENSUSE_RELEASE} ]] || OBS_PROJECT="openSUSE:Tools"

DESCRIPTION="Open Build Service client module - ${OBS_SERVICE_NAME} service"
OBS_PACKAGE="obs-service-${OBS_SERVICE_NAME}"

inherit obs-download

SRC_URI="${OBS_URI}/${OBS_SERVICE_NAME}"
SRC_URI+=" ${OBS_URI}/${OBS_SERVICE_NAME}.service"

for i in ${ADDITIONAL_FILES}; do
	SRC_URI+=" ${OBS_URI}/${i}"
done

S="${WORKDIR}"

# @FUNCTION: obs-service_src_configure
# @DESCRIPTION:
# Does nothing. Files are not compressed.
obs-service_src_unpack() {
	debug-print-function ${FUNCNAME} "$@"
}

# @FUNCTION: obs-service_src_install
# @DESCRIPTION:
# Does the installation of the downloaded files.
obs-service_src_install() {
	debug-print-function ${FUNCNAME} "$@"
	debug-print "Installing service \"${OBS_SERVICE_NAME}\""
	exeinto /usr/lib/obs/service
	doexe ${DISTDIR}/${OBS_SERVICE_NAME}
	insinto /usr/lib/obs/service
	doins ${DISTDIR}/${OBS_SERVICE_NAME}.service
	if [[ -n ${ADDITIONAL_FILES} ]]; then
		debug-print "Installing following additional files:"
		debug-print "	${ADDITIONAL_FILES}"
		exeinto /usr/lib/obs/service/${OBS_SERVICE_NAME}.files
		for i in ${ADDITIONAL_FILES}; do
			doexe ${DISTDIR}/$i
		done
	fi
}

EXPORT_FUNCTIONS src_install src_unpack

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2011-09-20  9:27 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-13 11:11 [gentoo-dev] [RFC] obs eclasses Michal Hrusecky
2011-09-13 11:24 ` Amadeusz Żołnowski
2011-09-13 12:26   ` Joshua Kinard
2011-09-13 13:02     ` Amadeusz Żołnowski
2011-09-13 13:12       ` Michał Górny
2011-09-13 14:44       ` Donnie Berkholz
2011-09-13 15:58         ` Patrick Lauer
2011-09-13 16:41           ` Donnie Berkholz
2011-09-13 17:25             ` Ulrich Mueller
2011-09-13 17:33               ` Tomáš Chvátal
2011-09-13 17:38               ` Amadeusz Żołnowski
2011-09-13 17:40               ` Michał Górny
2011-09-13 18:40                 ` Ulrich Mueller
2011-09-13 18:47                   ` Michał Górny
2011-09-14  5:39             ` Ciaran McCreesh
2011-09-14  5:37           ` Ciaran McCreesh
2011-09-20  5:09     ` [gentoo-dev] " Steven J Long
2011-09-13 14:37   ` [gentoo-dev] " Michal Hrusecky
2011-09-13 14:59 ` Donnie Berkholz
2011-09-13 15:55   ` Nirbheek Chauhan
2011-09-14  8:44   ` Michal Hrusecky
2011-09-14  8:56 ` Michal Hrusecky
2011-09-14  9:56   ` Ulrich Mueller
2011-09-14 13:34     ` Michal Hrusecky
2011-09-15  7:35   ` Marijn
2011-09-15  8:18     ` Michal Hrusecky
2011-09-15 16:30       ` [gentoo-dev] " Duncan
2011-09-20  8:23 ` [gentoo-dev] " Michał Górny
2011-09-20  9:26   ` Tomáš Chvátal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox