-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to install the built rpm (without force) #62
Comments
That's interesting. It seems to want to own common directories such as "/opt". Did you do anything special to include the directories in the package? IIRC, we only create dirs if they are explicitly mentioned, but may be I'm wrong here. Can you share the exact thing you are trying to run? |
yep - its currently in a pr im working on here https://github.com/envoyproxy/envoy/pull/16899/files#diff-200c06371b99690e7a6152eefa0e7c8883e27b0a17016bb0a062a4acdf91fbc5R108 |
OK. The directories get added to the tar file, and tar2rpm just includes them. Annoyingly the rpm ecosystem assumes that when you build rpm's you also have all of the build deps installed and the basic filesystem directories. ( That is insane, and we are not going to do that. I start to think that tar2rpm should by default omit directories, and only include them explicitly. I'll try to think of something. |
Dropping in here because I also have this issue with rpmpack and did not have this issue with FPM FPM seems to address the issue by maintaining its own allowlist of directories to ignore: https://github.com/jordansissel/fpm/blob/4f51caf8fc4de914e3dc261706a5dfabd2d94778/templates/rpm/filesystem_list but also allows the user to use CLI flags to both add to that list or disable directory ignoring altogether. IMO the most straightforward approach would be for rpmpack to take a similar approach: default to ignoring common directories and allowing the user to configure these with CLI flags. To throw out an idea: maybe rather than include the list of 14 thousand directories specifically from EL6 that FPM uses perhaps the list could be filtered to just the 60 directories that are one to two levels deep?
and anything more complex than that (e.g. if I had a package that installed something in |
as a ~simple workaround, i added something to strip all of the directories from the tarball |
it didnt land yet, but the workaround is something like: native.genrule(
name = "tar-rpm-data",
tools = ["//tools/distribution:strip_dirs"],
srcs = [":base-tar-rpm-data"],
cmd = """
$(location //tools/distribution:strip_dirs) \
$(location :base-tar-rpm-data) \
$@
""",
outs = ["tar-rpm-data.tar"],
) and with tempfile.TemporaryDirectory() as tempdir:
with tarfile.open(self.args.infile) as f:
f.extractall(path=tempdir)
with tarfile.open(self.args.outfile, "w") as f:
for root, dirs, files in os.walk(tempdir):
for filename in files:
fpath = os.path.join(root, filename)
f.add(
fpath,
filter=self.reset,
arcname=fpath.replace(tempdir, "").lstrip("/")) im wondering if it could be done in bash, or better still not required at all |
As in not specifying the directories in the RPM's spec? If this means the RPM will create the files in the specified location but not create the parent directories, I think that fixes the problem for me. I would be curious what that the behavior would be if the parent direct doesn't exist (e.g. As long as I am not picky about directory ownership I imagine I could worth through those two problems with lifecycle scripts (e.g. |
…ories to inlclude. Content is always included. fixes google#62
I've suggested a solution in #70, please take a look. |
@notnarb Our test cases (in example_bazel) include the case of missing parents, and rpm seems to install fine. OTOH, none of my tests need |
i originally posted the bug testing against the universal base image 7 |
…ories to inlclude. Content is always included. fixes google#62
Is there any chance you can build an rpm with the changes from #70, and see if it works? I couldn't reproduce the issue even with the universal base image 7. |
I can reproduce this with the centos:7 image Build file config (some details truncated/renamed)pkg_tar(
name = "watcher_script",
srcs = [...],
package_dir = "opt/test/watcher",
)
pkg_tar(
name = "watcher_service",
srcs = ["watcher.service"],
package_dir = "etc/systemd/system",
)
pkg_tar(
name = "watcher_tar",
ownername = "root.root",
deps = [
":watcher_script",
":watcher_service",
],
)
pkg_tar2rpm(
name = "watcher_rpm",
data = ":watcher_tar",
pkg_name = "watcher",
...
) then an
I'll try your PR soon to see if it resolves the issue |
FWIW I could reproduce with ubi-minimal:8.5 as well.
|
I can confirm that when using Workspace Diffdiff --git a/WORKSPACE b/WORKSPACE
index fbcd8799..285cc140 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -365,8 +365,8 @@ http_file(
git_repository(
name = "com_github_google_rpmpack",
# Lastest commit in main branch as of 2021-09-22
- commit = "dc539ef4f2ea1c53ab359280cadc7249f2fb3e61",
- remote = "https://github.com/google/rpmpack.git",
+ commit = "3d6252945290ac5a55ebe5bc675ff9d49a4e6226",
+ remote = "https://github.com/jarondl/rpmpack.git",
)
load("@com_github_google_rpmpack//:deps.bzl", "rpmpack_dependencies")
diff --git a/-redacted-/-redacted-/-redacted-/BUILD b/-redacted-/-redacted-/-redacted-/BUILD
index f6cb5d9e..33f5f393 100644
--- a/-redacted-/-redacted-/-redacted-/BUILD
+++ b/-redacted-/-redacted-/-redacted-/BUILD
@@ -56,5 +56,6 @@ pkg_tar2rpm(
requires = [
"PyYAML",
],
+ use_dir_allowlist = True,
version = "0.0.1",
) I've verified the new RPM works in:
|
Ive been trying to build an rpm using
pkg_tar2rpm
when i go to install the rpm im seeing the following errors
if i use
rpm -i --force my.rpm
it works - im wondering what im doing wrong (or not doing right) that is fooing the paths in the packageThe text was updated successfully, but these errors were encountered: