Skip to content
Snippets Groups Projects
Commit bdace10a authored by Natanael Copa's avatar Natanael Copa
Browse files

newapkbuild: add -n option for setting name

So we can set pkgname if it differs from download archive name
parent 1187cc5c
No related merge requests found
......@@ -101,22 +101,25 @@ newaport() {
pv=${newname#$pn-}
pv=${pv%.t*} #strip .tar.gz .tgz .tar.bz2 etc
fi
if [ -e "$pn"/APKBUILD ] && [ -z "$force" ]; then
error "$pn/APKBUILD already exist"
if [ -z "$pkgname" ]; then
pkgname=$pn
fi
if [ -e "$pkgname"/APKBUILD ] && [ -z "$force" ]; then
error "$pkgname/APKBUILD already exist"
return 1
fi
mkdir -p "$pn"
cd "$pn"
mkdir -p "$pkgname"
cd "$pkgname"
if [ -z "$source" ] && [ -n "$sourceforge" ]; then
source="http://downloads.sourceforge.net/$pn/$pn-$pv.tar.gz"
fi
if [ -z "$depends" ] &&[ "$buildtype" == "python" ]; then
if [ -z "$depends" ] &&[ "$buildtype" = "python" ]; then
depends="python"
fi
if [ -z "$makedepends" ] &&[ "$buildtype" == "python" ]; then
if [ -z "$makedepends" ] &&[ "$buildtype" = "python" ]; then
makedepends="python-dev"
else
makedepends="\$depends_dev"
......@@ -129,14 +132,14 @@ newaport() {
# Copy init.d scripts if requested
if [ -n "$cpinitd" ]; then
cp "$datadir"/sample.initd $pn.initd
cp "$datadir"/sample.confd $pn.confd
cp "$datadir"/sample.pre-install $pn.pre-install
cp "$datadir"/sample.post-install $pn.post-install
cp "$datadir"/sample.initd $pkgname.initd
cp "$datadir"/sample.confd $pkgname.confd
cp "$datadir"/sample.pre-install $pkgname.pre-install
cp "$datadir"/sample.post-install $pkgname.post-install
install="\$pkgname.pre-install \$pkgname.post-install"
source="$source
$pn.initd
$pn.confd
$pkgname.initd
$pkgname.confd
"
fi
......@@ -144,7 +147,7 @@ newaport() {
cat >APKBUILD<<__EOF__
# Contributor:${PACKAGER:+" "}${PACKAGER}
# Maintainer:${MAINTAINER:+" "}${MAINTAINER}
pkgname=$pn
pkgname=$pkgname
pkgver=$pv
pkgrel=0
pkgdesc="$pkgdesc"
......@@ -255,11 +258,12 @@ __EOF__
}
__EOF__
abuild -f checksum
}
usage() {
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 " -a Create autotools (use ./configure ...)"
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 " -h Show this help"
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 " -y Create python package (Assume setup.py is there)"
echo " -u Set package URL"
......@@ -275,7 +280,7 @@ usage() {
exit 0
}
while getopts "acd:fhl:pyu:s" opt; do
while getopts "acd:fhl:n:pyu:s" opt; do
case $opt in
'a') buildtype="autotools";;
'c') cpinitd=1;;
......@@ -283,6 +288,7 @@ while getopts "acd:fhl:pyu:s" opt; do
'f') force=1;;
'h') usage;;
'l') license="$OPTARG";;
'n') pkgname="$OPTARG";;
'p') buildtype="perl";;
'y') buildtype="python";;
'u') url="$OPTARG";;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment