tazpkg rev 262

Add tazpkg convert (thanks fireflyoo)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 25 16:47:46 2009 +0200 (2009-05-25)
parents 9d4ab409df71
children eff911177314
files tazpkg
line diff
     1.1 --- a/tazpkg	Mon May 25 16:08:24 2009 +0200
     1.2 +++ b/tazpkg	Mon May 25 16:47:46 2009 +0200
     1.3 @@ -120,6 +120,7 @@
     1.4    clean-cache      Clean all packages downloaded in cache directory.
     1.5    depends          Display dependencies tree.
     1.6    rdepends         Display reverse dependencies tree.
     1.7 +  convert          convert a debian package to a slitaz package (.tazpkg)
     1.8    setup-mirror     Change the mirror url configuration.
     1.9    list-undigest    List undigest mirrors.
    1.10    remove-undigest  Remove an undigest mirror.
    1.11 @@ -268,7 +269,7 @@
    1.12  				return
    1.13  			fi
    1.14  		else
    1.15 -			# if alternative is installed then nothing to install
    1.16 +			# unconditional substitution
    1.17  			echo $i
    1.18  			return
    1.19  		fi
    1.20 @@ -893,6 +894,38 @@
    1.21  '
    1.22  }
    1.23  
    1.24 +# convert a .deb package to .tazpkg
    1.25 +convert_deb()
    1.26 +{
    1.27 +	mkdir -p $TMP_DIR
    1.28 +	dpkg-deb -e $1 $TMP_DIR
    1.29 +	package=$(grep '^ *Package' $TMP_DIR/control)
    1.30 +	package=$(echo ${package##*:})
    1.31 +	version=$(grep '^ *Version' $TMP_DIR/control)
    1.32 +	version=$(echo ${version##*:})
    1.33 +	descrip=$(grep '^ *Description' $TMP_DIR/control)
    1.34 +	descrip=$(echo ${descrip##*:})
    1.35 +	file="$package-$version"
    1.36 +	mkdir -p $TMP_DIR/$file/fs/
    1.37 +	dpkg-deb -x $1 $TMP_DIR/$file/fs
    1.38 +	cd $TMP_DIR
    1.39 +	cat > $file/receipt <<EOT
    1.40 +# SliTaz package receipt.
    1.41 +# generated by tazpkg from debian package $1
    1.42 +PACKAGE="$package"
    1.43 +VERSION="$version"
    1.44 +CATEGORY="misc"
    1.45 +SHORT_DESC="$descrip"
    1.46 +WEB_SITE="http://packages.debian.org/search?keywords=$package"
    1.47 +MAINTAINER="nobody@slitaz.org" 
    1.48 +DEPENDS=""
    1.49 +EOT
    1.50 +	tazpkg pack $file
    1.51 +	mv $file.tazpkg $TOP_DIR
    1.52 +	cd $TOP_DIR
    1.53 +	rm -rf $TMP_DIR
    1.54 +}
    1.55 +
    1.56  ###################
    1.57  # Tazpkg commands #
    1.58  ###################
    1.59 @@ -2189,6 +2222,15 @@
    1.60  			rdep_scan $2
    1.61  		fi
    1.62  		;;
    1.63 +	convert)
    1.64 +		# convert misc package format to .tazpkg
    1.65 +		case "$2" in
    1.66 +		*.deb|*.udeb)
    1.67 +			convert_deb $2;;
    1.68 +		*)
    1.69 +			echo "Unsupported format";;
    1.70 +		esac
    1.71 +		;;
    1.72  	usage|*)
    1.73  		# Print a short help or give usage for an unknown or empty command.
    1.74  		#