[arch-projects] [PATCH] Add an option to explicitly run namcap
Jan Steffens
jan.steffens at gmail.com
Sat Sep 17 10:43:33 EDT 2011
On Sat, Sep 17, 2011 at 1:48 PM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> On Sat, Sep 17, 2011 at 10:26:20AM +0200, Jan Steffens wrote:
>> Installs namcap if needed, *after* building the package,
>> contrary to the former way of having to have namcap installed,
>> e.g. via makedepends.
>>
>> Signed-off-by: Jan Steffens <jan.steffens at gmail.com>
>> ---
>> makechrootpkg | 14 ++++++++++++--
>> 1 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/makechrootpkg b/makechrootpkg
>> index a60c9fe..974628c 100755
>> --- a/makechrootpkg
>> +++ b/makechrootpkg
>> @@ -18,6 +18,7 @@ update_first='0'
>> clean_first='0'
>> install_pkg=''
>> add_to_db=0
>> +run_namcap=0
>>
>> chrootdir=''
>>
>> @@ -54,11 +55,12 @@ usage() {
>> echo '-I <pkg> Install a package into the working copy of the chroot'
>> echo '-l <copy> The directory to use as the working copy of the chroot'
>> echo ' Useful for maintaining multiple copies.'
>> + echo '-n Run namcap on the package'
>> echo " Default: $default_copy"
>> exit 1
>> }
>>
>> -while getopts 'hcudr:I:l:' arg; do
>> +while getopts 'hcudr:I:l:n' arg; do
>> case "${arg}" in
>> h) usage ;;
>> c) clean_first=1 ;;
>> @@ -67,6 +69,7 @@ while getopts 'hcudr:I:l:' arg; do
>> r) chrootdir="$OPTARG" ;;
>> I) install_pkg="$OPTARG" ;;
>> l) copy="$OPTARG" ;;
>> + n) run_namcap=1 ;;
>> *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;;
>> esac
>> done
>> @@ -175,6 +178,8 @@ if [ "$REPACK" != "1" ]; then
>> rm -rf "$copydir/build/"*
>> fi
>>
>> +[ "$run_namcap" -eq "1" ] && touch "$copydir/build/RUN_NAMCAP"
>
> Please use "(( $run_namcap ))" or "[[ -n $run_namcap ]]" here. There
> were a couple of patches fixing scripts that still used the old syntax
> lately. makechrootpkg wasn't attacked yet but new patches should try to
> stick to the bashier way.
>
>> +
>> # Read .makepkg.conf even if called via sudo
>> if [ -n "${SUDO_USER}" ]; then
>> makepkg_conf="/$(eval echo ~${SUDO_USER})/.makepkg.conf"
>> @@ -257,7 +262,10 @@ cd /build
>> export HOME=/build
>> sudo -u nobody makepkg $MAKEPKG_ARGS || touch BUILD_FAILED
>> [ -f BUILD_FAILED ] && exit 1
>> -which namcap &>/dev/null && namcap /build/PKGBUILD /pkgdest/*.pkg.tar.* > /build/namcap.log
>> +if [ -f RUN_NAMCAP ]; then
>
> Same here. "[[ -f RUN_NAMCAP ]]".
>
>> + pacman -S --needed --noconfirm namcap
>> + namcap /build/PKGBUILD /pkgdest/*.pkg.tar.* > /build/namcap.log
>> +fi
>> exit 0
>> EOF
>> ) > "$copydir/chrootbuild"
>> @@ -303,3 +311,5 @@ if [ -e "${copydir}/build/BUILD_FAILED" ]; then
>> rm "${copydir}/build/BUILD_FAILED"
>> exit 1
>> fi
>> +
>> +# vim:set noet ts=8 sw=8:
>
> I don't see any reason to introduce a modeline here. If we want that, it
> should be done in a separate patch, and for all scripts at once.
>
>> --
>> 1.7.6.1
>
Started rewriting: https://github.com/heftig/devtools/commits/master
Comments welcome.
More information about the arch-projects
mailing list