[PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

View: New views
7 Messages — Rating Filter:   Alert me  

[PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

by Cedric Staniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
---

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
  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
+
  if [ "$arch" != 'any' ]; then
  if ! in_array $CARCH ${arch[@]}; then
  if [ "$IGNOREARCH" -eq 0 ]; then
--
1.6.5.1



Re: [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
> ---
>
> 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.

>   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?

>   if [ "$arch" != 'any' ]; then
>   if ! in_array $CARCH ${arch[@]}; then
>   if [ "$IGNOREARCH" -eq 0 ]; then
>  

Allan


Re: [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

by Cedric Staniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
>> ---
>>
>> 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



Re: [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Cedric Staniewski wrote:

> 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@...>
>>> ---
>>>
>>> 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
>  

So it does....  I glad someone refers to the documentation!


>>>      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.
>  

I prefer the old place as it keeps the checking in pkgname, pkgver,
pkgrel order, which is the order given in the PKGBUILD prototype.

Allan



[PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

by Cedric Staniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
---

> So it does....  I glad someone refers to the documentation!

:)

 scripts/makepkg.sh.in |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 9cd7f2e..4c05ccc 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1139,10 +1139,17 @@ 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
+ 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
  if [ "$pkgver" != "${pkgver//-/}" ]; then
  error "$(gettext "%s is not allowed to contain hyphens.")" "pkgver"
  return 1
--
1.6.5.1



Re: [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
> ---
>
>  
>> So it does....  I glad someone refers to the documentation!
>>    
>
> :)
>
>  scripts/makepkg.sh.in |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 9cd7f2e..4c05ccc 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1139,10 +1139,17 @@ 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
> + 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
>   if [ "$pkgver" != "${pkgver//-/}" ]; then
>   error "$(gettext "%s is not allowed to contain hyphens.")" "pkgver"
>   return 1
>  

Pushed to my working branch.  I changed the order of the check of
pkgbase and pkgname so that pkgname comes first like in the PKGBUILD
prototype for no particular reason....  it just seemed nicer to me.

Allan



Re: [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

by Cedric Staniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...>
>> ---
>>
>>  
>>> So it does....  I glad someone refers to the documentation!    
>>
>> :)
>>
>>  scripts/makepkg.sh.in |   11 +++++++++--
>>  1 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 9cd7f2e..4c05ccc 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1139,10 +1139,17 @@ 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
>> +    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
>>      if [ "$pkgver" != "${pkgver//-/}" ]; then
>>          error "$(gettext "%s is not allowed to contain hyphens.")"
>> "pkgver"
>>          return 1
>>  
>
> Pushed to my working branch.  I changed the order of the check of
> pkgbase and pkgname so that pkgname comes first like in the PKGBUILD
> prototype for no particular reason....  it just seemed nicer to me.
>
> Allan
>

Thought, I retained the order from the prototypes. Thanks for fixing this.