*** emerge.original Wed Sep 18 20:53:56 2002 --- emerge Wed Sep 18 23:43:26 2002 *************** *** 35,38 **** --- 35,39 ---- "--verbose", "--update", + "--changelog", "--help", "--oneshot", *************** *** 192,195 **** --- 193,200 ---- print " package." print + print " "+green("--changelog") + print " When pretending, also display the ChangeLog entries for packages" + print " that will be upgraded." + print print " "+green("--searchdesc")+" ("+green("-S")+" short option)" print " Matches the search string against the description field as well" *************** *** 860,863 **** --- 865,869 ---- def display(self,mylist): + changelogs = [] for x in mylist: if x[0]=="blocks": *************** *** 882,888 **** --- 888,949 ---- elif (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific_cat(x[2]): addl=" "+turquoise("U")+" " + changelogs.extend(self.calc_changelog( + portage.portdb.findname(x[2]), + portage.db["/"]["vartree"].dep_bestmatch('/'.join(portage.catpkgsplit(x[2])[:2])), + x[2] + )) else: addl=" "+green("N")+" " print "["+x[0]+" "+addl+"]",x[2],"to",x[1] + if "--changelog" in myopts: + print + for revision,text in changelogs: + print bold('*'+revision) + sys.stdout.write(text) + + + def calc_changelog(self,ebuildpath,current,next): + current = '-'.join(portage.catpkgsplit(current)[1:]) + if current.endswith('-r0'): current = current[:-3] + next = '-'.join(portage.catpkgsplit(next)[1:]) + if next.endswith('-r0'): next = next[:-3] + changelogpath = os.path.join(os.path.split(ebuildpath)[0],'ChangeLog') + changelog = open(changelogpath).read() + divisions = self.find_changelog_tags(changelog) + #print 'XX from',current,'to',next + #for div,text in divisions: print 'XX',div + # skip entries for all revisions above the one we are about to emerge + for i in range(len(divisions)): + if divisions[i][0]==next: + divisions = divisions[i:] + break + # find out how many entries we are going to display + for i in range(len(divisions)): + if divisions[i][0]==current: + divisions = divisions[:i] + break + else: + # couldnt find the current revision in the list. display nothing + return [] + return divisions + + def find_changelog_tags(self,changelog): + divs = [] + release = None + while 1: + match = re.search(r'^\*\ ?([-a-zA-Z0-9_.]*)(?:\ .*)?\n',changelog,re.M) + if match is None: + if release is not None: + divs.append((release,changelog)) + return divs + if release is not None: + divs.append((release,changelog[:match.start()])) + changelog = changelog[match.end():] + release = match.group(1) + if release.endswith('.ebuild'): + release = release[:-7] + if release.endswith('-r0'): + release = release[:-3] + def outdated(self):