ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexander Bokovoy <a.bokovoy@sam-solutions.net>
To: devel@altlinux.ru
Subject: [devel] Patch splitter
Date: Thu, 6 Sep 2001 19:06:53 +0300
Message-ID: <20010906190653.Q31879@pc152.belcaf.minsk.by> (raw)

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

Доброго времени суток!

Вообщем, достало меня поддержку Promise FastTrak100 выковыривать из патчей
Алана и я написал следующую небольшую утилиту, которая разбивает большой
блок патчей, сгенерированных командой diff -r (diff --recursive) на набор
маленьких, каждый из которых хранит изменения только для одного файла.
Поскольку результат diff -r всегда собирает изменения в одном файле в один
патч, то все работает прекрасно.

Пример использования:

bzcat patch-2.4.8-ac8 | awk ./splitter.awk

и в текущем каталоге появится linux.ac, в котором будут разложены по
соответствующим подкаталогам все патчи.
-- 
/ Alexander Bokovoy
$ cat /proc/identity >~/.signature
  `Senior software developer and analyst for SaM-Solutions Ltd.`
---
Drive defensively.  Buy a tank.

[-- Attachment #2: splitter.awk --]
[-- Type: text/plain, Size: 428 bytes --]

#!/usr/bin/awk
BEGIN {
    filen="crap.patch";
    flag=-1;
}
{
    if ($0 ~ /^diff +(-[a-zA-Z]*|--[a-zA-Z]*)/) { 
	if(flag > 0) close(filen);
	text = $0;
	ind = split(text, components);
	filen=components[ind] ".patch";
	dirname="dirname " filen;
	dirname | getline dirn; close(dirname);
	mkdir="mkdir -p " dirn;
	mkdir | getline s;  close(mkdir);
	printf("Creating patch %s\n", filen);
	flag=1;
    }
 
    print  >> filen 
}


                 reply	other threads:[~2001-09-06 16:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010906190653.Q31879@pc152.belcaf.minsk.by \
    --to=a.bokovoy@sam-solutions.net \
    --cc=devel@altlinux.ru \
    --cc=devel@linux.iplabs.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git