Complete.Org: Mailing Lists: Archives: offlineimap: May 2006:
Re: [PATCH] improve savemessage_searchforheader
Home

Re: [PATCH] improve savemessage_searchforheader

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: offlineimap@xxxxxxxxxxxx
Subject: Re: [PATCH] improve savemessage_searchforheader
From: Adam Spiers <offlineimap@xxxxxxxxxxxxxx>
Date: Sun, 14 May 2006 23:03:57 +0100
Reply-to: Adam Spiers <offlineimap@xxxxxxxxxxxxxx>

John Goerzen (jgoerzen@xxxxxxxxxxxx) wrote:
> On Tue, May 02, 2006 at 09:50:18AM +0100, Adam Spiers wrote:
> > OK.  If you managed just to find time to verify my suspicions, I might
> > be able to find a few minutes to make the code more robust...
> 
> Yes, I do believe you are correct.  I haven't tested it to make sure,
> but this could account for some of the odd things people have reported
> sometimes.
[snipped]

> If you'd like to mail me the updated .spec file directly, I would be
> happy to commit it to my source tree.

OK, I branched your darcs repository, made savemessage_searchforheader
more robust, updated the .spec file, and added a couple of targets to
the Makefile to make it easy to build rpms.

See attached, though you should also be able to darcs pull from:

  http://www.adamspiers.org/darcs/offlineimap/

Note that the spec file currently needs updating each time you do a
release - the version/release numbers at the top, and the %changelog
section at the bottom.


-- Attached file included as plaintext by Ecartis --


New patches:

[add .spec file and Makefile rule for building an rpm
Adam Spiers <darcs@xxxxxxxxxxxxxx>**20060514205952] 
<
> {
hunk ./Makefile 17
 #    You should have received a copy of the GNU General Public License
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+VERSION=4.0.13
+TARGZ=offlineimap_$(VERSION).tar.gz
 SHELL=/bin/bash
 
 clean:
hunk ./Makefile 46
        groff -Tascii -man offlineimap.1 | sed $$'s/.\b//g' > manual.txt
        -rm manpage.links manpage.refs
 
+targz: ../$(TARGZ)
+../$(TARGZ):
+       if ! pwd | grep -q "/offlineimap-$(VERSION)$$"; then                    
\
+         echo "Containing directory must be called offlineimap-$(VERSION)";    
\
+         exit 1;                                                               
\
+       fi;                                                                     
\
+       pwd && cd .. && pwd && tar -zhcv --exclude '_darcs' -f $(TARGZ) 
offlineimap-$(VERSION)
+
+rpm: targz
+       cd .. && sudo rpmbuild -ta $(TARGZ)
addfile ./offlineimap.spec
hunk ./offlineimap.spec 1
+Name: offlineimap
+Summary: Powerful IMAP/Maildir synchronization and reader support
+Version: 4.0.13
+Release: 1
+License: GPL
+Group: Applications/Internet
+URL: http://quux.org:70/devel/offlineimap
+Source0: %{name}_%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+Requires: python >= 2.2.1
+
+%description
+OfflineIMAP is  a  tool  to   simplify   your   e-mail  reading.   With
+OfflineIMAP,  you  can  read  the same mailbox from multiple computers.
+You get a current copy of your messages on each computer,  and  changes
+you make one place will be visible on all other systems.  For instance,
+you can delete a message on your home  computer,  and  it  will  appear
+deleted  on  your work computer as well.  OfflineIMAP is also useful if
+you want to use a mail reader that does not have IMAP support, has poor
+IMAP support, or does not provide disconnected operation.
+
+%prep
+%setup
+
+%build
+python setup.py build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+python setup.py install --prefix=$RPM_BUILD_ROOT%{_prefix}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%doc docs manual.* README COPY* ChangeLog* UPGRADING
+/usr/bin/*
+/usr/lib/python*
+
+%changelog
+* Sun May 14 2006 Adam Spiers <adam@xxxxxxxxxx> 4.0.13-1
+- Updated for 4.0.13
+
+* Sat Apr 29 2006 Adam Spiers <offlineimap@xxxxxxxxxxxxxx> 4.0.11-2
+- Add patch for Groupwise IMAP servers.
+
+* Fri Apr 28 2006 Adam Spiers <offlineimap@xxxxxxxxxxxxxx> 4.0.11-1
+- Initial build.
+
+
}
[use install --root for buildroot not --prefix
Adam Spiers <darcs@xxxxxxxxxxxxxx>**20060514211523] 
<
> {
hunk ./offlineimap.spec 30
 
 %install
 rm -rf $RPM_BUILD_ROOT
-python setup.py install --prefix=$RPM_BUILD_ROOT%{_prefix}
+python setup.py install --root=$RPM_BUILD_ROOT
 
 %clean
 rm -rf $RPM_BUILD_ROOT
}
[make savemessage_searchforheader more robust
Adam Spiers <darcs@xxxxxxxxxxxxxx>**20060514215112] 
<
> {
hunk ./offlineimap/folder/IMAP.py 162
         headervalue = imapobj._quote(headervalue)
         try:
             matchinguids = imapobj.uid('search', 'HEADER', headername, 
headervalue)[1][0]
-        except imapobj.error:
+        except imapobj.error, err:
             # IMAP server doesn't implement search or had a problem.
hunk ./offlineimap/folder/IMAP.py 164
-            return 0
+            raise ValueError, "Got IMAP error while attempting to find UID for 
message with header %s: %s" % (headername, err)
         ui.debug('imap', 'savemessage_searchforheader got initial 
matchinguids: ' + repr(matchinguids))
hunk ./offlineimap/folder/IMAP.py 166
-               
+
+        if matchinguids == '':
+            raise ValueError, "Search for UID for message with header %s 
yielded no results" % headername
+
         matchinguids = matchinguids.split(' ')
         ui.debug('imap', 'savemessage_searchforheader: matchinguids now ' + \
                  repr(matchinguids))
}

Context:

[Prepping 4.0.13
John Goerzen <jgoerzen@xxxxxxxxxxxx>**20060504123720] 
[Revert restoreatime patch
John Goerzen <jgoerzen@xxxxxxxxxxxx>**20060504030546] 
[TAG DEBIAN_offlineimap_4.0.12
John Goerzen <jgoerzen@xxxxxxxxxxxx>**20060501145611] 
Patch bundle hash:
e816e14bc1b472c683ef8aedbc701e0fe7a06f7b




[Prev in Thread] Current Thread [Next in Thread]