First of all kudos to @ggreer I really like ag. My problem was searching zip compressed folders with it.

The issue I’m trying to fix is #743 Implement searching in zip-files.

As stated there I needed to decide how to process zip files or to be more specific, how to handle zip folder structures. A zip file with the following structure could’ve been easily handled with the existing API:

file.zip
|-- file.txt

A file looking like this couldn’t:

file.zip
|-- file.txt
|-- folder/
    |-- file2.txt

At this point I wanted input how to proceed but zip processing isn’t that important. Import for @ggreer was primary the correct implementation of ignore files as stated in his blog.

I decided to break the API in terms of implementing a process_zip() method which handles parsing a zip file and passing all files (not folders) within this file to search_buf().

At first I began writing the method and it worked… On my system… only. I realized this when opening my first pull request pr #840.

Problems

  • I need libzip version 1.0 or greater
  • I need to add this version of libzip to travis

Adding the requirement of version 1.0 wasn’t that hard to do. Adding

PKG_CHECK_MODULES([LIBZIP], [libzip >= 1.0])

to configure.ac was enough to the ag that the standard installation of v0.11 isn’t working.

Adding libzip-1.0 to travis was a tad bit more annoying -.-

Trying to install libzip-dev yielded said version 0.11 of libzip. Trying to do a manual install brought forth a couple of minor hurdles (most of them were generated by me not RTFMing -.-‘). Heres what not to do:

  • adding the pre install ./configure && make &&make install at the wrong point in the tarvis.yml 1
  • not compiling the correct branch (all commits before 2)
  • not working in the right dir 3 & 4
  • but most importantly spamming @ggreer with every commit I made at 1 a.m. until 5 That even resulted in a commit by him removing notifications in his repo 6

So after managing to do all of the above points my travis config looks like this:

language: c

branches:
  only:
    - master
    - zip

compiler:
  - clang
  - gcc

before_install:
  - sudo add-apt-repository -y 'ppa:ubuntu-toolchain-r/test'
  - sudo add-apt-repository -y 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise-3.6 main'
  - curl http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
  - sudo apt-get update -q
  - sudo apt-get install -q -y automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev
  - sudo apt-get install -y clang-format-3.6

before_script:
  - sudo pip install cram
  - wget http://nih.at/libzip/libzip-1.1.1.tar.gz -O /tmp/libzip-1.1.1.tar.gz
  - pushd /tmp
  - tar -xvf /tmp/libzip-1.1.1.tar.gz
  - cd libzip-1.1.1
  - ./configure --prefix=/usr && make && sudo make install
  - popd

script:
  - ./build.sh && make test

The interesting part is before_script & branches: zip

Result

After fixing my travis.yml and annoying @ggreer at 1am the only thing left to do was running ./format.sh reformat. Which would’ve been the most relaxing part if not for the fact that the .clang-format needs clang-format v3.6 which my mac doesn’t have^^