/[gentoo-x86]/eclass/tla.eclass
Gentoo

Contents of /eclass/tla.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download)
Fri May 17 11:31:49 2013 UTC (5 years, 1 month ago) by scarabeus
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +1 -1 lines
FILE REMOVED
Remove eclasses marked as dead for quite some time.

1 pacho 1.12 # Copyright 1999-2012 Gentoo Foundation
2 rphillips 1.1 # Distributed under the terms of the GNU General Public License v2
3 scarabeus 1.14 # $Header: /var/cvsroot/gentoo-x86/eclass/tla.eclass,v 1.13 2012/09/16 18:37:44 ulm Exp $
4 ulm 1.13
5     # @DEAD
6     # To be removed on 2012-10-16.
7    
8 rphillips 1.1 # Original Author: Jeffrey Yasskin <jyasskin@mail.utexas.edu>
9     #
10     # Originally derived from the cvs eclass.
11     #
12     # This eclass provides the generic tla fetching functions.
13     # to use from an ebuild, set the 'ebuild-configurable settings' below in your
14     # ebuild before inheriting. then either leave the default src_unpack or extend
15     # over tla_src_unpack.
16    
17     # Most of the time, you will define only $ETLA_VERSION and $ETLA_ARCHIVES in
18     # your ebuild.
19    
20     # TODO:
21     # Make it support particular revisions.
22    
23 pacho 1.12 inherit eutils
24 rphillips 1.1
25     # Don't download anything other than the tla archive
26     SRC_URI=""
27    
28     # You shouldn't change these settings yourself! The ebuild/eclass inheriting
29 swegener 1.8 # this eclass will take care of that.
30 rphillips 1.1
31     # --- begin ebuild-configurable settings
32    
33     # tla command to run. Theoretically, substituting any arch derivative should be
34     # relatively easy.
35     [ -z "$ETLA_TLA_CMD" ] && ETLA_TLA_CMD="tla"
36    
37     # tla commands with options
38     [ -z "$ETLA_GET_CMD" ] && ETLA_GET_CMD="get"
39     [ -z "$ETLA_UPDATE_CMD" ] && ETLA_UPDATE_CMD="replay"
40    
41     # Where the tla modules are stored/accessed
42     [ -z "$ETLA_TOP_DIR" ] && ETLA_TOP_DIR="${DISTDIR}/tla-src"
43    
44     # Name of tla version in the format
45     # user@example.com--archive-name/category--branch--version
46     # (in other words, an argument to tla get, update, or replay)
47     [ -z "$ETLA_VERSION" ] && ETLA_VERSION=""
48    
49     # A space-separated list of significant archive URLs. You should definitely
50     # include the URL for the archive your version is stored in, and if it refers
51     # to any other archives, also list them.
52     [ -z "$ETLA_ARCHIVES" ] && ETLA_ARCHIVES=""
53    
54     # The location in which to cache the version, relative to $ETLA_TOP_DIR.
55     [ -z "$ETLA_CACHE_DIR" ] && ETLA_CACHE_DIR="${ETLA_VERSION}"
56    
57     # ETLA_CLEAN: set this to something to get a clean copy when updating (removes
58     # the working directory, then uses $ETLA_GET_CMD to re-download it.)
59    
60     # --- end ebuild-configurable settings ---
61    
62     # add tla to deps
63 mr_bones_ 1.3 DEPEND="dev-util/tla"
64 rphillips 1.1
65     # registers archives mentioned in $ETLA_ARCHIVES
66     tla_register_archives() {
67     debug-print-function $FUNCNAME $* $ETLA_ARCHIVES
68    
69     for archive in $ETLA_ARCHIVES; do
70 rphillips 1.2 $ETLA_TLA_CMD register-archive -f $archive || die "Could not register archive $archive"
71 rphillips 1.1 done
72     }
73    
74     # checks that configuration variables have rational values.
75     tla_check_vars() {
76     [ -z "$ETLA_VERSION" ] && die "ETLA_VERSION must be set by the ebuild. Please fix this ebuild."
77     $ETLA_TLA_CMD valid-package-name --archive --vsn $ETLA_VERSION || \
78     die "ETLA_VERSION has an invalid format. Please fix this ebuild."
79     }
80    
81     # is called from tla_src_unpack
82     tla_fetch() {
83    
84     debug-print-function $FUNCNAME $*
85    
86     if [ -n "$ETLA_CLEAN" ]; then
87     rm -rf $ETLA_TOP_DIR/$ETLA_CACHE_DIR
88     fi
89    
90     # create the top dir if needed
91     if [ ! -d "$ETLA_TOP_DIR" ]; then
92     # note that the addwrite statements in this block are only there to allow creating ETLA_TOP_DIR;
93     # we've already allowed writing inside it
94     # this is because it's simpler than trying to find out the parent path of the directory, which
95     # would need to be the real path and not a symlink for things to work (so we can't just remove
96     # the last path element in the string)
97     debug-print "$FUNCNAME: checkout mode. creating tla directory"
98     addwrite /foobar
99     addwrite /
100     mkdir -p "$ETLA_TOP_DIR"
101     export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
102     fi
103    
104     # in case ETLA_TOP_DIR is a symlink to a dir, get the real dir's path,
105     # otherwise addwrite() doesn't work.
106     cd -P "$ETLA_TOP_DIR" > /dev/null
107     ETLA_TOP_DIR="`/bin/pwd`"
108    
109     # disable the sandbox for this dir
110     addwrite "$ETLA_TOP_DIR"
111    
112     # break $ETLA_VERSION into pieces
113     local tla_archive=`$ETLA_TLA_CMD parse-package-name --arch $ETLA_VERSION`
114     local tla_version=`$ETLA_TLA_CMD parse-package-name --package-version $ETLA_VERSION`
115     #local tla_revision=`$ETLA_TLA_CMD parse-package-name --lvl $ETLA_VERSION`
116 swegener 1.8
117 rphillips 1.1 # determine checkout or update mode and change to the right directory.
118     if [ ! -d "$ETLA_TOP_DIR/$ETLA_CACHE_DIR/{arch}" ]; then
119     mode=get
120     mkdir -p "$ETLA_TOP_DIR/$ETLA_CACHE_DIR"
121     cd "$ETLA_TOP_DIR/$ETLA_CACHE_DIR/.."
122     rmdir "`basename "$ETLA_CACHE_DIR"`"
123     else
124     mode=update
125     cd "$ETLA_TOP_DIR/$ETLA_CACHE_DIR"
126     fi
127    
128     # switch versions automagically if needed
129     if [ "$mode" == "update" ]; then
130     local oldversion="`$ETLA_TLA_CMD tree-version`"
131     if [ "$tla_archive/$tla_version" != "$oldversion" ]; then
132    
133     einfo "Changing TLA version from $oldversion to $tla_archive/$tla_version:"
134     debug-print "$FUNCNAME: Changing TLA version from $oldversion to $tla_archive/$tla_version:"
135    
136     $ETLA_TLA_CMD set-tree-version $tla_archive/$tla_version
137    
138     fi
139     fi
140    
141     # commands to run
142     local cmdget="${ETLA_TLA_CMD} ${ETLA_GET_CMD} ${ETLA_VERSION} `basename $ETLA_CACHE_DIR`"
143     local cmdupdate="${ETLA_TLA_CMD} ${ETLA_UPDATE_CMD} ${ETLA_VERSION}"
144    
145     if [ "${mode}" == "get" ]; then
146 swegener 1.8 einfo "Running $cmdget"
147 rphillips 1.1 eval $cmdget || die "tla get command failed"
148     elif [ "${mode}" == "update" ]; then
149     einfo "Running $cmdupdate"
150     eval $cmdupdate || die "tla update command failed"
151     fi
152    
153     }
154    
155    
156     tla_src_unpack() {
157    
158     debug-print-function $FUNCNAME $*
159    
160     debug-print "$FUNCNAME: init:
161     ETLA_TLA_CMD=$ETLA_TLA_CMD
162     ETLA_GET_CMD=$ETLA_GET_CMD
163     ETLA_UPDATE_CMD=$ETLA_UPDATE_CMD
164     ETLA_TOP_DIR=$ETLA_TOP_DIR
165     ETLA_VERSION=$ETLA_VERSION
166     ETLA_ARCHIVES=$ETLA_ARCHIVES
167     ETLA_CACHE_DIR=$ETLA_CACHE_DIR
168     ETLA_CLEAN=$ETLA_CLEAN"
169    
170 vapier 1.5 einfo "Registering Archives ..."
171 rphillips 1.1 tla_register_archives
172    
173 vapier 1.5 einfo "Checking that passed-in variables are rational ..."
174 rphillips 1.1 tla_check_vars
175    
176 vapier 1.5 einfo "Fetching tla version $ETLA_VERSION into $ETLA_TOP_DIR ..."
177 rphillips 1.1 tla_fetch
178 swegener 1.8
179 vapier 1.5 einfo "Copying $ETLA_CACHE_DIR from $ETLA_TOP_DIR ..."
180     debug-print "Copying $ETLA_CACHE_DIR from $ETLA_TOP_DIR ..."
181 rphillips 1.1
182     # probably redundant, but best to make sure
183     # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside.
184     mkdir -p "${WORKDIR}/${P}"
185    
186 pacho 1.12 eshopts_push -s dotglob # get any dotfiles too.
187 rphillips 1.1 cp -Rf "$ETLA_TOP_DIR/$ETLA_CACHE_DIR"/* "${WORKDIR}/${P}"
188 pacho 1.12 eshopts_pop
189 rphillips 1.1
190     # implement some of base_src_unpack's functionality;
191     # note however that base.eclass may not have been inherited!
192     #if [ -n "$PATCHES" ]; then
193     # debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching"
194     # cd "$S"
195     # for x in $PATCHES; do
196     # debug-print "patching from $x"
197     # patch -p0 < "$x"
198     # done
199     # # make sure we don't try to apply patches more than once, since
200     # # tla_src_unpack may be called several times
201     # export PATCHES=""
202     #fi
203 swegener 1.8
204 rphillips 1.1 einfo "Version ${ETLA_VERSION} is now in ${WORKDIR}/${P}"
205     }
206    
207     EXPORT_FUNCTIONS src_unpack

  ViewVC Help
Powered by ViewVC 1.1.20