X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@lists.alpinelinux.org Received: from mail.wtbts.no (mail.wtbts.no [213.234.126.131]) by lists.alpinelinux.org (Postfix) with ESMTP id 068AB1EBFEE for ; Thu, 25 Nov 2010 15:59:26 +0000 (UTC) Received: from [10.65.65.1] (unknown [10.65.65.1]) by mail.wtbts.no (Postfix) with ESMTP id 319967E0BB; Thu, 25 Nov 2010 16:51:48 +0100 (CET) Subject: Re: [alpine-devel] Re: [PATCH] apts2: initial commit From: Natanael Copa To: Jeff Bilyk Cc: Alpine Development In-Reply-To: References: <1290633981-2048-1-git-send-email-jbilyk@gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 25 Nov 2010 16:59:25 +0100 Message-ID: <1290700765.6958.72.camel@ncopa-desktop.nor.wtbts.net> X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 Content-Transfer-Encoding: 7bit On Wed, 2010-11-24 at 22:30 -0500, Jeff Bilyk wrote: > Here's what I've got for the initial version of the package testing > part of things. I'll try to whip up a quick script that will take the > original APTS .mk files and convert them to the format used by this > script (take out line 1 and s/apk_delete/apk_del). Tried to keep it > as simple as possible since it'll need to run quite a bit. Also, > tried to keep the output fairly easy to search through. > > Thoughts/feedback? I looked at it. I'm ok with the idea behind, but code itself could have use of some minor improvements ;) I think I should set up a git repo for you. > Jeff > > On Wed, Nov 24, 2010 at 4:26 PM, Jeff Bilyk wrote: > > initial commit with package testing script and 2 package scripts > > --- > > apts2 | 31 +++++++++++++++++++++++++++++++ i think we can just call the main script for 'apts' rather han 'apts2' > > packages/lsof | 3 +++ > > packages/sed | 4 ++++ maybe call the dir 'tests' instead of 'packages' since it holds the test scripts? > > 3 files changed, 38 insertions(+), 0 deletions(-) > > create mode 100755 apts2 > > create mode 100644 packages/lsof > > create mode 100644 packages/sed > > > > diff --git a/apts2 b/apts2 > > new file mode 100755 > > index 0000000..f4fd910 > > --- /dev/null > > +++ b/apts2 > > @@ -0,0 +1,31 @@ > > +#!/bin/sh > > + > > +# Get file to output to > > +ARGUMENTS="$@" > > +OUTFILE="`echo $ARGUMENTS | awk -F ' ' '{print $1}'`" > > +if [ -z "$OUTFILE" ]; > > + then echo "Usage: $0 outputfile " && exit 1; > > +fi There are better wais to parse the opts program=$0 usage() { echo "Usage: $program outputfile " exit 1 } # parse options while getopts "h" opt; do case "$opt" in h) usage;; esac done # remove options so we have package... in $@ shift $(( $OPTIND - 1 )) # do wa have any file args? if [ $# -eq 0 ]; then echo "no outfile" fi i=1 while [ $# -gt 0 ]; do echo "file number $i: $1" i=$(( $i + 1 )) shift done > > + > > +if [ "$OUTFILE" == "-h" ]; > > + then echo "Usage: $0 outputfile " && exit 0; > > +fi > > + > > +if [ "$OUTFILE" == "--help" ]; > > + then echo "Usage: $0 outputfile " && exit 0; > > +fi > > + > > +PACKAGE="`echo $ARGUMENTS | awk -F ' ' '{print $2}'`" > > + > > +if [ -z "$PACKAGE" ]; > > + then echo "All packages to be tested" && for package in `ls ./packages`; > > + do echo "Testing $package apk" && /bin/sh -e ./packages/$package >> "$OUTFILE" 2>&1 && echo "$package passed tests" >> "$OUTFILE" && echo "$package passed tests"; > > + > > + done && exit 0; > > +else test -e ./packages/$PACKAGE && echo "Testing $PACKAGE apk" && /bin/sh -e ./packages/$PACKAGE >> "$OUTFILE" 2>&1 && echo "$PACKAGE passed tests" && exit 0; > > + > > +fi > > + > > +if [ "$?" == "1" ]; > > + then echo "Testing file for $PACKAGE does not exist" && exit 1; > > +fi > > \ No newline at end of file > > diff --git a/packages/lsof b/packages/lsof > > new file mode 100644 > > index 0000000..3c49a22 > > --- /dev/null > > +++ b/packages/lsof > > @@ -0,0 +1,3 @@ > > + apk_add $@ > > + lsof > > + apk_del $@ > > diff --git a/packages/sed b/packages/sed > > new file mode 100644 > > index 0000000..0d1b744 > > --- /dev/null > > +++ b/packages/sed > > @@ -0,0 +1,4 @@ > > + apk_add $@ > > + echo "hello" | sed 's/hello/world/g' | grep 'world' > > + apk_del $@ > > + [ `readlink /bin/sed` = /bin/busybox ] > > -- > > 1.7.3.2 > > > > > > > --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---