newapkbuild: add -n option for setting name
So we can set pkgname if it differs from download archive name
This commit is contained in:
parent
1187cc5c0a
commit
bdace10aa6
@ -101,22 +101,25 @@ newaport() {
|
|||||||
pv=${newname#$pn-}
|
pv=${newname#$pn-}
|
||||||
pv=${pv%.t*} #strip .tar.gz .tgz .tar.bz2 etc
|
pv=${pv%.t*} #strip .tar.gz .tgz .tar.bz2 etc
|
||||||
fi
|
fi
|
||||||
if [ -e "$pn"/APKBUILD ] && [ -z "$force" ]; then
|
if [ -z "$pkgname" ]; then
|
||||||
error "$pn/APKBUILD already exist"
|
pkgname=$pn
|
||||||
|
fi
|
||||||
|
if [ -e "$pkgname"/APKBUILD ] && [ -z "$force" ]; then
|
||||||
|
error "$pkgname/APKBUILD already exist"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
mkdir -p "$pn"
|
mkdir -p "$pkgname"
|
||||||
cd "$pn"
|
cd "$pkgname"
|
||||||
|
|
||||||
if [ -z "$source" ] && [ -n "$sourceforge" ]; then
|
if [ -z "$source" ] && [ -n "$sourceforge" ]; then
|
||||||
source="http://downloads.sourceforge.net/$pn/$pn-$pv.tar.gz"
|
source="http://downloads.sourceforge.net/$pn/$pn-$pv.tar.gz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$depends" ] &&[ "$buildtype" == "python" ]; then
|
if [ -z "$depends" ] &&[ "$buildtype" = "python" ]; then
|
||||||
depends="python"
|
depends="python"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$makedepends" ] &&[ "$buildtype" == "python" ]; then
|
if [ -z "$makedepends" ] &&[ "$buildtype" = "python" ]; then
|
||||||
makedepends="python-dev"
|
makedepends="python-dev"
|
||||||
else
|
else
|
||||||
makedepends="\$depends_dev"
|
makedepends="\$depends_dev"
|
||||||
@ -129,14 +132,14 @@ newaport() {
|
|||||||
|
|
||||||
# Copy init.d scripts if requested
|
# Copy init.d scripts if requested
|
||||||
if [ -n "$cpinitd" ]; then
|
if [ -n "$cpinitd" ]; then
|
||||||
cp "$datadir"/sample.initd $pn.initd
|
cp "$datadir"/sample.initd $pkgname.initd
|
||||||
cp "$datadir"/sample.confd $pn.confd
|
cp "$datadir"/sample.confd $pkgname.confd
|
||||||
cp "$datadir"/sample.pre-install $pn.pre-install
|
cp "$datadir"/sample.pre-install $pkgname.pre-install
|
||||||
cp "$datadir"/sample.post-install $pn.post-install
|
cp "$datadir"/sample.post-install $pkgname.post-install
|
||||||
install="\$pkgname.pre-install \$pkgname.post-install"
|
install="\$pkgname.pre-install \$pkgname.post-install"
|
||||||
source="$source
|
source="$source
|
||||||
$pn.initd
|
$pkgname.initd
|
||||||
$pn.confd
|
$pkgname.confd
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -144,7 +147,7 @@ newaport() {
|
|||||||
cat >APKBUILD<<__EOF__
|
cat >APKBUILD<<__EOF__
|
||||||
# Contributor:${PACKAGER:+" "}${PACKAGER}
|
# Contributor:${PACKAGER:+" "}${PACKAGER}
|
||||||
# Maintainer:${MAINTAINER:+" "}${MAINTAINER}
|
# Maintainer:${MAINTAINER:+" "}${MAINTAINER}
|
||||||
pkgname=$pn
|
pkgname=$pkgname
|
||||||
pkgver=$pv
|
pkgver=$pv
|
||||||
pkgrel=0
|
pkgrel=0
|
||||||
pkgdesc="$pkgdesc"
|
pkgdesc="$pkgdesc"
|
||||||
@ -255,11 +258,12 @@ __EOF__
|
|||||||
}
|
}
|
||||||
|
|
||||||
__EOF__
|
__EOF__
|
||||||
|
abuild -f checksum
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "$prog $version"
|
echo "$prog $version"
|
||||||
echo "usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-u URL] PKGNAME[-PKGVER]"
|
echo "usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-n NAME] [-u URL] PKGNAME[-PKGVER]|SRCURL"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -a Create autotools (use ./configure ...)"
|
echo " -a Create autotools (use ./configure ...)"
|
||||||
echo " -c Copy a sample init.d, conf.d, and install script to new directory"
|
echo " -c Copy a sample init.d, conf.d, and install script to new directory"
|
||||||
@ -267,6 +271,7 @@ usage() {
|
|||||||
echo " -f Force even if directory already exist"
|
echo " -f Force even if directory already exist"
|
||||||
echo " -h Show this help"
|
echo " -h Show this help"
|
||||||
echo " -l Set package license to LICENSE"
|
echo " -l Set package license to LICENSE"
|
||||||
|
echo " -n Set package name to NAME"
|
||||||
echo " -p Create perl package (Assume Makefile.PL is there)"
|
echo " -p Create perl package (Assume Makefile.PL is there)"
|
||||||
echo " -y Create python package (Assume setup.py is there)"
|
echo " -y Create python package (Assume setup.py is there)"
|
||||||
echo " -u Set package URL"
|
echo " -u Set package URL"
|
||||||
@ -275,7 +280,7 @@ usage() {
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "acd:fhl:pyu:s" opt; do
|
while getopts "acd:fhl:n:pyu:s" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
'a') buildtype="autotools";;
|
'a') buildtype="autotools";;
|
||||||
'c') cpinitd=1;;
|
'c') cpinitd=1;;
|
||||||
@ -283,6 +288,7 @@ while getopts "acd:fhl:pyu:s" opt; do
|
|||||||
'f') force=1;;
|
'f') force=1;;
|
||||||
'h') usage;;
|
'h') usage;;
|
||||||
'l') license="$OPTARG";;
|
'l') license="$OPTARG";;
|
||||||
|
'n') pkgname="$OPTARG";;
|
||||||
'p') buildtype="perl";;
|
'p') buildtype="perl";;
|
||||||
'y') buildtype="python";;
|
'y') buildtype="python";;
|
||||||
'u') url="$OPTARG";;
|
'u') url="$OPTARG";;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user