[pacman-dev] bacman
Xavier
shiningxc at gmail.com
Fri May 30 07:37:03 EDT 2008
On Fri, May 30, 2008 at 2:10 AM, Allan McRae <mcrae_allan at hotmail.com> wrote:
>
> #
> # Setting environmental variables
> #
> eval $(sed -nre
> 's:[[:space:]]*(DBPath)[[:space:]]*=[[:space:]]*([[:print:]]*):\1="\2":p'
> /etc/pacman.conf)
> pac_db="${DBPath:-/var/lib/pacman/}/local"
> eval $(sed -nre
> 's:[[:space:]]*(CacheDir)[[:space:]]*=[[:space:]]*([[:print:]]*):\1="\2":p'
> /etc/pacman.conf)
> pac_cache="${CacheDir:-/var/cache/pacman/pkg/}"
> pkg_name="$1"
> pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)"
> eval $(sed -nre
> 's:[[:space:]]*(CARCH)[[:space:]]*=[[:space:]]*([[:print:]]*):\1=\2:p'
> /etc/makepkg.conf)
> pkg_arch=${CARCH:-'unknown'}
> eval $(sed -nre
> 's:[[:space:]]*(PKGDEST)[[:space:]]*=[[:space:]]*([[:print:]]*):\1=\2:p'
> /etc/makepkg.conf)
> pkg_dest="${PKGDEST:-$PWD}"
> eval $(sed -nre
> 's:[[:space:]]*(PACKAGER)[[:space:]]*=[[:space:]]*([[:print:]]*):\1=\2:p'
> /etc/makepkg.conf)
> pkg_pkger=${PACKAGER:-'Unknown Packager'}
> pkg_namver="${pkg_dir##*/}"
>
I don't like this complexity either, better revert to your awk way.
I would suggest to not worry about spaces unless you find a clever and
simple way to handle them.
>
> if [ -n "$pac_cache" ] && [ -f "$pac_cache"/"$pkg_namver"*.tar.gz ] ; then
> echo Warning: the package ${pkg_name} already exists in your pacman
> cache
> # read -n 1 -p 'Do you want to fetch it instead? (y/N) '
> # case $REPLY in
> # y|Y)
> # cp "$pac_cache"/"$pkg_namver"*.pkg.tar.gz "$pkg_dest"
> # exit 0
> # ;;
> # *) echo ""
> # ;;
> # esac
> fi
>
You commented out this part on purpose?
I don't find it useful either, just remove it :)
>
> #
> # File copying
> #
> echo Copying package files...
>
> cat "$pkg_dir"/files |
> while read i; do
<snip>
> pkg_size=$(du -sb | awk '{print $1}')
> done
>
Not only that var is not available outside the loop, it does not make
any sense to put it inside anyway.
> # desc
> %NAME%)
> echo "pkgname = $i" >> .PKGINFO
> ;;
> %VERSION%)
> echo "pkgver = $i" >> .PKGINFO
> ;;
> %DESC%)
> echo "pkgdesc = $i" >> .PKGINFO
> ;;
> %URL%)
> echo "url = $i" >> .PKGINFO
> ;;
> %LICENSE%)
> echo "license = $i" >> .PKGINFO
> ;;
> %ARCH%)
> echo "arch = $i" >> .PKGINFO
> ;;
> %BUILDDATE%)
> echo "builddate = $(date -u "+%s")" >> .PKGINFO
> ;;
> %PACKAGER%)
> echo "packager = $pkg_pkger" >> .PKGINFO
> ;;
> %SIZE%)
> echo "size = $pkg_size" >> .PKGINFO
> ;;
> %GROUPS%)
> echo "group = $i" >> .PKGINFO
> ;;
> %REPLACES%)
> echo "replaces = $i" >> .PKGINFO
> ;;
>
force belongs here, in desc section, just after replaces (and require
indentation fix :)) :
> %FORCE%)
> echo "force = true" >> .PKGINFO
> ;;
>
> #rm -rf $work_dir
>
I thought you wanted to keep that.
More information about the pacman-dev
mailing list