#! /usr/bin/perl -w # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42) # wrote this file. As long as you retain this notice you # can do whatever you want with this stuff. If we meet some day, and you think # this stuff is worth it, you can buy me a beer in return. Anton Berezin # ---------------------------------------------------------------------------- # # $FreeBSD$ use strict; # good tests: # /usr/ports/archivers/zoo/files/patch-aa (context diff) # /usr/ports/astro/xplanet/files/patch-aa (unified with paths) my ($in,$fl,$abort,$state,$out); if (!@ARGV || $ARGV[0] =~ /^-/) { print STDERR "Usage: $0 patchfile ... " } while (@ARGV) { $in = shift; $state = \&nofile; if (open IN, "< $in") { $abort = 0; $out = ""; $fl = ""; while () { $state->(); last if $abort; } close IN; if ($out && !$abort) { print "Wrote $out\n"; } } else { print STDERR "cannot open $in: $!\n"; } } sub nofile { if (/^\*\*\*\s+/ && !/^\*\*\*\s+\d+,\d+\s+/) { $state = \&cstart; $fl = $_; } elsif (/^---\s+/ && !/^---\s+\d+,\d+\s+/) { $state = \&ustart; $fl = $_; } } sub cstart { if (!/^---\s+\d+,\d+\s+/ && /^---\s+(\S+)\s+/) { $state = \&body; $out = $1; $out =~ s|/|_|g; $out = "patch-$out"; if (open OUT, "> $out") { print OUT $fl; print OUT $_; } else { print STDERR "Cannot create $out: $!, aborting\n"; $abort = 1; } } else { print STDERR "Bad context diff in $in, aborting\n"; $abort = 1; } } sub ustart { if (/^\+\+\+\s+(\S+)\s+/) { $state = \&body; $out = $1; $out =~ s|/|_|g; $out = "patch-$out"; if (open OUT, "> $out") { print OUT $fl; print OUT $_; } else { print STDERR "Cannot create $out: $!, aborting\n"; $abort = 1; } } else { print STDERR "Bad unified diff in $in, aborting\n"; $abort = 1; } } sub body { if (/^\*\*\*\s+/ && !/^\*\*\*\s+\d+,\d+\s+/) { close OUT; print "Wrote $out\n"; $state = \&cstart; $fl = $_; } elsif (/^---\s+/ && !/^---\s+\d+,\d+\s+/) { close OUT; print "Wrote $out\n"; $state = \&ustart; $fl = $_; } else { print OUT $_; } } t/npm_and_yarn/devel/electron4/files/lodash-4.17.19 FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)
aboutsummaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* KDE Applications: update to 19.08.3tcberner2019-11-091-3/+3
* KDE Applications: update to 19.08.2tcberner2019-10-161-3/+3
* KDE Applications: update to 19.08.1tcberner2019-09-061-3/+3
* Update KDE Applications to latest upstream release, 19.08adridg2019-08-154-31/+5
* Update KDE Frameworks to latest upstream release, 5.61adridg2019-08-151-0/+26
* Bump PORTREVISION for ports depending on the canonical version of GCCgerald2019-07-271-1/+1
* KDE Applications: update to 19.04.3tcberner2019-07-121-3/+3
* KDE Applications: complete dependency liststcberner2019-06-231-3/+4
* Update KDE Applications to 19.04.2tcberner2019-06-071-3/+3
* Update KDE Applications to 19.04.1tcberner2019-05-102-4/+3
* Related to revision 499061 bump ports with USES=fortran to have themgerald2019-04-221-1/+1
* Fix math/cantor for consumersadridg2019-04-211-3/+4
* Update KDE Applications to 19.04.0tcberner2019-04-193-4/+8
* math/libqalculate: Update to 3.0.0jhale2019-03-291-0/+1
* Update KDE Applications to 18.12.3tcberner2019-03-081-3/+3
* Update KDE Applications to 18.12.2tcberner2019-02-082-4/+3
* Fix Qt5 symbol version scripts to put the catch-all clause first. Whentijl2019-01-161-0/+1
* Update KDE Applications to 18.12.1tcberner2019-01-111-3/+3
* Change cmake default behaviour to outsource.tcberner2018-12-261-1/+1
* Update KDE Applications to 18.12.0tcberner2018-12-143-6/+4
* Bump PORTREVISION for ports depending on the canonical version of GCCgerald2018-12-121-0/+1
* Update KDE Applications to 18.09.3tcberner2018-11-101-3/+3
* Fix build with GCC-based architectures for various kde@ ports.tcberner2018-10-271-1/+2
* Update KDE Applications to 18.08.2tcberner2018-10-121-3/+3
* Add DOCS options to ports that should have one.mat2018-09-101-1/+1
* Update the current KDE Applications to 18.08.1, the latest release.adridg2018-09-071-3/+3
* Update KDE Applications to 18.08tcberner2018-08-252-4/+3
* Bump PORTREVISION for ports depending on the canonical version of GCCgerald2018-07-301-1/+1
* Update math/libqalculate and math/qalculate to 2.6.1jhale2018-07-271-0/+1
* Update KDE Applications to 18.04.3tcberner2018-07-142-18/+19
* Replace bsd.qt.mk by Uses/qt.mk and Uses/qt-dist.mktcberner2018-06-291-2/+2
* Update KDE Applications to 18.04.2tcberner2018-06-102-3/+4
* Update KDE Applications to 18.04.1tcberner2018-05-111-3/+3
* Update KDE Applications to 18.04.0tcberner2018-04-292-4/+5
* New port: KDE Applications math/tcberner2018-04-104-0/+226
* Give the KDE SC4 applications ports a -kde4 suffixtcberner2018-02-236-232/+0
* Reduce dependency on the python2 metaportantoine2018-02-191-2/+2
* Rename KDE4 meta portstcberner2018-02-10