dotwaffle / rancid-git

DEPRECATED -- Strongly consider using the upstream, the version here is very out of date and a poor place to start from!
http://www.shrubbery.net/rancid/
Other
218 stars 92 forks source link

Building Debian package fails on fresh checkout #17

Closed jeremyvisser closed 10 years ago

jeremyvisser commented 10 years ago

I provisioned a fresh copy of Debian Wheezy on EC2 (ami-4e099a74, ap-southeast-2), and ran the following to attempt to build the package:

$ sudo apt-get update
$ sudo apt-get -y install devscripts git
$ git clone git://github.com/dotwaffle/rancid-git
$ cd rancid-git
$ debuild -S
$ cd ..
$ mk-build-deps rancid-git_2.3.8.dsc
$ sudo dpkg -i rancid-git-build-deps_2.3.8_all.deb
$ sudo apt-get -f install
$ cd rancid-git
$ debuild

I ended up with the following error:

configure: creating ./config.status
config.status: error: cannot find input file: `Makefile.in'
make: *** [build-stamp] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2
debuild: fatal error at line 1357:
dpkg-buildpackage -rfakeroot -D -us -uc failed

After a bit of experimentation, I noticed that the 'manual' (non-Debian) instructions on the site at http://dotwaffle.github.io/rancid-git/ suggested running autoreconf. So I edited debian/rules and changed these lines:

 build-stamp: patch-stamp
    dh_testdir
    aclocal
    autoconf

To these:

 build-stamp: patch-stamp
    dh_testdir
    autoreconf

It then builds successfully with debuild. Is that a bug?

jeremyvisser commented 10 years ago

In addition to the above issue, the resulting /usr/lib/rancid/bin/control_rancid binary file literally contained the following on line 461:

${exec_prefix}/bin/par -q -n $PAR_COUNT -c "rancid-fe {}" $devlistfile

It should have been (as far as I can tell — at least, I edited it to this to make it work):

/usr/lib/rancid/bin/par -q -n $PAR_COUNT -c "rancid-fe {}" $devlistfile

The original line from control_rancid.in was:

@bindir@/par -q -n $PAR_COUNT -c "rancid-fe {}" $devlistfile

On a side note, the file /usr/share/man/man1/par.1.gz is present in the resulting Debian package, causing it to conflict with the real par package.

dotwaffle commented 10 years ago

Thanks for the autoconf spot, I've fixed it as best I can. Unfortunately, I'm not a skilled packager, so I appreciate any input you may have.

Regarding the control_rancid element, I'm actually not sure how to proceed, because ./configure should fill in the exec_prefix variable before make is called. I'll think about this and come back to it later in the week, hopefully.

Thanks again.

jeremyvisser commented 10 years ago

I'm not a skilled packager either. All in the same boat here. :-)

Just a quick question about exec_prefix — is the call supposed to be ${exec_prefix}/bin/par (with exec_prefix defined earlier in the script, e.g. exec_prefix=/usr/lib/rancid), or is it supposed to be more like a string subsitution (with the command literally reading /usr/lib/rancid/bin/par)?

I'd like to do some digging on this one myself, but want to make sure I'm following the right trail first. :-)

dotwaffle commented 10 years ago

Can't remember exactly, think it might be libexec somewhere, but as I work in a CentOS shop I haven't got anything to test with ATM!

Will look into spinning up a vagrant Debian at some point and test things out properly!

jeremyvisser commented 10 years ago

I’ve built the following script that will build the package on a freshly installed Debian Wheezy system:

https://gist.github.com/jeremyvisser/8533999

$ cd ~
$ wget https://gist.github.com/jeremyvisser/8533999/raw/0e42150ff1a5ae8162f88120178dbfb78db11076/build-rancid-git.sh && chmod +x build-rancid-git.sh && sudo ./build-rancid-git.sh

By building that script I discovered two further bugs:

  1. dpatch should be listed inside Build-Depends
  2. /etc/rancid/rancid.conf should ship with RCSSYS=git (currently the default is RCSSYS=cvs which is fine for a generic package, but this package is unashamed to be called rancid-git)

After running that script, you can see the resulting control_rancid script:

$ grep 'bin/par' /usr/lib/rancid/bin/control_rancid 
${exec_prefix}/bin/par -q -n $PAR_COUNT -c "rancid-fe {}" $devlistfile
    ${exec_prefix}/bin/par -q -n $PAR_COUNT -c "rancid-fe \{}" $DIR/routers.up.missed
dotwaffle commented 10 years ago

dpatch is already a Build-Depends in debian/control AFAICT, and you're absolutely right about RCSSYS -- that's a problem with the way the git patch works. I've amended the autoconf script to automatically use git.

Hopefully that solves most of the issues, I just need to find a solution to the "par" problem!

jeremyvisser commented 10 years ago

My apologies, I can see why I got the dpatch bit mistaken — because I attempted to run dpkg-buildpackage -S to generate the source package needed to run mk-build-deps, which obviously happened before said Build-Depends were installed. Doh.

jeremyvisser commented 10 years ago

Just noticed commits ece122de27 and ed72e23c8c, and realised this isn't the first time you've dealt with this problem. Sorry I'm not much more help — I have close to 0% experience with automake.

dotwaffle commented 10 years ago

Hey, not a problem. You're doing a better job than most by actually reporting these bugs rather than most who just complain about it on third party web forums and I never hear about the angst of people new to the project!

Which reminds me, I really need to write some better documentation!

jeremyvisser commented 10 years ago

A further issue on this. It should depend on telnet, as you can go add method <host> telnet in .cloginrc, and if telnet is not installed, it will silently fail (well, it will claim the host is unreachable, which is inaccurate enough to count as a silent failure).

dotwaffle commented 10 years ago

Perhaps a "suggests" rather than "depends", but yes, I agree.

dotwaffle commented 10 years ago

Ok, I've bundled quite a few fixes in to the build. Seems to work ok. Hopefully that should close this issue!