Skip to content

Commit

Permalink
Use bash for installing rpms from plain directory
Browse files Browse the repository at this point in the history
Also give an exit code in case globbing failed.
  • Loading branch information
dirkmueller committed Jul 2, 2024
1 parent 1602dc2 commit 055892e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 6 additions & 0 deletions package/libsolv.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jul 2 11:44:29 UTC 2024 - Dirk Müller <dmueller@suse.com>

- use bash(1) instead of findutils for recursing, reduces
dependencies

-------------------------------------------------------------------
Fri Jun 7 11:33:19 CEST 2024 - mls@suse.de

Expand Down
3 changes: 2 additions & 1 deletion package/libsolv.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ Summary: Utilities used by libzypp to manage .solv files
Group: System/Management
Provides: libsolv-tools:%{_bindir}/repo2solv
Conflicts: libsolv-tools < %{version}
# needed for recursive globbing of plaindir in repo2solv
Requires: /usr/bin/bash

%description tools-base
This subpackage contains utilities used by libzypp to manage solv files.
Expand All @@ -182,7 +184,6 @@ Group: System/Management
Conflicts: satsolver-tools-obsolete
Obsoletes: satsolver-tools < 0.18
Provides: satsolver-tools = 0.18
Requires: findutils
Requires: libsolv-tools-base = %{version}

%description tools
Expand Down
10 changes: 4 additions & 6 deletions tools/repo2solv.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ read_plaindir_repo(Repo *repo, const char *dir)
close(fds[1]);
}
if (recursive)
execl("/usr/bin/find", "/usr/bin/find", ".", "-name", ".", "-o", "-name", ".*", "-prune", "-o", "-name", "*.delta.rpm", "-o", "-name", "*.patch.rpm", "-o", "-name", "*.rpm", "-a", "-type", "f", "-print0", (char *)0);
execl("/usr/bin/bash", "/usr/bin/bash", "-c", "shopt -s globstar nullglob; printf '%s\\0' **/*.rpm", (char *)0);
else
execl("/usr/bin/find", "/usr/bin/find", ".", "-maxdepth", "1", "-name", ".", "-o", "-name", ".*", "-prune", "-o", "-name", "*.delta.rpm", "-o", "-name", "*.patch.rpm", "-o", "-name", "*.rpm", "-a", "-type", "f", "-print0", (char *)0);
perror("/usr/bin/find");
execl("/usr/bin/bash", "/usr/bin/bash", "-c", "shopt -s nullglob; printf '%s\\0' *.rpm", (char *)0);
perror("/usr/bin/bash");
_exit(1);
}
close(fds[1]);
Expand Down Expand Up @@ -219,10 +219,8 @@ read_plaindir_repo(Repo *repo, const char *dir)
}
if (wstatus)
{
fprintf(stderr, "find: exit status %d\n", (wstatus >> 8) | (wstatus & 255) << 8);
#if 0
fprintf(stderr, "bash: exit status %d\n", (wstatus >> 8) | (wstatus & 255) << 8);
res = 1;
#endif
}
repo_internalize(repo);
return res;
Expand Down

0 comments on commit 055892e

Please sign in to comment.