Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] xbps-src: add a command `show-diff`
@ 2025-01-12 22:34 tornaria
  2025-01-15 12:48 ` sgn
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tornaria @ 2025-01-12 22:34 UTC (permalink / raw)
  To: ml

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

There is a new pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages show-diff
https://github.com/void-linux/void-packages/pull/53950

[RFC] xbps-src: add a command `show-diff`
Usage: ./xbps-src show-diff PKG

Shows differences between the original sources and $wrksrc, in the form
of a patch that can be used for the template.

Note this ignores new files.


#### Testing the changes
- I tested the changes in this PR: **briefly**


#### Alternatives

One alternative suggested in irc is to use unpatch from

https://leahneukirchen.org/dotfiles/bin/unpatch

Save the original files as .orig, then run

- `unpatch -g -p3 masterdir-*/builddir/pkg-ver`

With vim, one can use `:set patchmode=.orig`


Two more suggestions from irc related to this:

 - `alias xpatch="nvim -c 'set patchmode=.orig'"`

 - `autocmd BufNewFile,BufRead masterdir-*/builddir/* setlocal patchmode=.orig`


A patch file from https://github.com/void-linux/void-packages/pull/53950.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-show-diff-53950.patch --]
[-- Type: text/x-diff, Size: 1248 bytes --]

From f912225d0bc665b112a059b193471efdeaa1f7e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 12 Jan 2025 19:10:43 -0300
Subject: [PATCH] xbps-src: add a command `show-diff`

Usage: ./xbps-src show-diff PKG

Shows differences between the original sources and $wrksrc, in the form
of a patch that can be used for the template.

Note this ignores new files.
---
 xbps-src | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/xbps-src b/xbps-src
index c17270b62ee4b5..63e570dd7b1a00 100755
--- a/xbps-src
+++ b/xbps-src
@@ -968,6 +968,18 @@ case "$XBPS_TARGET" in
                 fi # The trailing space gets stripped before printing anyway
         done
         ;;
+    show-diff)
+        read_pkg ignore-problems
+        mkdir -p "${XBPS_STATEDIR}/show-diff"
+        cd "${XBPS_STATEDIR}/show-diff"
+        if [ ! -d clean-wrksrc ]; then
+            ( . "${XBPS_COMMONDIR}/hooks/do-extract/00-distfiles.sh"
+              wrksrc="$PWD/clean-wrksrc" hook )
+            ln -Ts clean-wrksrc a
+            ln -Trs "$wrksrc" b
+        fi
+        diff -ru a b | grep -v '^Only in b[/:]'
+        ;;
     dbulk-dump)
         read_pkg
         check_pkg_arch "$XBPS_CROSS_BUILD"

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-07 19:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-12 22:34 [PR PATCH] [RFC] xbps-src: add a command `show-diff` tornaria
2025-01-15 12:48 ` sgn
2025-04-16  2:08 ` github-actions
2025-04-16 13:56 ` tornaria
2025-06-07 19:07 ` [PR PATCH] [Closed]: " tornaria

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).