summaryrefslogtreecommitdiffstats
path: root/newapkbuild.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-12-21 16:57:09 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2011-12-21 16:57:09 +0100
commitbdace10aa60c7f0e3c4aa48a7105df514c075402 (patch)
tree689e4160db5e735d8170c15d68edd77fa377d8ad /newapkbuild.in
parent1187cc5c0a5afea749859d1acecdaae2a3bd9934 (diff)
downloadabuild-bdace10aa60c7f0e3c4aa48a7105df514c075402.tar.bz2
abuild-bdace10aa60c7f0e3c4aa48a7105df514c075402.tar.xz
newapkbuild: add -n option for setting name
So we can set pkgname if it differs from download archive name
Diffstat (limited to 'newapkbuild.in')
-rwxr-xr-xnewapkbuild.in36
1 files changed, 21 insertions, 15 deletions
diff --git a/newapkbuild.in b/newapkbuild.in
index 85f87b5..56683ac 100755
--- a/newapkbuild.in
+++ b/newapkbuild.in
@@ -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";;