[pacman-dev] [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames
Cedric Staniewski
cedric at gmx.ca
Mon Oct 26 08:09:45 EDT 2009
Allan McRae wrote:
> Cedric Staniewski wrote:
>> Since commit fb97d32, which brought in this test, support for split
>> PKGBUILDs was added, and therefore, all values of pkgname and also
>> pkgbase have to be checked now.
>>
>> Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
>> ---
>>
>> Last patch before the big freeze...
>>
>> scripts/makepkg.sh.in | 12 ++++++++++--
>> 1 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 9cd7f2e..c451a36 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1139,8 +1139,8 @@ check_sanity() {
>> error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
>> return 1
>> fi
>> - if [ "${pkgname:0:1}" == "-" ]; then
>> - error "$(gettext "%s is not allowed to start with a
>> hyphen.")" "pkgname"
>> + if [[ ${pkgbase:0:1} = "-" ]]; then
>> + error "$(gettext "%s is not allowed to start with a
>> hyphen.")" "pkgbase"
>> return 1
>> fi
>>
>
> Unless I am missing something, pkgbase can start with anything. It is
> only used informationally in makepkg so does not cause problems with
> other tools.
In clean_up we had to use rm -f -- then
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"*
if [ "$PKGFUNC" -eq 1 ]; then
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package.log"*
and according to PKGBUILD man page:
pkgbase
The name used to refer to the group of packages in the output of makepkg and in *the naming of source-only tarballs*. If not specified, the first element in the pkgname
array is used.
Just checked this (create_srcpackage): if ! bsdtar -c${TAR_OPT}Lf "$pkg_file" ${pkgbase}; then
>
>> if [ "$pkgver" != "${pkgver//-/}" ]; then
>> @@ -1152,6 +1152,14 @@ check_sanity() {
>> return 1
>> fi
>>
>> + local name
>> + for name in "${pkgname[@]}"; do
>> + if [[ ${name:0:1} = "-" ]]; then
>> + error "$(gettext "%s is not allowed to start with a
>> hyphen.")" "pkgname"
>> + return 1
>> + fi
>> + done
>> +
>>
>
> Why not keep this in the same place as the previous check on pkgname?
>
I moved that mostly because of the 'local name' part and the for loop, but it does not make any difference. So if you prefer the old place, I could move it there.
>> if [ "$arch" != 'any' ]; then
>> if ! in_array $CARCH ${arch[@]}; then
>> if [ "$IGNOREARCH" -eq 0 ]; then
>>
>
> Allan
More information about the pacman-dev
mailing list