[devel] perl.git

Alexey Tourbin =?iso-8859-1?q?at_=CE=C1_altlinux=2Eru?=
Ср Сен 13 21:06:43 MSD 2006


On Wed, Sep 13, 2006 at 09:04:51PM +0400, Alexey Tourbin wrote:
> На всякий случай прилагаю скрипт, который их имортирует.

Вот он.
----------- следующая часть -----------
#!/bin/sh -e

diffs=~/perl-5.8.x-diffs
source0=~/RPM/SOURCES/perl-5.8.0.tar.bz2
workdir=~/tmp/perl-git

rm -rf "$workdir"
mkdir "$workdir"
cd "$workdir"
tar xf "$source0"
mv perl-5.8.0 perl
cd perl
mtime=`find -type f -printf '%T@\n' |sort -u -rn |head -1`
# HACK
find -type f -print0 |xargs -r0 perl -pi -e 's/\r\n/\n/'
git-init-db
git-add .
faketime -d "1970-01-01 $mtime seconds" -- \
git-commit -a -m "imported perl-5.8.0 sources" --author 'pumpking <pumpking на perl>'
git-checkout -b perl-5.8
git-branch -D master

for diff in $diffs/*[0-9].gz; do
	[ -f "${diff%%.gz}.my.gz" ] && diff=${diff%%.gz}.my.gz
	echo "	*** $diff"
	head=$(zcat "$diff" |head -1)
	set -- $head
	change=$2
	who=$4
	date="$6 $7"
	message=$(zcat "$diff" |grep -m1 -B999 '^Affected files')
	message=$(echo "$message" |cat -s |sed '1{/^Change /d};${/^Affected files/d}')
	message=$(echo "$message" |sed '1{/^$/d};${/^$/d}')
	message=$(echo -n "Change $change:"; echo "$message" |head -1 |sed 's/^[[:space:]]*/ /';
		echo; echo "$message"; echo)
	affected=$(zcat "$diff"|sed -n '/^Affected files/,/^Differences/p')
	affected=$(echo "$affected" |grep -F //depot/maint-5.8/perl/)
	affected=$(echo "$affected" |sed 's|.*//depot/maint-5.8/perl/|\t|;s|#[0-9]\+[[:space:]]\+|\t|')
	hasdiff=1 hasCRLF=
	if zcat "$diff" |grep -qs '^--- '; then
		n1=`zcat "$diff" |wc -c`
		n2=`zcat "$diff" |perl -pe 's/\r\n/\n/' |wc -c`
		[ $n1 = $n2 ] || hasCRLF=1
		zcat "$diff" |perl -pe 's/\r\n/\n/' |patch -p1
	else
		hasdiff=
	fi
	hasrm=
	while read -r file action; do
		if [ "$action" = delete ]; then
			hasrm=1
			git-rm -f -v "$file"
		else
			git-add "$file"
		fi
	done <<<"$affected"
	if [ -z "$hasdiff" -a -z "$hasrm" ]; then
		echo "no changes in $diff"
		continue
	fi
	author=${who%%@*}
	author="$author <$who>"
	faketime -d "$date" -- \
	git-commit -a -m "$message" --author "$author" || [ -n "$hasCRLF" ]
done

echo ok
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 189 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20060913/59bdf8a2/attachment-0001.bin>


Подробная информация о списке рассылки Devel