From 2deabc98f6ca8fd36165bbcb800affea8d990b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 18 Jul 2021 19:08:13 +0200 Subject: Rename undopatch to psu, xpkg to psx --- README | 8 ++++---- psu | 12 ++++++++++++ psx | 26 ++++++++++++++++++++++++++ undopatch | 12 ------------ xpkg | 26 -------------------------- 5 files changed, 42 insertions(+), 42 deletions(-) create mode 100755 psu create mode 100755 psx delete mode 100755 undopatch delete mode 100755 xpkg diff --git a/README b/README index 8092d6a..332ef8d 100644 --- a/README +++ b/README @@ -16,10 +16,10 @@ The other scripts have no special relation to pkgtools/pkgdiff. Use `convpatch' to make a patch from `git diff' output. Use `savepatch' to save a patch in ~/patches. - Use `undopatch' to undo all patches applied to a pkgsrc build. - Use `xpkg' to fetch and extract a pkgsrc package. + Use `psu' to undo all patches applied to a pkgsrc build. + Use `psx' to fetch and extract a pkgsrc package. -The `undopatch' and `xpkg' scripts are only to be used within pkgsrc +The `psu' and `psx' scripts are only to be used within pkgsrc package directories. They do nothing within the NetBSD source tree. Applying pkgsrc patches @@ -32,7 +32,7 @@ LOCALPATCHES variable in mk.conf: To rebuild a package with new patches, something along the following lines should be performed: - undopatch + psu -x make do-patch make do-build make do-install diff --git a/psu b/psu new file mode 100755 index 0000000..3f192bd --- /dev/null +++ b/psu @@ -0,0 +1,12 @@ +#!/bin/sh -e + +# psu -- undo patches applied to pkgsrc build + +d=$(psx) +echo=echo +echo "${0##*/}: undoing patches..." 1>&2 +[ x"$1" = x"-x" ] && echo= || echo '(preview, no -x)' 1>&2 +find work -name '*.orig' | while read -r f; do + $echo cp "$d/${f#work/}" "${f%.orig}" + $echo rm "$f" +done diff --git a/psx b/psx new file mode 100755 index 0000000..c0df08f --- /dev/null +++ b/psx @@ -0,0 +1,26 @@ +#!/bin/sh -e + +# psx -- fetch and extract pkgsrc archive + +case "$PWD" in +/usr/pkgsrc/*/*) ;; +*) echo "${0##*/}: not in package directory" 1>&2; exit 1 ;; +esac + +make fetch +f=/usr/pkgsrc/distfiles/$(sed -n '/.*(\(.*\)).*/{s//\1/;p;q}' distinfo) +d=$(tar -tf "$f" | head -1) + +opt= +if [ -e "$d" ]; then + printf "%s: $d already exists; overwrite? " "${0##*/}" + read ans + case $ans in + y*) opt=-U ;; + *) exit 1 ;; + esac +fi + +echo extracting archive... 1>&2 +tar -x $opt -f "$f" +echo "$d" diff --git a/undopatch b/undopatch deleted file mode 100755 index 82a6ae8..0000000 --- a/undopatch +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -e - -# undopatch -- undo patches applied to pkgsrc build - -d=$(xpkg) -echo=echo -echo "${0##*/}: undoing patches..." 1>&2 -[ x"$1" = x"-x" ] && echo= || echo '(preview, no -x)' 1>&2 -find work -name '*.orig' | while read -r f; do - $echo cp "$d/${f#work/}" "${f%.orig}" - $echo rm "$f" -done diff --git a/xpkg b/xpkg deleted file mode 100755 index c63962b..0000000 --- a/xpkg +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -e - -# xpkg -- fetch and extract pkgsrc archive - -case "$PWD" in -/usr/pkgsrc/*/*) ;; -*) echo "${0##*/}: not in package directory" 1>&2; exit 1 ;; -esac - -make fetch -f=/usr/pkgsrc/distfiles/$(sed -n '/.*(\(.*\)).*/{s//\1/;p;q}' distinfo) -d=$(tar -tf "$f" | head -1) - -opt= -if [ -e "$d" ]; then - printf "%s: $d already exists; overwrite? " "${0##*/}" - read ans - case $ans in - y*) opt=-U ;; - *) exit 1 ;; - esac -fi - -echo extracting archive... 1>&2 -tar -x $opt -f "$f" -echo "$d" -- cgit v1.2.3