[pacman-dev] [PATCH] Portability fixes for makepkg

Jeremy Huntwork jhuntwork at lightcubesolutions.com
Tue May 22 22:37:24 EDT 2012


On 5/22/12 10:20 PM, Allan McRae wrote:
> This fails for cross directory symlinks.  The should not be common (man
> pages have different sections for a reason) but I found a package that
> has them in the Arch repos.  (As an aside, current makepkg fails hard
> here too....)
>
> I suggest changing that line to:
>
> if [[ ${file%/*} = ${link%/*} ]]; then
> 	ln -s -- "${file##*/}.gz" "${link}.gz"
> else
> 	ln -s -- "/${file}.gz" "${link}.gz"
> fi

Yes, this works. I was wondering about that particular case but haven't 
actually seen any like that yet myself.

>>   				fi
>> +			done
>> +			if [[ -z ${files[$inode]} ]]; then
>> +				files[$inode]=$file
>> +				gzip -9 -f "$file"
>> +			else
>> +				rm -f "$file"
>> +				ln "${files[$inode]}.gz" "${file}.gz"
>> +				chmod 644 "${file}.gz"
>>   			fi
>> -		done
>> +		done<  <(find ${MAN_DIRS[@]} -type f \! -name "*.gz" \! -name "*.bz2" \
>> +			-exec @INODECMD@ '{}' + 2>/dev/null)
>>   	fi
>>
>>   	if check_option "strip" "y"; then
>> @@ -1115,7 +1104,7 @@ tidy_install() {
>>
>>   	if check_option "emptydirs" "n"; then
>>   		msg2 "$(gettext "Removing empty directories...")"
>> -		find . -depth -type d -empty -delete
>> +		find . -mindepth 1 -depth -type d -exec rmdir '{}' + 2>/dev/null
>
> What is the -mindepth for?  I guess so that we do not try to remove ".".
>   That can never happen anyway...

Yes, it avoids having the '.' processed in the results - for some reason 
I did actually need this when I was first testing changes on the 
released version of pacman, but I can't recall now why that was, and I 
don't seem to have it in my notes. As you say, with the current version 
it's not going to actually harm anything if included so we can probably 
drop -mindepth 1. On the other hand, leaving it in doesn't hurt either. :)

I'll do whichever you prefer.

JH



More information about the pacman-dev mailing list