slitaz-base-files rev 155
add functions to libpkg
author | Christian Mesh <meshca@clarkson.edu> |
---|---|
date | Fri May 11 10:12:12 2012 -0500 (2012-05-11) |
parents | 16290349d895 b51511c007b8 |
children | 715f88279adf |
files | doc/libpkg.txt rootfs/lib/libspk.sh rootfs/usr/lib/slitaz/httphelper rootfs/usr/lib/slitaz/libpkg.sh |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/doc/libpkg.txt Fri May 11 10:12:12 2012 -0500 1.3 @@ -0,0 +1,22 @@ 1.4 + 1.5 +SYNOPSIS 1.6 + . /usr/lib/slitaz/libpkg.sh 1.7 + function 1.8 + 1.9 +DESCRIPTION 1.10 + Libpkg provide base functions to handle SliTaz Packages archives and 1.11 + receipt. It is used by Spk, the Cookutils and all tools dealing with 1.12 + packages and receipts. 1.13 + 1.14 +FUNCTIONS 1.15 + unset_receipt 1.16 + receipt_info 1.17 + package_name 1.18 + is_valid_tazpkg 1.19 + check_valid_tazpkg 1.20 + 1.21 +OPTIONS 1.22 + 1.23 +AUTHOR 1.24 + Written by Christophe Lincoln and Christian Mesh 1.25 +
2.1 --- a/rootfs/lib/libspk.sh Fri May 11 10:06:20 2012 -0500 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,70 +0,0 @@ 2.4 -#!/bin/sh 2.5 -# LibSpk - SliTaz Package Managment Library 2.6 -# 2.7 -# Just some guesses as to what should be in libspk 2.8 -# 2.9 -# Authors : See the AUTHORS filesi 2.10 - 2.11 -TMP_DIR=/tmp/$RANDOM 2.12 - 2.13 -# takes a file or directory and returns the base directory 2.14 -base_path() { 2.15 - local path=$1 2.16 - echo ${path%$(basename $path)} 2.17 -} 2.18 - 2.19 -# converts /tmp/pkg.tazpkg to pkg 2.20 -package_name() { 2.21 - local name=$(basename $1) 2.22 - echo ${name%.tazpkg} 2.23 -} 2.24 - 2.25 -# checks to see if file is proper tazpkg 2.26 -is_valid_tazpkg() { 2.27 - local file=$1 2.28 - local file_dir=$(base_path $file) 2.29 - [ -a $file ] && [ "$file" != "$(package_name $file)" ] 2.30 -} 2.31 - 2.32 -valid_tazpkg() { 2.33 - local file=$1 2.34 - if ! is_valid_tazpkg $file; then 2.35 - gettext "$file is not a tazpkg. Exiting"; newline 2.36 - exit 1 2.37 - fi 2.38 -} 2.39 - 2.40 -# Display receipt information. 2.41 -receipt_info() { 2.42 - cat << EOT 2.43 -$(gettext "Version :") ${VERSION}${EXTRAVERSION} 2.44 -$(gettext "Short desc :") $SHORT_DESC 2.45 -$(gettext "Category :") $CATEGORY 2.46 -EOT 2.47 -} 2.48 - 2.49 -# Unset all receipt variables. 2.50 -unset_receipt() { 2.51 - unset PACKAGE VERSION EXTRAVERSION SHORT_DESC HOST_ARCH TARBALL \ 2.52 - DEPENDS BUILD_DEPENDS WANTED WGET_URL PROVIDE CROSS_BUG 2.53 -} 2.54 - 2.55 -# Used by: list 2.56 -count_installed() { 2.57 - count=$(ls $installed | wc -l) 2.58 - gettext "Installed packages"; echo ": $count" 2.59 -} 2.60 - 2.61 -# Used by: list 2.62 -count_mirrored() { 2.63 - count=$(cat $pkgsmd5 | wc -l) 2.64 - gettext "Mirrored packages"; echo ": $count" 2.65 -} 2.66 - 2.67 - 2.68 - 2.69 - 2.70 - 2.71 -newline() { 2.72 - echo 2.73 -}
3.1 --- a/rootfs/usr/lib/slitaz/httphelper Fri May 11 10:06:20 2012 -0500 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,1 +0,0 @@ 3.4 -httphelper.sh 3.5 \ No newline at end of file
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/rootfs/usr/lib/slitaz/libpkg.sh Fri May 11 10:12:12 2012 -0500 4.3 @@ -0,0 +1,45 @@ 4.4 +#!/bin/sh 4.5 +# 4.6 +# SliTaz Packages base functions used by packages manager, cook and 4.7 +# all tools dealing with packages and receipts. 4.8 +# 4.9 +# Documentation: man libpkg or /usr/share/doc/slitaz/libpkg.txt 4.10 +# 4.11 +# Copyright (C) 2012 SliTaz GNU/Linux - BSD License 4.12 +# 4.13 + 4.14 +# Unset all receipt variables. 4.15 +unset_receipt() { 4.16 + unset PACKAGE VERSION EXTRAVERSION SHORT_DESC HOST_ARCH TARBALL \ 4.17 + DEPENDS BUILD_DEPENDS WANTED WGET_URL PROVIDE CROSS_BUG 4.18 +} 4.19 + 4.20 +# Display receipt information. 4.21 +receipt_info() { 4.22 + cat << EOT 4.23 +$(gettext "Version :") ${VERSION}${EXTRAVERSION} 4.24 +$(gettext "Short desc :") $SHORT_DESC 4.25 +$(gettext "Category :") $CATEGORY 4.26 +EOT 4.27 +} 4.28 + 4.29 +# converts /tmp/pkg.tazpkg to pkg 4.30 +package_name() { 4.31 + local name=$(basename $1) 4.32 + echo ${name%.tazpkg} 4.33 +} 4.34 + 4.35 +# checks to see if file is proper tazpkg 4.36 +is_valid_tazpkg() { 4.37 + local file=$1 4.38 + local file_dir=$(base_path $file) 4.39 + [ -a $file ] && [ "$file" != "$(package_name $file)" ] 4.40 +} 4.41 + 4.42 +check_valid_tazpkg() { 4.43 + local file=$1 4.44 + if ! is_valid_tazpkg $file; then 4.45 + gettext "$file is not a tazpkg. Exiting"; newline 4.46 + exit 1 4.47 + fi 4.48 +}