Changeset 58
- Timestamp:
- 02/16/2006 09:23:46 PM (2 years ago)
- Files:
-
- bpkg/trunk/bpkg (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bpkg/trunk/bpkg
r57 r58 70 70 EXPLICIT_PACKAGE=0 71 71 REQUIRED_PROGRAMS='installwatch cpio perl tar bzip2 unzip gzip' 72 DESCRIPTION="Automatically generated by $SELF" 72 73 MD5SUM='none' 73 74 … … 203 204 } 204 205 206 build_pre_python() 207 { 208 if [ $EXPLICIT_PACKAGE = 0 -] && [[ $PACKAGE != py* ]]; then 209 PACKAGE=python-$PACKAGE 210 fi 211 } 212 205 213 build_python() 206 214 { 207 215 python setup.py build -f 216 } 217 218 build_pre_perl() 219 { 220 if [ $EXPLICIT_PACKAGE = 0 ] && [[ $PACKAGE != perl* ]]; then 221 PACKAGE=perl-$PACKAGE 222 fi 223 } 224 225 build_post_perl() 226 { 227 notice "Adding Perl packlist contents to package manifest" 228 cat `find "$DESTROOT" -name .packlist` | duplicate_paths "$DESTROOT" 208 229 } 209 230 … … 228 249 packager_slackware() 229 250 { 230 installer231 251 cd $DESTROOT 232 252 local out=$PKGDIR/$PACKAGE-$PACKAGEVER-i386-$PACKAGEREL.tgz … … 249 269 { 250 270 pacman -Q "$PACKAGE" > /dev/null 2>&1 && error "package '$PACKAGE' already installed, remove it before packaging" 271 if echo "$PACKAGEVER" | grep -q -- -; then 272 PACKAGEVER=${PACKAGEVER//-/_} 273 fi 251 274 } 252 275 253 276 packager_arch() 254 277 { 255 installer256 278 local configs=`(cd $DESTROOT && find etc -type f) 2> /dev/null` 257 279 local deps=`(cd $DESTROOT && find . -type f | xargs --no-run-if-empty file | grep 'ELF.*executable' | cut -d: -f1 | xargs --no-run-if-empty ldd 2> /dev/null | awk '{print $3}' | grep ^/ | xargs --no-run-if-empty pacman -Qo 2> /dev/null | awk '{print $5}' | sort | uniq) 2> /dev/null` … … 263 285 pkgver=$PACKAGEVER 264 286 pkgrel=$PACKAGEREL 265 pkgdesc=" Automatically generated by $SELF"287 pkgdesc="$DESCRIPTION" 266 288 url="http://swapoff.org/$SELF" 267 289 depends=($deps) … … 290 312 packager_gentoo() 291 313 { 292 installer293 314 #local deps=`(cd $DESTROOT && find . -type f | xargs --no-run-if-empty file | grep 'ELF.*executable' | cut -d: -f1 | xargs --no-run-if-empty ldd 2> /dev/null | awk '{print $3}' | grep ^/ | xargs --no-run-if-empty pacman -Qo 2> /dev/null | awk '{print $5}' | sort | uniq) 2> /dev/null` 294 315 ls -d /usr/portage/*/$PACKAGE > /dev/null 2>&1 && error "Package '$PACKAGE' already exists in portage." … … 376 397 quitloop=0 377 398 while [ $quitloop = 0 -a $# != 0 ]; do 378 if [[ -f "$1" || "$1" = ftp://* || "$1" = http://* ]]; then 379 AUTOEXTRACT="$1" 399 TARGET="$1" 400 if [[ "$TARGET" = cpan://* ]]; then 401 CPAN_MODULE=`basename "$TARGET"` 402 notice "Attempting to download CPAN module $CPAN_MODULE" 403 TARGET=`perl -MCPAN -e "get '$CPAN_MODULE'" | grep Checksum | awk '{print $3}'` 404 test -f "$TARGET" || error "failed to fetch $CPAN_MODULE from CPAN, try 'perl -MCPAN -e \"get '$CPAN_MODULE'\"" 405 PACKAGE=`echo "$CPAN_MODULE" | sed -e 's/:\\+/-/g' | tr A-Z a-z` 406 if [[ $PACKAGE != perl-* ]]; then 407 PACKAGE=perl-$PACKAGE 408 fi 409 PACKAGEVER=`perl -MCPAN -e "print CPAN::Shell->m(\"$CPAN_MODULE\")" | grep CPAN_VERSION | awk '{print $2}'` 410 EXPLICIT_PACKAGE=1 411 fi 412 413 if [[ -f "$TARGET" || "$TARGET" = ftp://* || "$TARGET" = http://* ]]; then 414 AUTOEXTRACT="$TARGET" 380 415 if [[ "$AUTOEXTRACT" == *bz2 || "$AUTOEXTRACT" == *tbz ]]; then 381 416 FLAGS=j … … 424 459 fi 425 460 else 426 case $ 1in461 case $TARGET in 427 462 --version) 428 463 echo $VERSION … … 457 492 obtained by extracting the package name and version from the package 458 493 source directory name. 494 --description=<description> 495 Specify a package description. Default is 'Automatically generated by 496 bpkg'. 459 497 --unique 460 498 Pass options to autoconf to install into configuration and data directories … … 471 509 Verify that the source file has the given MD5 checksum. 472 510 473 For further information ,including examples, visit http://swapoff.org/bpkg511 For further information including examples, visit http://swapoff.org/bpkg 474 512 EOF 475 513 exit 0 476 514 ;; 515 --description=*) 516 DESCRIPTION=`echo "$TARGET" | cut -d= -f2-` 517 ;; 477 518 --install-with=*) 478 INSTALLER=`echo "$ 1" | cut -d= -f2-`519 INSTALLER=`echo "$TARGET" | cut -d= -f2-` 479 520 ;; 480 521 --build-with=*) 481 CUSTOMBUILDER=`echo "$ 1" | cut -d= -f2-`522 CUSTOMBUILDER=`echo "$TARGET" | cut -d= -f2-` 482 523 BUILDER=custom 483 524 ;; … … 486 527 ;; 487 528 --prefix=*) 488 PREFIX=`echo $ 1| cut -d= -f2-`529 PREFIX=`echo $TARGET | cut -d= -f2-` 489 530 ;; 490 531 --sysconfdir=*) 491 SYSCONFDIR=`echo $ 1| cut -d= -f2-`532 SYSCONFDIR=`echo $TARGET | cut -d= -f2-` 492 533 ;; 493 534 --localstatedir=*) 494 LOCALSTATEDIR=`echo $ 1| cut -d= -f2-`535 LOCALSTATEDIR=`echo $TARGET | cut -d= -f2-` 495 536 ;; 496 537 --datadir=*) 497 DATADIR=`echo $ 1| cut -d= -f2-`538 DATADIR=`echo $TARGET | cut -d= -f2-` 498 539 ;; 499 540 --unique) … … 504 545 ;; 505 546 --package=*) 506 PACKAGE=`echo "$ 1" | cut -d= -f2- | rev | cut -d- -f2- | rev`507 PACKAGEVER=`echo "$ 1" | cut -d= -f2- | rev | cut -d- -f1 | rev`547 PACKAGE=`echo "$TARGET" | cut -d= -f2- | rev | cut -d- -f2- | rev` 548 PACKAGEVER=`echo "$TARGET" | cut -d= -f2- | rev | cut -d- -f1 | rev` 508 549 EXPLICIT_PACKAGE=1 509 550 ;; 510 551 --packager=*) 511 PACKAGER=`echo $ 1| cut -d= -f2-`552 PACKAGER=`echo $TARGET | cut -d= -f2-` 512 553 ;; 513 554 --md5=*) 514 MD5SUM=`echo $ 1| cut -d= -f2-`555 MD5SUM=`echo $TARGET | cut -d= -f2-` 515 556 ;; 516 557 *) … … 526 567 527 568 if [ $EXPLICIT_PACKAGE = 0 ]; then 528 # Always use Python distutils data if available569 # Use Python distutils data if available 529 570 if [ -r setup.py ]; then 530 PACKAGE=`python setup.py --name | tr A-Z a-z` 531 PACKAGEVER=`python setup.py --version` 571 if [[ $PACKAGE != py* ]]; then 572 PACKAGE=`python setup.py --name | tail -1 | tr A-Z a-z` 573 fi 574 PACKAGEVER=`python setup.py --version | tail -1` 575 fi 576 # Use MakeMaker data if available 577 if [ -r Makefile.PL ]; then 578 OLDVER=$PACKAGEVER 579 PACKAGEVER=`PERL_MM_USE_DEFAULT=1 perl -e 'do "Makefile.PL"; print $VERSION' | tail -1` 580 if [[ $PACKAGEVER != [0-9]*.* ]]; then 581 PACKAGEVER=$OLDVER 582 fi 532 583 fi 533 584 if [ "_$PACKAGE" = "_$PACKAGEVER" ]; then … … 544 595 elif [ -x autogen.sh ]; then 545 596 BUILDER=autogen 597 elif [ -r Makefile.PL ]; then 598 BUILDER=perl 546 599 elif [ -r Imakefile ]; then 547 600 BUILDER=xmkmf … … 554 607 BUILDER=python 555 608 INSTALLER='python setup.py install -f' 556 elif [ -r Makefile.PL ]; then557 BUILDER=perl558 609 elif [ -r $PACKAGE.pro ]; then 559 610 BUILDER=qmake … … 563 614 fi 564 615 616 declare -F build_pre_$BUILDER > /dev/null && eval build_pre_$BUILDER 617 618 declare -F packager_pre_$PACKAGER > /dev/null && eval packager_pre_$PACKAGER 619 declare -F packager_$PACKAGER > /dev/null || error "no such function packager_$PACKAGER()" 620 565 621 if [ $SKIPBUILD = 0 ]; then 622 notice "Running $BUILDER builder" 566 623 eval build_$BUILDER || error "build failed" 567 624 fi 568 625 626 notice "Installing package" 627 installer 628 629 declare -F build_post_$BUILDER > /dev/null && eval build_post_$BUILDER 630 631 notice "Running $PACKAGER packager" 569 632 eval packager_$PACKAGER 570 633
