[pacman-dev] [PATCH] Add the ability to always build from the repo's HEAD

郑文辉(Techlive Zheng) techlivezheng at gmail.com
Tue May 28 00:29:28 EDT 2013


2013/5/28 Allan McRae <allan at archlinux.org>:
> On 28/05/13 02:08, Techlive Zheng wrote:
>> ---
>>  A task has also been added:
>>
>>   https://bugs.archlinux.org/task/35499
>
>
> Am I missing something completely here?  Does not specifying "ref=" etc
> in the URL build from HEAD?
Noop, "branch=HEAD' won't work, git clone --mirror will set the 'HEAD'
ref correctly, but next time, 'git fetch' won't.
>
> You will need to explain what you are trying to do.
>
> Allan
>
>>  scripts/makepkg.sh.in | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index c27c74d..cd7ed48 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -557,6 +557,9 @@ download_git() {
>>               if ! git fetch --all -p; then
>>                       # only warn on failure to allow offline builds
>>                       warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git"
>> +             else
>> +                     git fetch origin HEAD
>> +                     echo "$(git rev-parse FETCH_HEAD)" > HEAD
In the case of fetching in an existed git source, we need to hack a
bit to make sure the HEAD is correctly set.
>>               fi
>>       fi
>>  }
>> @@ -597,6 +600,9 @@ extract_git() {
>>                       branch)
>>                               ref=origin/${fragment##*=}
>>                               ;;
>> +                     HEAD)
>> +                             ref=HEAD
>> +                             ;;
None of 'branch=','commit=','tag=' works for HEAD correctly, we need
to handle HEAD separately.
>>                       *)
>>                               error "$(gettext "Unrecognized reference: %s")" "${fragment}"
>>                               plain "$(gettext "Aborting...")"
>> @@ -604,6 +610,8 @@ extract_git() {
>>               esac
>>       fi
>>
>> +     ref=$(git rev-parse "$ref")
>> +
Instead of use 'branch/*' something, it is always better to directly
use commit hash.
>>       if [[ -n $ref ]]; then
>>               if ! git checkout -b makepkg $ref; then
>>                       error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git"
>>
>
>


More information about the pacman-dev mailing list