patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH] Don't assume /var/empty exists in Makefiles
@ 2022-04-06  8:20 Alyssa Ross
  2022-04-10  8:13 ` Alyssa Ross
  0 siblings, 1 reply; 2+ messages in thread
From: Alyssa Ross @ 2022-04-06  8:20 UTC (permalink / raw)
  To: devel; +Cc: Ville Ilvonen

It apparently doesn't on Ubuntu, and this way we also don't have to
hack around it being missing in the Nix sandbox.

Reported-by: Ville Ilvonen <ville.ilvonen@unikie.com>
---
 host/rootfs/Makefile       | 9 ++++++---
 host/rootfs/default.nix    | 5 -----
 vm/app/catgirl/Makefile    | 9 ++++++---
 vm/app/catgirl/default.nix | 5 -----
 vm/app/lynx/Makefile       | 9 ++++++---
 vm/app/lynx/default.nix    | 5 -----
 vm/sys/net/Makefile        | 9 ++++++---
 vm/sys/net/default.nix     | 5 -----
 8 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index 87bc15e..d78cc4c 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -45,15 +45,18 @@ LINKS = bin sbin
 BUILD_FILES = build/etc/mdev/modalias.sh build/etc/s6-rc
 MOUNTPOINTS = dev ext run proc sys
 
-build/rootfs.tar: $(PACKAGES_TAR) $(FILES) $(BUILD_FILES)
+build/empty:
+	mkdir -p $@
+
+build/rootfs.tar: build/empty $(PACKAGES_TAR) $(FILES) $(BUILD_FILES)
 	cp --no-preserve=mode -f $(PACKAGES_TAR) $@
 	tar $(TARFLAGS) --append -f $@ $(FILES) $(LINKS)
 	echo $(BUILD_FILES) | cut -d/ -f2 | \
 	    tar $(TARFLAGS) --append -f $@ -C build -T -
 	for m in $(MOUNTPOINTS); do \
-	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," /var/empty ; \
+	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," build/empty ; \
 	done
-	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' /var/empty
+	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' build/empty
 
 build/etc/mdev/modules.map: scripts/modprobe/gen_modules.map.awk
 	mkdir -p $$(dirname $@)
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index cb02445..0bef7ba 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -94,11 +94,6 @@ stdenv.mkDerivation {
   MODULES_ORDER = "${kernel}/lib/modules/${kernel.modDirVersion}/modules.order";
   PACKAGES_TAR = packagesTar;
 
-  postPatch = ''
-    mkdir $NIX_BUILD_TOP/empty
-    substituteInPlace Makefile --replace /var/empty $NIX_BUILD_TOP/empty
-  '';
-
   installPhase = ''
     cp build/rootfs.ext4 $out
   '';
diff --git a/vm/app/catgirl/Makefile b/vm/app/catgirl/Makefile
index 5029bb4..3ee5842 100644
--- a/vm/app/catgirl/Makefile
+++ b/vm/app/catgirl/Makefile
@@ -55,15 +55,18 @@ VM_LINKS = bin etc/ssl/certs/ca-certificates.crt
 VM_BUILD_FILES = build/etc/s6-rc
 VM_MOUNTPOINTS = dev run proc sys
 
-build/rootfs.tar: $(PACKAGES_TAR) $(VM_FILES) $(VM_BUILD_FILES)
+build/empty:
+	mkdir -p $@
+
+build/rootfs.tar: build/empty $(PACKAGES_TAR) $(VM_FILES) $(VM_BUILD_FILES)
 	cp --no-preserve=mode -f $(PACKAGES_TAR) $@
 	tar $(TARFLAGS) --append -f $@ $(VM_FILES) $(VM_LINKS)
 	echo $(VM_BUILD_FILES) | cut -d/ -f2 | \
 	    tar $(TARFLAGS) --append -f $@ -C build -T -
 	for m in $(VM_MOUNTPOINTS); do \
-	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," /var/empty ; \
+	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," build/empty ; \
 	done
-	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' /var/empty
+	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' build/empty
 
 VM_S6_RC_FILES = \
 	etc/s6-rc/catgirl/run \
diff --git a/vm/app/catgirl/default.nix b/vm/app/catgirl/default.nix
index 230da00..bf35d04 100644
--- a/vm/app/catgirl/default.nix
+++ b/vm/app/catgirl/default.nix
@@ -74,11 +74,6 @@ stdenv.mkDerivation {
   PACKAGES_TAR = packagesTar;
   VMLINUX = "${kernel.dev}/vmlinux";
 
-  postPatch = ''
-    mkdir $NIX_BUILD_TOP/empty
-    substituteInPlace Makefile --replace /var/empty $NIX_BUILD_TOP/empty
-  '';
-
   installPhase = ''
     mv build/svc $out
   '';
diff --git a/vm/app/lynx/Makefile b/vm/app/lynx/Makefile
index f449d27..016b1f5 100644
--- a/vm/app/lynx/Makefile
+++ b/vm/app/lynx/Makefile
@@ -55,15 +55,18 @@ VM_LINKS = bin etc/ssl/certs/ca-certificates.crt
 VM_BUILD_FILES = build/etc/s6-rc
 VM_MOUNTPOINTS = dev run proc sys
 
-build/rootfs.tar: $(PACKAGES_TAR) $(VM_FILES) $(VM_BUILD_FILES)
+build/empty:
+	mkdir -p $@
+
+build/rootfs.tar: build/empty $(PACKAGES_TAR) $(VM_FILES) $(VM_BUILD_FILES)
 	cp --no-preserve=mode -f $(PACKAGES_TAR) $@
 	tar $(TARFLAGS) --append -f $@ $(VM_FILES) $(VM_LINKS)
 	echo $(VM_BUILD_FILES) | cut -d/ -f2 | \
 	    tar $(TARFLAGS) --append -f $@ -C build -T -
 	for m in $(VM_MOUNTPOINTS); do \
-	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," /var/empty ; \
+	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," build/empty ; \
 	done
-	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' /var/empty
+	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' build/empty
 
 VM_S6_RC_FILES = \
 	etc/s6-rc/lynx/run \
diff --git a/vm/app/lynx/default.nix b/vm/app/lynx/default.nix
index f7791d8..b188794 100644
--- a/vm/app/lynx/default.nix
+++ b/vm/app/lynx/default.nix
@@ -74,11 +74,6 @@ stdenv.mkDerivation {
   PACKAGES_TAR = packagesTar;
   VMLINUX = "${kernel.dev}/vmlinux";
 
-  postPatch = ''
-    mkdir $NIX_BUILD_TOP/empty
-    substituteInPlace Makefile --replace /var/empty $NIX_BUILD_TOP/empty
-  '';
-
   installPhase = ''
     mv build/svc $out
   '';
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 642c815..7103c0e 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -55,15 +55,18 @@ VM_LINKS = bin var/run
 VM_BUILD_FILES = build/etc/s6-rc
 VM_MOUNTPOINTS = dev run proc sys var/lib/connman
 
-build/rootfs.tar: $(PACKAGES_TAR) $(VM_FILES) $(VM_BUILD_FILES)
+build/empty:
+	mkdir -p $@
+
+build/rootfs.tar: build/empty $(PACKAGES_TAR) $(VM_FILES) $(VM_BUILD_FILES)
 	cp --no-preserve=mode -f $(PACKAGES_TAR) $@
 	tar $(TARFLAGS) --append -f $@ $(VM_FILES) $(VM_LINKS)
 	echo $(VM_BUILD_FILES) | cut -d/ -f2 | \
 	    tar $(TARFLAGS) --append -f $@ -C build -T -
 	for m in $(VM_MOUNTPOINTS); do \
-	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," /var/empty ; \
+	    tar $(TARFLAGS) --append -hf $@ --xform="s,.*,$$m," build/empty ; \
 	done
-	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' /var/empty
+	tar $(TARFLAGS) --append -hf $@ --xform='s,.*,etc/service,' build/empty
 
 VM_S6_RC_FILES = \
 	etc/s6-rc/connman/dependencies \
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index e3bd996..55ae9cb 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -83,11 +83,6 @@ stdenv.mkDerivation {
   PACKAGES_TAR = packagesTar;
   VMLINUX = "${kernel.dev}/vmlinux";
 
-  postPatch = ''
-    mkdir $NIX_BUILD_TOP/empty
-    substituteInPlace Makefile --replace /var/empty $NIX_BUILD_TOP/empty
-  '';
-
   installPhase = ''
     mv build/svc $out
   '';
-- 
2.35.1


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

* Re: [PATCH] Don't assume /var/empty exists in Makefiles
  2022-04-06  8:20 [PATCH] Don't assume /var/empty exists in Makefiles Alyssa Ross
@ 2022-04-10  8:13 ` Alyssa Ross
  0 siblings, 0 replies; 2+ messages in thread
From: Alyssa Ross @ 2022-04-10  8:13 UTC (permalink / raw)
  To: Alyssa Ross, devel; +Cc: Ville Ilvonen

This patch has been committed as a567476380303fe0ccb0c136ad7e9a475ef53b1a,
which can be viewed online at
https://spectrum-os.org/git/spectrum/commit/?id=a567476380303fe0ccb0c136ad7e9a475ef53b1a.

This is an automated message.  Send comments/questions/requests to:
Alyssa Ross <hi@alyssa.is>

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

end of thread, other threads:[~2022-04-10  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06  8:20 [PATCH] Don't assume /var/empty exists in Makefiles Alyssa Ross
2022-04-10  8:13 ` Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

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).