Magellan Linux

Annotation of /branches/mage-next/usr/lib/mage/pkg_all_sources.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 423 - (hide annotations) (download) (as text)
Mon Feb 5 17:11:36 2007 UTC (17 years, 3 months ago) by niro
Original Path: trunk/mage/usr/lib/mage/pkg_all_sources.sh
File MIME type: application/x-sh
File size: 1820 byte(s)
commited to archive

1 niro 423 #!/bin/bash
2     # build all source packages for given distribution
3    
4     if [[ $(id -u) != 0 ]]
5     then
6     echo "You must be r00t"
7     exit 1
8     fi
9    
10     DISTRI="$1"
11    
12     if [[ -z ${DISTRI} ]]
13     then
14     echo "No Distribution given ..."
15     exit 1
16     fi
17    
18     source /etc/mage.rc.global
19     source /etc/mage.rc
20    
21     sminclude() { true; }
22    
23     blacklisted()
24     {
25     local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${DISTRI}"
26    
27     # return 0 if the list not exist; nothin is masked
28     [[ ! -f ${EXCLUDED} ]] && return 0
29    
30     local SMAGEFILE="$1"
31    
32     source ${SMAGEFILE}
33    
34     local EXPCAT EXPNAME EXPVER EXPBUILD
35     while read EXPCAT EXPNAME EXPVER EXPBUILD
36     do
37     # ignore spaces and comments
38     case "${EXPCAT}" in
39     \#*|"") continue ;;
40     esac
41    
42     # exclude full pver
43     if [[ -n ${PCATEGORIE} ]] && [[ -n ${PNAME} ]] &&
44     [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] &&
45     [[ -n ${PVER} ]] && [[ -n ${PBUILD} ]] &&
46     [[ -n ${EXPVER} ]] && [[ -n ${EXPBUILD} ]]
47     then
48     [[ ${EXPCAT}/${EXPNAME}-${EXPVER}-${EXPBUILD} = ${PCATEGORIE}/${PNAME}-${PVER}-${PBUILD} ]] && return 1
49     fi
50    
51     # exclude pcat/pname only
52     if [[ -n ${PCATEGORIE} ]] && [[ -n ${PNAME} ]] &&
53     [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] &&
54     [[ -z ${EXPVER} ]] && [[ -z ${EXPBUILD} ]]
55     then
56     [[ ${EXPCAT}/${EXPNAME} = ${PCATEGORIE}/${PNAME} ]] && return 1
57     fi
58     done << EOF
59     $(cat ${EXCLUDED}; echo)
60     EOF
61     return 0
62     }
63    
64     ALLSMAGES=$(grep -irl ${DISTRI} ${SMAGESCRIPTSDIR}/*/*.smage2)
65    
66     for smage in ${ALLSMAGES}
67     do
68     # continue if pkg already exists
69     [[ -f ${PKGDIR}/sources/$(basename ${smage} .smage2).mpks ]] && continue
70     # continue if a virtual pkg
71     [[ -n $(grep -irl 'PKGTYPE="virtual"' ${smage}) ]] && continue
72     [[ -n $(grep -irl 'PKGTYPE=virtual' ${smage}) ]] && continue
73     # handle blacklisted packages
74     blacklisted ${smage} || continue
75    
76     smage2 --create-src-tarball ${smage}
77     done