--- portage.py.orig 2005-03-28 12:09:22.197908126 +0200 +++ portage.py 2005-03-20 11:49:11.000000000 +0200 @@ -1592,6 +1592,16 @@ if listonly or ("distlocks" not in features): use_locks = 0 + fetch_to_ro = 0 + if "skiprocheck" in features: + fetch_to_ro = 1 + + if not os.access(mysettings["DISTDIR"],os.W_OK) and fetch_to_ro: + if use_locks: + writemsg(red("!!! You are fetching to a read-only filesystem, you should turn locking off")); + writemsg("!!! This can be done by adding -distlocks to FEATURES in /etc/make.conf"); +# use_locks = 0 + # local mirrors are always added if custommirrors.has_key("local"): mymirrors += custommirrors["local"] @@ -1721,8 +1731,9 @@ can_fetch=True if not os.access(mysettings["DISTDIR"]+"/",os.W_OK): - print "!!! No write access to %s" % mysettings["DISTDIR"]+"/" - can_fetch=False + if not fetch_to_ro: + print "!!! No write access to %s" % mysettings["DISTDIR"]+"/" + can_fetch=False else: mystat=os.stat(mysettings["DISTDIR"]+"/") if mystat.st_gid != portage_gid: @@ -1834,7 +1845,7 @@ # check if we can actually write to the directory/existing file. if fetched!=2 and os.path.exists(mysettings["DISTDIR"]+"/"+myfile) != \ - os.access(mysettings["DISTDIR"]+"/"+myfile, os.W_OK): + os.access(mysettings["DISTDIR"]+"/"+myfile, os.W_OK) and not fetch_to_ro: writemsg(red("***")+" Lack write access to %s, failing fetch\n" % str(mysettings["DISTDIR"]+"/"+myfile)) fetched=0 break @@ -1862,7 +1873,8 @@ myret=spawn(myfetch,mysettings,free=1) finally: #if root, -always- set the perms. - if os.path.exists(mysettings["DISTDIR"]+"/"+myfile) and (fetched != 1 or os.getuid() == 0): + if os.path.exists(mysettings["DISTDIR"]+"/"+myfile) and (fetched != 1 or os.getuid() == 0) \ + and os.access(mysettings["DISTDIR"]+"/",os.W_OK): if os.stat(mysettings["DISTDIR"]+"/"+myfile).st_gid != portage_gid: try: os.chown(mysettings["DISTDIR"]+"/"+myfile,-1,portage_gid)