8 |
{ |
{ |
9 |
local file="$1" |
local file="$1" |
10 |
local mystate |
local mystate |
11 |
local mycodename |
local mytag |
12 |
|
|
13 |
source ${file} |
source ${file} |
14 |
|
|
15 |
|
# if PCAT was not set and PCATEGORIE was found |
16 |
|
# inform the user and use PCATEGORIE as PCAT |
17 |
|
if [[ -z ${PCAT} ]] |
18 |
|
then |
19 |
|
if [[ -n ${PCATEGORIE} ]] |
20 |
|
then |
21 |
|
PCAT="${PCATEGORIE}" |
22 |
|
# print a warning |
23 |
|
echo -e "${COLYELLOW}Warning: 'PCATEGORIE' is deprecated and gets removed in the future.${COLDEFAULT}" |
24 |
|
echo -e "${COLYELLOW} Please modify this smage2 script to use the 'PCAT' variable.${COLDEFAULT}" |
25 |
|
echo |
26 |
|
else |
27 |
|
die "Neither PCAT nor PCATEGORIE are defined!" |
28 |
|
fi |
29 |
|
fi |
30 |
|
|
31 |
[[ -n ${STATE} ]] && mystate="${STATE}" |
[[ -n ${STATE} ]] && mystate="${STATE}" |
32 |
|
[[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" |
33 |
|
|
34 |
# do not overide if local state was broken or disabled! |
# do not overide if local state was broken or disabled! |
35 |
case ${STATE} in |
case ${STATE} in |
41 |
then |
then |
42 |
source ${SMAGESCRIPTSDIR}/distribution |
source ${SMAGESCRIPTSDIR}/distribution |
43 |
[[ -n ${STATE} ]] && mystate="${STATE}" |
[[ -n ${STATE} ]] && mystate="${STATE}" |
44 |
|
[[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" |
45 |
fi |
fi |
46 |
# now switch state and export it |
# now switch state and export it |
47 |
STATE="${mystate}" |
STATE="${mystate}" |
48 |
|
|
49 |
|
if mqueryfeature "pkgdistrotag" |
50 |
|
then |
51 |
|
# if DISTROTAG was not defined globally |
52 |
|
# or in distribution file then deactivate this feature! |
53 |
|
# at this point $mytag must have the distrotag |
54 |
|
if [[ -z ${mytag} ]] |
55 |
|
then |
56 |
|
FVERBOSE=off msetfeature "!pkgdistrotag" |
57 |
|
unset DISTROTAG |
58 |
|
echo -e "${COLRED}Requested 'pkgdistrotag' but no \$DISTROTAG found!${COLDEFAULT}" |
59 |
|
echo -e "${COLRED}Disabled the feature for pkgbuild sanity!${COLDEFAULT}" |
60 |
|
else |
61 |
|
# now switch state and export it |
62 |
|
export DISTROTAG="${mytag}" |
63 |
|
fi |
64 |
|
else |
65 |
|
unset DISTROTAG |
66 |
|
fi |
67 |
|
} |
68 |
|
|
69 |
|
print_distrotag() |
70 |
|
{ |
71 |
|
if FVERBOSE=off mqueryfeature "pkgdistrotag" |
72 |
|
then |
73 |
|
if [[ ! -z ${DISTROTAG} ]] |
74 |
|
then |
75 |
|
# add a point as prefix |
76 |
|
echo ".${DISTROTAG}" |
77 |
|
fi |
78 |
|
fi |
79 |
} |
} |
80 |
|
|
81 |
showversion() |
showversion() |
655 |
# PNAME name of pkg |
# PNAME name of pkg |
656 |
# PVER version |
# PVER version |
657 |
# PBUILD revision |
# PBUILD revision |
658 |
# PCATEGORIE category of the pkg |
# PCAT category of the pkg |
659 |
|
# PCATEGORIE category of the pkg (deprecated, use PCAT!) |
660 |
# STATE state of pkg stable|unstable|old |
# STATE state of pkg stable|unstable|old |
661 |
# DESCRIPTION a short description (opt) |
# DESCRIPTION a short description (opt) |
662 |
# HOMEPAGE homepage (opt) |
# HOMEPAGE homepage (opt) |
663 |
|
# LICENSE license information of the pkg (opt) |
664 |
# DEPEND runtime dependencies (opt) |
# DEPEND runtime dependencies (opt) |
665 |
# SDEPEND adds needed deps to build the pkg (opt) |
# SDEPEND adds needed deps to build the pkg (opt) |
666 |
# PROVIDE provides a virtual (opt) |
# PROVIDE provides a virtual (opt) |
700 |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
701 |
|
|
702 |
# destination to magefile |
# destination to magefile |
703 |
dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}" |
dest="${MAGE_TREE_DEST}/${PCAT}/${PNAME}${target}/${magefile}" |
704 |
|
|
705 |
# show what we are doing |
# show what we are doing |
706 |
echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}" |
711 |
> ${dest} |
> ${dest} |
712 |
|
|
713 |
# pgkname and state |
# pgkname and state |
714 |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}$(print_distrotag)-${PBUILD}\"" >> ${dest} |
715 |
echo "STATE=\"${STATE}\"" >> ${dest} |
echo "STATE=\"${STATE}\"" >> ${dest} |
716 |
|
|
717 |
# description and homepage |
# description and homepage |
718 |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
719 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
720 |
|
|
721 |
|
# license information |
722 |
|
echo "LICENSE=\"${LICENSE}\"" >> ${dest} |
723 |
|
|
724 |
# special tags and vars |
# special tags and vars |
725 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
726 |
|
|
863 |
export SAVED_PNAME="${PNAME}" |
export SAVED_PNAME="${PNAME}" |
864 |
export SAVED_PVER="${PVER}" |
export SAVED_PVER="${PVER}" |
865 |
export SAVED_PBUILD="${PBUILD}" |
export SAVED_PBUILD="${PBUILD}" |
866 |
export SAVED_PCATEGORIE="${PCATEGORIE}" |
export SAVED_PCAT="${PCAT}" |
867 |
export SAVED_DESCRIPTION="${DESCRIPTION}" |
export SAVED_DESCRIPTION="${DESCRIPTION}" |
868 |
export SAVED_HOMEPAGE="${HOMEPAGE}" |
export SAVED_HOMEPAGE="${HOMEPAGE}" |
869 |
export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" |
export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" |
938 |
export PNAME="${SAVED_PNAME}" |
export PNAME="${SAVED_PNAME}" |
939 |
export PVER="${SAVED_PVER}" |
export PVER="${SAVED_PVER}" |
940 |
export PBUILD="${SAVED_PBUILD}" |
export PBUILD="${SAVED_PBUILD}" |
941 |
export PCATEGORIE="${SAVED_PCATEGORIE}" |
export PCAT="${SAVED_PCAT}" |
942 |
export DESCRIPTION="${SAVED_DESCRIPTION}" |
export DESCRIPTION="${SAVED_DESCRIPTION}" |
943 |
export HOMEPAGE="${SAVED_HOMEPAGE}" |
export HOMEPAGE="${SAVED_HOMEPAGE}" |
944 |
export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" |
export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" |
1007 |
unset SAVED_PNAME |
unset SAVED_PNAME |
1008 |
unset SAVED_PVER |
unset SAVED_PVER |
1009 |
unset SAVED_PBUILD |
unset SAVED_PBUILD |
1010 |
unset SAVED_PCATEGORIE |
unset SAVED_PCAT |
1011 |
unset SAVED_DESCRIPTION |
unset SAVED_DESCRIPTION |
1012 |
unset SAVED_HOMEPAGE |
unset SAVED_HOMEPAGE |
1013 |
unset SAVED_SPECIAL_VARS |
unset SAVED_SPECIAL_VARS |
1123 |
[ -n "${target}" ] && target="-${target}" |
[ -n "${target}" ] && target="-${target}" |
1124 |
|
|
1125 |
# build pkgname |
# build pkgname |
1126 |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
pkgname="${pname}${target}-${pver}-${parch}$(print_distrotag)-${pbuild}" |
1127 |
|
|
1128 |
# build pkg-md5-sum only if requested |
# build pkg-md5-sum only if requested |
1129 |
if mqueryfeature regentree |
if mqueryfeature regentree |