Alex Efros wrote:

> Yeah, this is truth. I've tried to install only security updates for
> about a year, and after ~8 month I found it impossible to continue
> installing security updates without updating some packages I don't wanna
> update at that time... and some time later - without toolchain upgrade
> and complete system recompilation as result.

> So, I think not using ~arch and (in critical cases) freezing versions
> of some important packages (like MySQL) PLUS continuously updates is best
> way to ensure server security and stability.

Disappearing packages, especially ones being used in production, have really
bitten me in the ass.  Kernels and dropped versions of vmware-workstation
come to mind...

I get around this problem by patching in a "--nodelete" option for emerge. 
It is a very simple hack, all it does is _not_ add the --delete --force
--delete-after arguments to rsync if I run emerge --sync --nodelete.

Attached is a patch for emerge and emergehelp.py (portage-2.0.54) that adds
this option, if anyone is interested.  

To apply:
# cd /usr/lib/portage/bin
# patch -bp0 </wherever/emerge-nodelete.patch
# cd /usr/lib/portage/pym
# patch -bp0 </wherever/emergehelp-nodelete.patch

The second patch just adds a description of the argument to emerge --help...
Index: emerge
===================================================================
--- emerge	(revision 2)
+++ emerge	(working copy)
@@ -177,6 +177,7 @@
 "--getbinpkg",    "--getbinpkgonly",
 "--help",         "--noconfmem",
 "--newuse",       "--nocolor",
+"--nodelete",
 "--nodeps",       "--noreplace",
 "--nospinner",    "--oneshot",
 "--onlydeps",     "--pretend",
@@ -2428,10 +2429,7 @@
 			"--perms",        # Preserve permissions
 			"--times",        # Preserive mod times
 			"--compress",     # Compress the data transmitted
-			"--force",        # Force deletion on non-empty dirs
 			"--whole-file",   # Don't do block transfers, only entire files
-			"--delete",       # Delete files that aren't in the master tree
-			"--delete-after", # Delete only after everything else is done
 			"--stats",        # Show final statistics about what was transfered
       "--timeout="+str(mytimeout), # IO timeout if not done in X seconds
 			"--exclude='/distfiles'",   # Exclude distfiles from consideration
@@ -2450,6 +2448,11 @@
 		if "--debug" in myopts:
 			rsync_flags.append("--checksum") # Force checksum on all files
 
+		if not "--nodelete" in myopts:
+			rsync_flags.append("--force")        # Force deletion on non-empty dirs
+			rsync_flags.append("--delete")       # Delete files that aren't in the master tree
+			rsync_flags.append("--delete-after") # Delete only after everything else is done
+
 		if portage.settings.has_key("RSYNC_EXCLUDEFROM"):
 			if os.path.exists(portage.settings["RSYNC_EXCLUDEFROM"]):
 				rsync_flags.append("--exclude-from="+portage.settings["RSYNC_EXCLUDEFROM"])
Index: emergehelp.py
===================================================================
--- emergehelp.py	(revision 5)
+++ emergehelp.py	(working copy)
@@ -12,7 +12,7 @@
 	print bold("Usage:")
 	print "   "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuildfile")+" | "+turquoise("tbz2file")+" | "+turquoise("dependency")+" ] [ ... ]"
 	print "   "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >"
-	print "   "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >"
+	print "   "+turquoise("emerge")+" < "+turquoise("--sync")+" [ "+green("--nodelete")+" ] | "+turquoise("--metadata")+" | "+turquoise("--info")+" >"
 	print "   "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]"
 	print "   "+turquoise("emerge")+" "+turquoise("--help")+" [ "+green("system")+" | "+green("config")+" | "+green("sync")+" ] "
 	print bold("Options:")+" "+green("-")+"["+green("abcCdDefhikKlnNoOpPsSuUvV")+"] ["+green("--oneshot")+"] ["+green("--newuse")+"] ["+green("--noconfmem")+"]"
@@ -202,6 +202,12 @@
 		print "              of accidental deletion. With this option, files will always be"
 		print "              merged to the live fs instead of silently dropped."
 		print
+		print "       "+green("--nodelete")
+		print "              Normally during an "+bold("emerge --sync")+" the sync will delete"
+		print "              local copies of files that are no longer in the master tree.  The"
+		print "              "+bold("--nodelete")+" argument will prevent the rsync from deleting"
+		print "              any files."
+		print
 		print "       "+green("--nodeps")+" ("+green("-O")+" short option)"
 		print "              Merge specified packages, but don't merge any dependencies."
 		print "              Note that the build may fail if deps aren't satisfied."

Reply via email to