From: paper42 <paper42@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] [RFC]: xbps-src: add vrm function
Date: Thu, 07 Apr 2022 21:10:19 +0200 [thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-36562@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]
There is a new pull request by paper42 against master on the void-packages repository
https://github.com/paper42/void-packages xbps-src-vrm
https://github.com/void-linux/void-packages/pull/36562
[RFC]: xbps-src: add vrm function
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **briefly**
<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
A patch file from https://github.com/void-linux/void-packages/pull/36562.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-xbps-src-vrm-36562.patch --]
[-- Type: text/x-diff, Size: 2315 bytes --]
From b7d184d8c08f51bdf046506fe8f95cecd295fe83 Mon Sep 17 00:00:00 2001
From: Michal Vasilek <michal@vasilek.cz>
Date: Thu, 7 Apr 2022 20:02:37 +0200
Subject: [PATCH] xbps-src: add vrm function
---
Manual.md | 5 +++++
common/environment/setup/vrm.sh | 34 +++++++++++++++++++++++++++++++++
xbps-src | 2 +-
3 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 common/environment/setup/vrm.sh
diff --git a/Manual.md b/Manual.md
index 8ec755499bbe..ae3cb5a8c7ca 100644
--- a/Manual.md
+++ b/Manual.md
@@ -362,6 +362,11 @@ The following functions are defined by `xbps-src` and can be used on any templat
it will default to `pkgname`. The `shell` argument can be one of `bash`,
`fish` or `zsh`.
+- *vrm()* `vrm [-r] <file...>`
+
+ Wrapper around rm that checks if the file exists and prints a warning if it
+ doesn't.
+
> Shell wildcards must be properly quoted, Example: `vmove "usr/lib/*.a"`.
<a id="global_vars"></a>
diff --git a/common/environment/setup/vrm.sh b/common/environment/setup/vrm.sh
new file mode 100644
index 000000000000..4c5971b8645d
--- /dev/null
+++ b/common/environment/setup/vrm.sh
@@ -0,0 +1,34 @@
+# Helper function for calling rm on files and prints a warning if the
+# file doesn't exist.
+
+vrm() {
+ local ARGS recursive broken
+ if [ "$1" = "-r" ]; then
+ recursive=yes
+ ARGS+=" -r"
+ shift
+ fi
+
+ msgfunc=msg_warn
+ if [ -n "$XBPS_STRICT" ]; then
+ msgfunc=msg_red
+ fi
+ for file in "$@"; do
+ if [ "$recursive" ] && ! [ -d "$file" ]; then
+ if [ -n "$XBPS_STRICT" ]; then
+ broken=yes
+ fi
+ $msgfunc "$pkgver: vrm: $file is not a directory\n"
+ elif [ -e "$file" ]; then
+ rm $ARGS "$file"
+ else
+ if [ -n "$XBPS_STRICT" ]; then
+ broken=yes
+ fi
+ $msgfunc "$pkgver: vrm: $file doesn't exist\n"
+ fi
+ done
+ if [ "$broken" ]; then
+ return 1
+ fi
+}
diff --git a/xbps-src b/xbps-src
index 8488c5a3a49c..17842cb46cc1 100755
--- a/xbps-src
+++ b/xbps-src
@@ -217,7 +217,7 @@ $(print_cross_targets)
with highest priority order than others.
-s
- Make vsed warnings errors.
+ Make some warnings errors.
-t Create a temporary masterdir to not pollute the current one. Note that
the existing masterdir must be fully populated with binary-bootstrap first.
next reply other threads:[~2022-04-07 19:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 19:10 paper42 [this message]
2022-04-07 19:18 ` [PR REVIEW] " subnut
2022-04-07 19:18 ` subnut
2022-07-11 2:14 ` github-actions
2022-07-25 2:14 ` [PR PATCH] [Closed]: " github-actions
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=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-36562@inbox.vuxu.org \
--to=paper42@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).