Contents of /trunk/mage/usr/lib/mage/pkg_all_sources.sh
Parent Directory | Revision Log
Revision 1955 -
(show annotations)
(download)
(as text)
Fri Oct 12 13:04:00 2012 UTC (11 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1853 byte(s)
Fri Oct 12 13:04:00 2012 UTC (11 years, 11 months ago) by niro
File MIME type: application/x-sh
File size: 1853 byte(s)
-fixed whitespaces
1 | #!/bin/bash |
2 | # build all source packages for given distribution |
3 | |
4 | : ${MAGERC="/etc/mage.rc"} |
5 | |
6 | source /etc/mage.rc.global |
7 | source ${MAGERC} |
8 | source ${MLIBDIR}/mage4.functions.sh |
9 | source ${MLIBDIR}/smage2.functions.sh |
10 | |
11 | if ! have_root_privileges |
12 | then |
13 | echo "You must be r00t" |
14 | exit 1 |
15 | fi |
16 | |
17 | DISTRI="$1" |
18 | |
19 | if [[ -z ${DISTRI} ]] |
20 | then |
21 | echo "No Distribution given ..." |
22 | exit 1 |
23 | fi |
24 | |
25 | blacklisted() |
26 | { |
27 | local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${DISTRI}" |
28 | |
29 | # return 0 if the list not exist; nothin is masked |
30 | [[ ! -f ${EXCLUDED} ]] && return 0 |
31 | |
32 | local SMAGEFILE="$1" |
33 | |
34 | smagesource ${SMAGEFILE} |
35 | |
36 | local EXPCAT EXPNAME EXPVER EXPBUILD |
37 | while read EXPCAT EXPNAME EXPVER EXPBUILD |
38 | do |
39 | # ignore spaces and comments |
40 | case "${EXPCAT}" in |
41 | \#*|"") continue ;; |
42 | esac |
43 | |
44 | # exclude full pver |
45 | if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && |
46 | [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && |
47 | [[ -n ${PVER} ]] && [[ -n ${PBUILD} ]] && |
48 | [[ -n ${EXPVER} ]] && [[ -n ${EXPBUILD} ]] |
49 | then |
50 | [[ ${EXPCAT}/${EXPNAME}-${EXPVER}-${EXPBUILD} = ${PCAT}/${PNAME}-${PVER}-${PBUILD} ]] && return 1 |
51 | fi |
52 | |
53 | # exclude pcat/pname only |
54 | if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && |
55 | [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && |
56 | [[ -z ${EXPVER} ]] && [[ -z ${EXPBUILD} ]] |
57 | then |
58 | [[ ${EXPCAT}/${EXPNAME} = ${PCAT}/${PNAME} ]] && return 1 |
59 | fi |
60 | done << EOF |
61 | $(cat ${EXCLUDED}; echo) |
62 | EOF |
63 | return 0 |
64 | } |
65 | |
66 | ALLSMAGES=$(grep -irl ${DISTRI} ${SMAGESCRIPTSDIR}/*/*.smage2) |
67 | |
68 | for smage in ${ALLSMAGES} |
69 | do |
70 | # continue if pkg already exists |
71 | [[ -f ${PKGDIR}/sources/$(basename ${smage} .smage2).mpks ]] && continue |
72 | # continue if a virtual pkg |
73 | [[ -n $(grep -irl 'PKGTYPE="virtual"' ${smage}) ]] && continue |
74 | [[ -n $(grep -irl 'PKGTYPE=virtual' ${smage}) ]] && continue |
75 | # handle blacklisted packages |
76 | blacklisted ${smage} || continue |
77 | |
78 | smage2 --create-src-tarball ${smage} |
79 | done |