Skip to content

Commit 92d0ec2

Browse files
committed
install: name the bundled manifest 'manifest.in'. Cleanup
The installed manifest is a different file, so they should have different names. This should prevent various wierd conflicts in the future.
1 parent ce1e48a commit 92d0ec2

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

mk/dist.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,11 @@ dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
199199
dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
200200
dist-install-dir-$(1): PREPARE_CLEAN=true
201201
dist-install-dir-$(1): prepare-base-dir-$(1)
202+
# Write the install manifest, making sure the manifest contains itself
203+
$$(Q)touch $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest-$(1).in
202204
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find -type f | sed 's/^\.\///') \
203-
> tmp/manifest-$(1) # NB Use a tmp file so `find` doesn't *find the manifest*
204-
$$(Q)cp tmp/manifest-$(1) $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest
205+
> $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest-$(1).in
206+
# Add remaining non-installed files
205207
$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)
206208
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)
207209
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)

mk/install.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
install: dist-install-dir-$(CFG_BUILD)
1313
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
14+
# Remove tmp files while we can because they may have been created under sudo
15+
$(Q)rm -R tmp/dist/$(PKG_NAME)-$(CFG_BUILD/
1416

1517
uninstall: dist-install-dir-$(CFG_BUILD)
1618
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"

src/etc/install.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,16 @@ validate_opt
229229

230230
# Sanity check: can we can write to the destination?
231231
umask 022 && mkdir -p "${CFG_LIBDIR}"
232-
need_ok "directory creation failed"
232+
need_ok "can't write to destination. consider `sudo`."
233233
touch "${CFG_LIBDIR}/rust-install-probe" 2> /dev/null
234234
if [ $? -ne 0 ]
235235
then
236-
err "can't write to destination. try again with 'sudo'."
236+
err "can't write to destination. consider `sudo`."
237237
fi
238238
rm "${CFG_LIBDIR}/rust-install-probe"
239239
need_ok "failed to remove install probe"
240240

241+
# The file name of the manifest we're going to create during install
241242
INSTALLED_MANIFEST="${CFG_LIBDIR}/rustlib/manifest"
242243

243244
# First, uninstall from the installation prefix.
@@ -267,6 +268,7 @@ then
267268
warn "failed to remove rustlib"
268269
fi
269270
else
271+
# There's no manifest. If we were asked to uninstall, then that's a problem.
270272
if [ -n "${CFG_UNINSTALL}" ]
271273
then
272274
err "unable to find installation manifest at ${CFG_LIBDIR}/rustlib"
@@ -304,7 +306,7 @@ while read p; do
304306
FILE_INSTALL_PATH="${CFG_MANDIR}/$pp"
305307
fi
306308

307-
# Make sure ther's a directory for it
309+
# Make sure there's a directory for it
308310
umask 022 && mkdir -p "$(dirname ${FILE_INSTALL_PATH})"
309311
need_ok "directory creation failed"
310312

@@ -330,7 +332,7 @@ while read p; do
330332
need_ok "failed to update manifest"
331333

332334
# The manifest lists all files to install
333-
done < "${CFG_SRC_DIR}/lib/rustlib/manifest"
335+
done < "${CFG_SRC_DIR}/lib/rustlib/manifest.in"
334336

335337
echo
336338
echo " Rust is ready to roll."

0 commit comments

Comments
 (0)