---
name: "update-patches"
section: "1"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/update-patches"
---

# update-patches(1)

create or update patches for a given port

## NAME

**update-patches** – create or update patches for a given port

## SYNOPSIS

**update-patches**

## DESCRIPTION

**update-patches** is a helper script for the target *update-patches* in [bsd.port.mk(5)](/bsd.port.mk/5.md). It takes no argument, but uses quite a few environment variables as implicit parameters.

**update-patches** looks under WRKDIST for patched files. Those are files with extension PATCHORIG, except for those matching also DISTORIG.

Once those files are found, they are matched against the contents of directory PATCHDIR, most specifically files matching wildcard PATCH\_LIST. Matching files are regenerated on the basis of

```
$ diff -u -p -a ${DIFF_ARGS} $file$PATCHORIG $file
```

and compared. Modified patches are updated and reported, new patches are generated, and old patches that no longer seem to exist are also reported.

As an exception, if a *$file.beforesubst* original file is found, it is used instead of $file in the diff line:

```
$ diff -u -p -a ${DIFF_ARGS} $file$PATCHORIG $file.beforesubst
```

The patch header is normalized to always be:

```
Index: $file
--- $file.orig
+++ $file
```

Patches with problematic [cvs(1)](/cvs/1.md) keywords may be fixed if possible, and reported if not.

**update-patches** prints the list of changed patches for further study.

## ENVIRONMENT

- DIFF\_ARGS

  Extra parameters to insert into [diff(1)](/diff/1.md).

- DISTORIG

  Extension to original files to ignore entirely.

- FORCE\_REGEN

  Force patches to be regenerated even if they didn't change.

- PATCHDIR

  Path to existing and generated patches.

- PATCHORIG

  Extension to match for finding original files.

- PATCH\_LIST

  Only compare new patches to existing patches matching that pattern.

- PATCH\_VERBOSE

  Force **update-patches** to tell about everything it does.

- WRKDIST

  Directory to scan for files to compare.

## SEE ALSO

[cvs(1)](/cvs/1.md), [diff(1)](/diff/1.md), [patch(1)](/patch/1.md)
