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

Diff of /eclass/eutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.327 Revision 1.349
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.327 2010/01/10 15:49:01 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.349 2010/08/19 21:32:26 vapier Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
17 17
18inherit multilib portability 18inherit multilib portability
19 19
20DESCRIPTION="Based on the ${ECLASS} eclass" 20DESCRIPTION="Based on the ${ECLASS} eclass"
21 21
22if has "${EAPI:-0}" 0 1 2; then
23
22# @FUNCTION: epause 24# @FUNCTION: epause
23# @USAGE: [seconds] 25# @USAGE: [seconds]
24# @DESCRIPTION: 26# @DESCRIPTION:
25# Sleep for the specified number of seconds (default of 5 seconds). Useful when 27# Sleep for the specified number of seconds (default of 5 seconds). Useful when
26# printing a message the user should probably be reading and often used in 28# printing a message the user should probably be reading and often used in
27# conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set, 29# conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set,
28# don't wait at all. 30# don't wait at all. Defined in EAPIs 0 1 and 2.
29epause() { 31epause() {
30 [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5} 32 [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5}
31} 33}
32 34
33# @FUNCTION: ebeep 35# @FUNCTION: ebeep
34# @USAGE: [number of beeps] 36# @USAGE: [number of beeps]
35# @DESCRIPTION: 37# @DESCRIPTION:
36# Issue the specified number of beeps (default of 5 beeps). Useful when 38# Issue the specified number of beeps (default of 5 beeps). Useful when
37# printing a message the user should probably be reading and often used in 39# printing a message the user should probably be reading and often used in
38# conjunction with the epause function. If the EBEEP_IGNORE env var is set, 40# conjunction with the epause function. If the EBEEP_IGNORE env var is set,
39# don't beep at all. 41# don't beep at all. Defined in EAPIs 0 1 and 2.
40ebeep() { 42ebeep() {
41 local n 43 local n
42 if [[ -z ${EBEEP_IGNORE} ]] ; then 44 if [[ -z ${EBEEP_IGNORE} ]] ; then
43 for ((n=1 ; n <= ${1:-5} ; n++)) ; do 45 for ((n=1 ; n <= ${1:-5} ; n++)) ; do
44 echo -ne "\a" 46 echo -ne "\a"
47 sleep 1 49 sleep 1
48 done 50 done
49 fi 51 fi
50} 52}
51 53
54else
55
56ebeep() {
57 ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
58}
59
60epause() {
61 ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
62}
63
64fi
65
66# @FUNCTION: eqawarn
67# @USAGE: [message]
68# @DESCRIPTION:
69# Proxy to einfo for package managers that don't provide eqawarn and use the PM
70# implementation if available.
71if ! declare -F eqawarn >/dev/null ; then
72 eqawarn() {
73 einfo "$@"
74 }
75fi
76
52# @FUNCTION: ecvs_clean 77# @FUNCTION: ecvs_clean
53# @USAGE: [list of dirs] 78# @USAGE: [list of dirs]
54# @DESCRIPTION: 79# @DESCRIPTION:
55# Remove CVS directories recursiveley. Useful when a source tarball contains 80# Remove CVS directories recursiveley. Useful when a source tarball contains
56# internal CVS directories. Defaults to $PWD. 81# internal CVS directories. Defaults to $PWD.
69 [[ -z $* ]] && set -- . 94 [[ -z $* ]] && set -- .
70 find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf 95 find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
71} 96}
72 97
73# @FUNCTION: eshopts_push 98# @FUNCTION: eshopts_push
74# @USAGE: [options to `set`] 99# @USAGE: [options to `set` or `shopt`]
75# @DESCRIPTION: 100# @DESCRIPTION:
76# Often times code will want to enable a shell option to change code behavior. 101# Often times code will want to enable a shell option to change code behavior.
77# Since changing shell options can easily break other pieces of code (which 102# Since changing shell options can easily break other pieces of code (which
78# assume the default state), eshopts_push is used to (1) push the current shell 103# assume the default state), eshopts_push is used to (1) push the current shell
79# options onto a stack and (2) pass the specified arguments to set. 104# options onto a stack and (2) pass the specified arguments to set.
105#
106# If the first argument is '-s' or '-u', we assume you want to call `shopt`
107# rather than `set` as there are some options only available via that.
80# 108#
81# A common example is to disable shell globbing so that special meaning/care 109# A common example is to disable shell globbing so that special meaning/care
82# may be used with variables/arguments to custom functions. That would be: 110# may be used with variables/arguments to custom functions. That would be:
83# @CODE 111# @CODE
84# eshopts_push -o noglob 112# eshopts_push -o noglob
92# @CODE 120# @CODE
93eshopts_push() { 121eshopts_push() {
94 # have to assume __ESHOPTS_SAVE__ isn't screwed with 122 # have to assume __ESHOPTS_SAVE__ isn't screwed with
95 # as a `declare -a` here will reset its value 123 # as a `declare -a` here will reset its value
96 local i=${#__ESHOPTS_SAVE__[@]} 124 local i=${#__ESHOPTS_SAVE__[@]}
125 if [[ $1 == -[su] ]] ; then
97 __ESHOPTS_SAVE__[$i]=$- 126 __ESHOPTS_SAVE__[$i]=$(shopt -p)
98 [[ $# -eq 0 ]] && return 0 127 [[ $# -eq 0 ]] && return 0
128 shopt "$@" || die "eshopts_push: bad options to shopt: $*"
129 else
130 __ESHOPTS_SAVE__[$i]=$-
131 [[ $# -eq 0 ]] && return 0
99 set "$@" || die "eshopts_push: bad options to set: $*" 132 set "$@" || die "eshopts_push: bad options to set: $*"
133 fi
100} 134}
101 135
102# @FUNCTION: eshopts_pop 136# @FUNCTION: eshopts_pop
103# @USAGE: 137# @USAGE:
104# @DESCRIPTION: 138# @DESCRIPTION:
108 [[ $# -ne 0 ]] && die "eshopts_pop takes no arguments" 142 [[ $# -ne 0 ]] && die "eshopts_pop takes no arguments"
109 local i=$(( ${#__ESHOPTS_SAVE__[@]} - 1 )) 143 local i=$(( ${#__ESHOPTS_SAVE__[@]} - 1 ))
110 [[ ${i} -eq -1 ]] && die "eshopts_{push,pop}: unbalanced pair" 144 [[ ${i} -eq -1 ]] && die "eshopts_{push,pop}: unbalanced pair"
111 local s=${__ESHOPTS_SAVE__[$i]} 145 local s=${__ESHOPTS_SAVE__[$i]}
112 unset __ESHOPTS_SAVE__[$i] 146 unset __ESHOPTS_SAVE__[$i]
147 if [[ ${s} == "shopt -"* ]] ; then
148 eval "${s}" || die "eshopts_pop: sanity: invalid shopt options: ${s}"
149 else
113 set +$- || die "eshopts_pop: sanity: invalid shell settings: $-" 150 set +$- || die "eshopts_pop: sanity: invalid shell settings: $-"
114 set -${s} || die "eshopts_pop: sanity: unable to restore saved shell settings: ${s}" 151 set -${s} || die "eshopts_pop: sanity: unable to restore saved shell settings: ${s}"
152 fi
115} 153}
116 154
117# @VARIABLE: EPATCH_SOURCE 155# @VARIABLE: EPATCH_SOURCE
118# @DESCRIPTION: 156# @DESCRIPTION:
119# Default directory to search for patches. 157# Default directory to search for patches.
263 # Let people filter things dynamically 301 # Let people filter things dynamically
264 if [[ -n ${EPATCH_EXCLUDE} ]] ; then 302 if [[ -n ${EPATCH_EXCLUDE} ]] ; then
265 # let people use globs in the exclude 303 # let people use globs in the exclude
266 eshopts_push -o noglob 304 eshopts_push -o noglob
267 305
268 local ex skip 306 local ex
269 for ex in ${EPATCH_EXCLUDE} ; do 307 for ex in ${EPATCH_EXCLUDE} ; do
270 [[ ${patchname} == ${ex} ]] && skip=1 308 if [[ ${patchname} == ${ex} ]] ; then
309 eshopts_pop
310 continue 2
311 fi
271 done 312 done
272 313
273 eshopts_pop 314 eshopts_pop
274
275 [[ ${skip} = 1 ]] && continue
276 fi 315 fi
277 316
278 if [[ ${SINGLE_PATCH} == "yes" ]] ; then 317 if [[ ${SINGLE_PATCH} == "yes" ]] ; then
279 if [[ -n ${EPATCH_SINGLE_MSG} ]] ; then 318 if [[ -n ${EPATCH_SINGLE_MSG} ]] ; then
280 einfo "${EPATCH_SINGLE_MSG}" 319 einfo "${EPATCH_SINGLE_MSG}"
394 EPATCH_SOURCE=${EPATCH_SOURCE} \ 433 EPATCH_SOURCE=${EPATCH_SOURCE} \
395 EPATCH_SUFFIX="patch" \ 434 EPATCH_SUFFIX="patch" \
396 EPATCH_FORCE="yes" \ 435 EPATCH_FORCE="yes" \
397 EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \ 436 EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \
398 epatch 437 epatch
399 break 438 return 0
400 fi 439 fi
401 done 440 done
441 return 1
402} 442}
403 443
404# @FUNCTION: emktemp 444# @FUNCTION: emktemp
405# @USAGE: [temp dir] 445# @USAGE: [temp dir]
406# @DESCRIPTION: 446# @DESCRIPTION:
678 fi 718 fi
679 ;; 719 ;;
680 720
681 *) 721 *)
682 if [[ -z $@ ]] ; then 722 if [[ -z $@ ]] ; then
683 useradd ${opts} \ 723 useradd -r ${opts} \
684 -c "added by portage for ${PN}" \ 724 -c "added by portage for ${PN}" \
685 ${euser} \ 725 ${euser} \
686 || die "enewuser failed" 726 || die "enewuser failed"
687 else 727 else
688 einfo " - Extra: $@" 728 einfo " - Extra: $@"
689 useradd ${opts} "$@" \ 729 useradd -r ${opts} "$@" \
690 ${euser} \ 730 ${euser} \
691 || die "enewuser failed" 731 || die "enewuser failed"
692 fi 732 fi
693 ;; 733 ;;
694 esac 734 esac
807 esac 847 esac
808 groupadd -g ${egid} ${egroup} || die "enewgroup failed" 848 groupadd -g ${egid} ${egroup} || die "enewgroup failed"
809 ;; 849 ;;
810 850
811 *) 851 *)
852 # We specify -r so that we get a GID in the system range from login.defs
812 groupadd ${opts} ${egroup} || die "enewgroup failed" 853 groupadd -r ${opts} ${egroup} || die "enewgroup failed"
813 ;; 854 ;;
814 esac 855 esac
815 export SANDBOX_ON="${oldsandbox}" 856 export SANDBOX_ON="${oldsandbox}"
816} 857}
817 858
828 869
829# Make a desktop file ! 870# Make a desktop file !
830# Great for making those icons in kde/gnome startmenu ! 871# Great for making those icons in kde/gnome startmenu !
831# Amaze your friends ! Get the women ! Join today ! 872# Amaze your friends ! Get the women ! Join today !
832# 873#
833# make_desktop_entry(<command>, [name], [icon], [type], [path]) 874# make_desktop_entry(<command>, [name], [icon], [type], [fields])
834# 875#
835# binary: what command does the app run with ? 876# binary: what command does the app run with ?
836# name: the name that will show up in the menu 877# name: the name that will show up in the menu
837# icon: give your little like a pretty little icon ... 878# icon: give your little like a pretty little icon ...
838# this can be relative (to /usr/share/pixmaps) or 879# this can be relative (to /usr/share/pixmaps) or
839# a full path to an icon 880# a full path to an icon
840# type: what kind of application is this ? for categories: 881# type: what kind of application is this ? for categories:
841# http://standards.freedesktop.org/menu-spec/latest/apa.html 882# http://standards.freedesktop.org/menu-spec/latest/apa.html
842# path: if your app needs to startup in a specific dir 883# fields: extra fields to append to the desktop file; a printf string
843make_desktop_entry() { 884make_desktop_entry() {
844 [[ -z $1 ]] && eerror "make_desktop_entry: You must specify the executable" && return 1 885 [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable"
845 886
846 local exec=${1} 887 local exec=${1}
847 local name=${2:-${PN}} 888 local name=${2:-${PN}}
848 local icon=${3:-${PN}} 889 local icon=${3:-${PN}}
849 local type=${4} 890 local type=${4}
850 local path=${5} 891 local fields=${5}
851 892
852 if [[ -z ${type} ]] ; then 893 if [[ -z ${type} ]] ; then
853 local catmaj=${CATEGORY%%-*} 894 local catmaj=${CATEGORY%%-*}
854 local catmin=${CATEGORY##*-} 895 local catmin=${CATEGORY##*-}
855 case ${catmaj} in 896 case ${catmaj} in
856 app) 897 app)
857 case ${catmin} in 898 case ${catmin} in
858 accessibility) type=Accessibility;; 899 accessibility) type=Accessibility;;
859 admin) type=System;; 900 admin) type=System;;
860 antivirus) type=System;; 901 antivirus) type=System;;
861 arch) type=Archiving;; 902 arch) type=Archiving;;
862 backup) type=Archiving;; 903 backup) type=Archiving;;
863 cdr) type=DiscBurning;; 904 cdr) type=DiscBurning;;
864 dicts) type=Dictionary;; 905 dicts) type=Dictionary;;
865 doc) type=Documentation;; 906 doc) type=Documentation;;
866 editors) type=TextEditor;; 907 editors) type=TextEditor;;
867 emacs) type=TextEditor;; 908 emacs) type=TextEditor;;
868 emulation) type=Emulator;; 909 emulation) type=Emulator;;
869 laptop) type=HardwareSettings;; 910 laptop) type=HardwareSettings;;
870 office) type=Office;; 911 office) type=Office;;
871 pda) type=PDA;; 912 pda) type=PDA;;
872 vim) type=TextEditor;; 913 vim) type=TextEditor;;
873 xemacs) type=TextEditor;; 914 xemacs) type=TextEditor;;
874 *) type=;;
875 esac 915 esac
876 ;; 916 ;;
877 917
878 dev) 918 dev)
879 type="Development" 919 type="Development"
880 ;; 920 ;;
881 921
882 games) 922 games)
883 case ${catmin} in 923 case ${catmin} in
884 action|fps) type=ActionGame;; 924 action|fps) type=ActionGame;;
885 arcade) type=ArcadeGame;; 925 arcade) type=ArcadeGame;;
886 board) type=BoardGame;; 926 board) type=BoardGame;;
887 emulation) type=Emulator;; 927 emulation) type=Emulator;;
888 kids) type=KidsGame;; 928 kids) type=KidsGame;;
889 puzzle) type=LogicGame;; 929 puzzle) type=LogicGame;;
890 roguelike) type=RolePlaying;; 930 roguelike) type=RolePlaying;;
891 rpg) type=RolePlaying;; 931 rpg) type=RolePlaying;;
892 simulation) type=Simulation;; 932 simulation) type=Simulation;;
893 sports) type=SportsGame;; 933 sports) type=SportsGame;;
894 strategy) type=StrategyGame;; 934 strategy) type=StrategyGame;;
895 *) type=;;
896 esac 935 esac
897 type="Game;${type}" 936 type="Game;${type}"
898 ;; 937 ;;
899 938
900 gnome) 939 gnome)
909 type="Network;Email" 948 type="Network;Email"
910 ;; 949 ;;
911 950
912 media) 951 media)
913 case ${catmin} in 952 case ${catmin} in
953 gfx)
914 gfx) type=Graphics;; 954 type=Graphics
955 ;;
956 *)
957 case ${catmin} in
915 radio) type=Tuner;; 958 radio) type=Tuner;;
916 sound) type=Audio;; 959 sound) type=Audio;;
917 tv) type=TV;; 960 tv) type=TV;;
918 video) type=Video;; 961 video) type=Video;;
919 *) type=;; 962 esac
963 type="AudioVideo;${type}"
964 ;;
920 esac 965 esac
921 type="AudioVideo;${type}"
922 ;; 966 ;;
923 967
924 net) 968 net)
925 case ${catmin} in 969 case ${catmin} in
926 dialup) type=Dialup;; 970 dialup) type=Dialup;;
927 ftp) type=FileTransfer;; 971 ftp) type=FileTransfer;;
928 im) type=InstantMessaging;; 972 im) type=InstantMessaging;;
929 irc) type=IRCClient;; 973 irc) type=IRCClient;;
930 mail) type=Email;; 974 mail) type=Email;;
931 news) type=News;; 975 news) type=News;;
932 nntp) type=News;; 976 nntp) type=News;;
933 p2p) type=FileTransfer;; 977 p2p) type=FileTransfer;;
934 *) type=;; 978 voip) type=Telephony;;
935 esac 979 esac
936 type="Network;${type}" 980 type="Network;${type}"
937 ;; 981 ;;
938 982
939 sci) 983 sci)
940 case ${catmin} in 984 case ${catmin} in
941 astro*) type=Astronomy;; 985 astro*) type=Astronomy;;
942 bio*) type=Biology;; 986 bio*) type=Biology;;
943 calc*) type=Calculator;; 987 calc*) type=Calculator;;
944 chem*) type=Chemistry;; 988 chem*) type=Chemistry;;
945 elec*) type=Electronics;; 989 elec*) type=Electronics;;
946 geo*) type=Geology;; 990 geo*) type=Geology;;
947 math*) type=Math;; 991 math*) type=Math;;
948 physics) type=Physics;; 992 physics) type=Physics;;
949 visual*) type=DataVisualization;; 993 visual*) type=DataVisualization;;
950 *) type=;;
951 esac 994 esac
952 type="Science;${type}" 995 type="Education;Science;${type}"
953 ;; 996 ;;
954 997
955 sys) 998 sys)
956 type="System" 999 type="System"
957 ;; 1000 ;;
958 1001
959 www) 1002 www)
960 case ${catmin} in 1003 case ${catmin} in
961 client) type=WebBrowser;; 1004 client) type=WebBrowser;;
962 *) type=;;
963 esac 1005 esac
964 type="Network" 1006 type="Network;${type}"
965 ;; 1007 ;;
966 1008
967 *) 1009 *)
968 type= 1010 type=
969 ;; 1011 ;;
974 else 1016 else
975 local desktop_name="${PN}-${SLOT}" 1017 local desktop_name="${PN}-${SLOT}"
976 fi 1018 fi
977 local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop" 1019 local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
978 #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop 1020 #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
1021
1022 # Don't append another ";" when a valid category value is provided.
1023 type=${type%;}${type:+;}
1024
1025 eshopts_push -s extglob
1026 if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
1027 ewarn "As described in the Icon Theme Specification, icon file extensions are not"
1028 ewarn "allowed in .desktop files if the value is not an absolute path."
1029 icon=${icon%.@(xpm|png|svg)}
1030 fi
1031 eshopts_pop
979 1032
980 cat <<-EOF > "${desktop}" 1033 cat <<-EOF > "${desktop}"
981 [Desktop Entry] 1034 [Desktop Entry]
982 Name=${name} 1035 Name=${name}
983 Type=Application 1036 Type=Application
984 Comment=${DESCRIPTION} 1037 Comment=${DESCRIPTION}
985 Exec=${exec} 1038 Exec=${exec}
986 TryExec=${exec%% *} 1039 TryExec=${exec%% *}
987 Icon=${icon} 1040 Icon=${icon}
988 Categories=${type}; 1041 Categories=${type}
989 EOF 1042 EOF
990 1043
991 [[ ${path} ]] && echo "Path=${path}" >> "${desktop}" 1044 if [[ ${fields:-=} != *=* ]] ; then
1045 # 5th arg used to be value to Path=
1046 ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}"
1047 fields="Path=${fields}"
1048 fi
1049 [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}"
992 1050
993 ( 1051 (
994 # wrap the env here so that the 'insinto' call 1052 # wrap the env here so that the 'insinto' call
995 # doesn't corrupt the env of the caller 1053 # doesn't corrupt the env of the caller
996 insinto /usr/share/applications 1054 insinto /usr/share/applications
997 doins "${desktop}" 1055 doins "${desktop}"
998 ) 1056 ) || die "installing desktop file failed"
999} 1057}
1000 1058
1001# @FUNCTION: validate_desktop_entries 1059# @FUNCTION: validate_desktop_entries
1002# @USAGE: [directories] 1060# @USAGE: [directories]
1003# @MAINTAINER: 1061# @MAINTAINER:
1282 [[ -z ${src} ]] && die "Could not locate source for '${src_input}'" 1340 [[ -z ${src} ]] && die "Could not locate source for '${src_input}'"
1283 1341
1284 local shrtsrc=$(basename "${src}") 1342 local shrtsrc=$(basename "${src}")
1285 echo ">>> Unpacking ${shrtsrc} to ${PWD}" 1343 echo ">>> Unpacking ${shrtsrc} to ${PWD}"
1286 if [[ -z ${skip} ]] ; then 1344 if [[ -z ${skip} ]] ; then
1287 local ver=$(grep -a '#.*Makeself' "${src}" | awk '{print $NF}') 1345 local ver=$(grep -m1 -a '#.*Makeself' "${src}" | awk '{print $NF}')
1288 local skip=0 1346 local skip=0
1289 exe=tail 1347 exe=tail
1290 case ${ver} in 1348 case ${ver} in
1291 1.5.*|1.6.0-nv) # tested 1.5.{3,4,5} ... guessing 1.5.x series is same 1349 1.5.*|1.6.0-nv) # tested 1.5.{3,4,5} ... guessing 1.5.x series is same
1292 skip=$(grep -a ^skip= "${src}" | cut -d= -f2) 1350 skip=$(grep -a ^skip= "${src}" | cut -d= -f2)
1294 2.0|2.0.1) 1352 2.0|2.0.1)
1295 skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-) 1353 skip=$(grep -a ^$'\t'tail "${src}" | awk '{print $2}' | cut -b2-)
1296 ;; 1354 ;;
1297 2.1.1) 1355 2.1.1)
1298 skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-) 1356 skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-)
1299 let skip="skip + 1" 1357 (( skip++ ))
1300 ;; 1358 ;;
1301 2.1.2) 1359 2.1.2)
1302 skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1) 1360 skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1)
1303 let skip="skip + 1" 1361 (( skip++ ))
1304 ;; 1362 ;;
1305 2.1.3) 1363 2.1.3)
1306 skip=`grep -a ^offset= "${src}" | awk '{print $3}'` 1364 skip=`grep -a ^offset= "${src}" | awk '{print $3}'`
1307 let skip="skip + 1" 1365 (( skip++ ))
1308 ;; 1366 ;;
1309 2.1.4|2.1.5) 1367 2.1.4|2.1.5)
1310 skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1) 1368 skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1)
1311 skip=$(head -n ${skip} "${src}" | wc -c) 1369 skip=$(head -n ${skip} "${src}" | wc -c)
1312 exe="dd" 1370 exe="dd"
1321 esac 1379 esac
1322 debug-print "Detected Makeself version ${ver} ... using ${skip} as offset" 1380 debug-print "Detected Makeself version ${ver} ... using ${skip} as offset"
1323 fi 1381 fi
1324 case ${exe} in 1382 case ${exe} in
1325 tail) exe="tail -n +${skip} '${src}'";; 1383 tail) exe="tail -n +${skip} '${src}'";;
1326 dd) exe="dd ibs=${skip} skip=1 obs=1024 conv=sync if='${src}'";; 1384 dd) exe="dd ibs=${skip} skip=1 if='${src}'";;
1327 *) die "makeself cant handle exe '${exe}'" 1385 *) die "makeself cant handle exe '${exe}'"
1328 esac 1386 esac
1329 1387
1330 # lets grab the first few bytes of the file to figure out what kind of archive it is 1388 # lets grab the first few bytes of the file to figure out what kind of archive it is
1331 local tmpfile=$(emktemp) 1389 local tmpfile=$(emktemp)
1464 export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}} 1522 export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}}
1465 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}" 1523 einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
1466 export CDROM_SET=-1 1524 export CDROM_SET=-1
1467 for f in ${CDROM_CHECK_1//:/ } ; do 1525 for f in ${CDROM_CHECK_1//:/ } ; do
1468 ((++CDROM_SET)) 1526 ((++CDROM_SET))
1469 [[ -e ${CD_ROOT}/${f} ]] && break 1527 [[ -e ${CDROM_ROOT}/${f} ]] && break
1470 done 1528 done
1471 export CDROM_MATCH=${f} 1529 export CDROM_MATCH=${f}
1472 return 1530 return
1473 fi 1531 fi
1474 1532
1742} 1800}
1743 1801
1744# @FUNCTION: built_with_use 1802# @FUNCTION: built_with_use
1745# @USAGE: [--hidden] [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags> 1803# @USAGE: [--hidden] [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags>
1746# @DESCRIPTION: 1804# @DESCRIPTION:
1805#
1806# Deprecated: Use EAPI 2 use deps in DEPEND|RDEPEND and with has_version calls.
1807#
1747# A temporary hack until portage properly supports DEPENDing on USE 1808# A temporary hack until portage properly supports DEPENDing on USE
1748# flags being enabled in packages. This will check to see if the specified 1809# flags being enabled in packages. This will check to see if the specified
1749# DEPEND atom was built with the specified list of USE flags. The 1810# DEPEND atom was built with the specified list of USE flags. The
1750# --missing option controls the behavior if called on a package that does 1811# --missing option controls the behavior if called on a package that does
1751# not actually support the defined USE flags (aka listed in IUSE). 1812# not actually support the defined USE flags (aka listed in IUSE).

Legend:
Removed from v.1.327  
changed lines
  Added in v.1.349

  ViewVC Help
Powered by ViewVC 1.1.20