Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 107548 Details for
Bug 126059
[PATCH] prevent ebuilds of installed packages from being deleted in emerge --sync
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
prototype script with experimental manifest support
vdb-sync-preserve.py (text/plain), 3.16 KB, created by
Marius Mauch (RETIRED)
on 2007-01-20 16:12:04 UTC
(
hide
)
Description:
prototype script with experimental manifest support
Filename:
MIME Type:
Creator:
Marius Mauch (RETIRED)
Created:
2007-01-20 16:12:04 UTC
Size:
3.16 KB
patch
obsolete
>#!/usr/bin/python > >import portage, portage_util >import sys, os, shutil >from portage_manifest import manifest2MiscfileFilter, manifest2AuxfileFilter, Manifest > >if not portage.settings.has_key("PORTDIR_BACKUP_OVERLAY"): > print "!!! PORTDIR_BACKUP_OVERLAY is unset, terminating" > sys.exit(1) > >backup_dir = portage_util.normalize_path(portage.settings["PORTDIR_BACKUP_OVERLAY"]) >if not os.path.exists(backup_dir): > print "*** Backup overlay %s doesn't exist, creating" % backup_dir > os.makedirs(backup_dir, 0755) > >vdb = portage.db["/"]["vartree"].dbapi >pdb = portage.db["/"]["porttree"].dbapi > >clist = vdb.cpv_all() >clist.sort() >flist = filter(pdb.cpv_exists, clist) >mlist = list(set(clist).difference(flist)) >mlist.sort() > >for cpv in flist: > ebuild_path, repopath = pdb.findname2(cpv) > if portage_util.normalize_path(repopath) != portage_util.normalize_path(portage.settings["PORTDIR"]): > print ">>> %s already in overlay %s, skipping" % (cpv, repopath) > continue > cp = "/".join(portage.catpkgsplit(cpv)[:2]) > source_dir = os.path.dirname(ebuild_path) > target_dir = os.path.join(backup_dir, cp) > if not os.path.exists(target_dir): > os.makedirs(target_dir, 0755) > elif os.path.exists(os.path.join(target_dir, os.path.basename(ebuild_path))): > print ">>> %s already stored in backup overlay, skipping" % cpv > continue > print ">>> Storing %s in backup overlay" % cpv > shutil.copy2(ebuild_path, os.path.join(target_dir, os.path.basename(ebuild_path))) > misc_files = filter(manifest2MiscfileFilter, map(os.path.basename, os.listdir(source_dir))) > aux_files = filter(manifest2AuxfileFilter, os.listdir(os.path.join(source_dir, "files"))) > aux_files = [os.path.join("files", x) for x in aux_files] > target_mf = Manifest(target_dir, portage.settings["DISTDIR"], manifest1_compat=False) > > target_mf.addFile("EBUILD", os.path.basename(ebuild_path)) > > for x in misc_files + aux_files: > source = os.path.join(source_dir, x) > target = os.path.join(target_dir, x) > if os.path.isdir(source): > if not os.path.exists(target): > os.makedirs(target, 0755) > else: > xdir = os.path.dirname(target) > if not os.path.exists(xdir): > os.makedirs(xdir, 0755) > shutil.copy2(source, target) > if x.startswith("files/"): > target_mf.addFile("AUX", x[6:]) > else: > target_mf.addFile("MISC", x) > fetchlist_dict = {cpv: portage.FetchlistDict(source_dir, portage.settings, pdb)[cpv]} > source_mf = Manifest(source_dir, portage.settings["DISTDIR"], fetchlist_dict=fetchlist_dict) > if not 2 in source_mf.getVersions() and len([x for x in fetchlist_dict[cpv] \ > if not os.path.exists(os.path.join(portage.settings["DISTDIR"], x))]) > 0: > print "*** %s doesn't have version 2 Manifest and distfiles are missing, can't regenerate Manifest" % cpv > del target_mf > continue > for x in fetchlist_dict[cpv]: > try: > target_mf.addFile("DIST", x, hashdict = source_mf.fhashdict["DIST"][x], ignoreMissing=True) > except Exception, e: > print "!!! %s caught while adding %s to Manifest, Manifest is incomplete" % (str(e), x) > continue > target_mf.write(force=True) > >print >print ">>> Backup finished" >print > > >if len(mlist) > 0: > print ">>> No ebuilds could be found for the following installed packages:" > for x in mlist: > print ">>> %s" % x >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 126059
:
107529
| 107548 |
107549