Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fixed installation process with the GNU Build System #69

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

alquerci
Copy link
Collaborator

Q A
Bug fix? yes (some unexpected make behaviours)
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Related tickets #66
License GNU GPLv3
  • Added to configure the check for only Python version 2.*, the version 3 is not supported.
  • Deals with DOS and Cygwin program path
  • Clean up .gitignore (build, dist)
  • Created a batch script for Windows Python (e.g. cyg-apt.bat)

Using a custum build system is not portable and it does not have all features
that required the GNU Coding Standards.

In order to come as close as possible to the GNU Coding Standards. Using
autotools is a good practice.

There are some changes:

  • the python library of this package is private so it does not install under
    the standard python site-package directory but on $(pkgdatadir)/python
    (default: /usr/local/share/cyg-apt/python)

  • to build from source it requires the automake package

  • the build process command line:

    Before:

    $ make
    

    After:

    $ autoreconf -i && ./configure && make
    
  • the tests suite command line:

    Before:

    $ make test
    

    After:

    $ make check
    
  • the installation tests suite command line:

    Before:

    $ make installtest
    

    After:

    $ make installcheck
    

@nylen
Copy link
Owner

nylen commented Oct 22, 2014

I'm not convinced that we want to make the process of installing more complicated for our users. What benefit does adhering to the GNU coding standards give? Isn't it better overall to just have people run make && make install, than have to worry about how a configure script works?

Also, I personally am not a fan of autotools, it's really really complicated and I think it nay be too much for this project. I may just not understand the point of it though.

@nylen
Copy link
Owner

nylen commented Oct 22, 2014

I am not trying to be harsh here, I'd like to hear your opinion on the benefits to these changes that justify the additional complexity. And I guess the user-facing install process in README.md isn't that much more complicated, I was looking at INSTALL.md instead.

@alquerci alquerci changed the title Fixed installation process with the GNU Build System [WIP] Fixed installation process with the GNU Build System Oct 22, 2014
@alquerci
Copy link
Collaborator Author

The point with configure is to check whether the user system is able to install cyg-apt and use it. Therefore this script checks the Python version (missing to check for only version 2), programs used and some other things required to install successfully.

It also create a config.py module that defines absolute path of gpg, mount... with dos path for a Windows Python and Cygwin path for Cygwin Python. This implementation is maybe not the better because a Windows Python cannot execute an installation for Cygwin Python with Cygwin program path, this point can be improved.

The current installation process is tricky and very bad coded for example, it does not take the correct path for programs (default path are absolute that is wrong). Moreover a custom Makefile implementation is hard to maintain.

With autotools the installation process is not so complicated but just more configurable for users if there want and more maintainable for maintainers (e.g. with make distcheck maintainers test all things).

Using a custum build system is not portable and it does not have all features
that required the [GNU Coding Standards][0].

In order to come as close as possible to the [GNU Coding Standards][0]. Using
[autotools][1] is a good practice.

There are some changes:

* the python library of this package is private so it does not install under
  the standard python `site-package` directory but on `pkglibdir`
  (default: `/usr/local/lib/cyg-apt`)

* to build from source it requires the `automake` package

* the build process command line:

  Before:

      $ make

  After:

      $ autoreconf -i && ./configure && make

* the tests suite command line:

  Before:

      $ make test

  After:

      $ make check

* the installation tests suite command line:

  Before:

      $ make installtest

  After:

      $ make installcheck

[0]: http://www.gnu.org/prep/standards/standards.html#Makefile-Conventions
[1]: http://www.gnu.org/software/automake/manual/automake.html#Autotools-Introduction
@nylen
Copy link
Owner

nylen commented Oct 22, 2014

Well, alright. Let me know when you think this PR is ready and I'll test it on a couple of my systems. And, please don't get hit by a bus :(

@alquerci
Copy link
Collaborator Author

I freeze the first commit for this PR at b7ac6c9 before cleaning commit history and merge it is almost ready. For one week I work only on it (cf. travis appveyor).

Indeed before merge it we need "health-insurance coverage".

Besides, there is a good tutorial that explain how autotools works (ref) it help me to understand the tool, before reading it I thought like you autotools is too complicated.

@nylen
Copy link
Owner

nylen commented Oct 22, 2014

I still think it is pretty complicated:

autotools-flowchart

But that is a really good tutorial, thanks!

@alquerci alquerci force-pushed the feature/autotools branch 3 times, most recently from 7830568 to 432518e Compare October 26, 2014 21:28
Create a batch script for Windows Python (e.g. cyg-apt.bat)
@alquerci alquerci force-pushed the feature/autotools branch 5 times, most recently from ec64d40 to 5a8588b Compare October 28, 2014 16:50
A python module is an architecture-independent file so it cannot be installed
on `$(pkglibdir)` directory.

An alternative should be on `$(pkgdatadir)/python` directory.
@alquerci
Copy link
Collaborator Author

I am trying to resolve the executable script problem:

  • shabang with a Windows Python

    #!/usr/bin/env c:/python26/python
    # /usr/local/bin/cyg-apt
    ...

    does not work because it will be the same as

    c:/python26/python /usr/local/bin/cyg-apt %*

    A Windows Python cannot interpret a Cygwin path.
    So installing for Windows Python will fail.

I don't know if the following solution is good.

There are three cases:

  • installing for Cygwin Python

    $ autoreconf -i
    $ ./configure
    ...
    checking for python platform... cygwin
    ...
    $ make install
    ...
    $ ls /usr/local/bin/cyg-apt*
    cyg-apt
  • installing for Windows Python

    $ autoreconf -i
    $ ./configure PYTHON=c:/python26/python
    ...
    checking for python platform... win32
    ...
    $ make install
    ...
    $ ls /usr/local/bin/cyg-apt*
    cyg-apt.bat
  • installing for both Cygwin Python and Windows Python

    $ autoreconf -i
    $ ./configure
    ...
    checking for python platform... cygwin
    ...
    $ make install
    ...
    $ ./configure PYTHON=c:/python26/python
    ...
    checking for python platform... win32
    ...
    $ # will only install `cyg-apt.bat` because all overs architecture-independent files
    $ # has been installed with the previous `make install`
    $ make install-exec
    ...
    $ ls /usr/local/bin/cyg-apt*
    cyg-apt    cyg-apt.bat

Edit:
Creating symbolic link to the batch file may deal with that ln -s cyg-apt.bat cyg-apt.

Look like executable extension cyg-apt for unix and cyg-apt.exe for win. It' similar to cross compiling.

When referring to sources files or targets in Automake variables, you do not
have to worry about source vs. build, because `make` will check both directories.

You may need $(srcdir) when specifying flags for tools, or writing custom
commands. E.g., to tell the compiler to include headers from `dir/`, you should
write `-I$(srcdir)/dir`, not `-Idir`. (`-Idir` would fetch headers from the
build tree.)
@alquerci
Copy link
Collaborator Author

This change will be merge for the version 2.0 for give us time to prepare users and finalize it.

@alquerci alquerci mentioned this pull request Apr 11, 2015
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants