Comment 1 for bug 1719338

Revision history for this message
Ritesh Raj Sarraf (rrs) wrote : Re: [Bug 1719338] [NEW] loose check for backend detection

On Mon, 2017-09-25 at 15:04 +0000, Ritesh Raj Sarraf wrote:
> Currently, setup.py relies on '/etc/apt/sources.list' to detect if it
> is an apt based system.
> In my opinion, this is fragile, especially given that
> /etc/apt/sources.list.d/ sub config dir model is also supported.
>
> I propose that a check on /usr/bin/apt or /usr/bin/apt-get be made
> instead. Both binaries are provided by the 'apt' pacakge.

The other bigger problem is that this code check happens outside of any
target. Which results in even the clean target failing. And I cannot
counter the failure with a debian patch I carry in my packaging.

Hence, can you please fix the setup.py script to not be so fragile and
cut out a new release ?

My current patch to setup.py is below. It still is very fragile given
that both distribution types have the possibility of having the
secondary package manager.

LP: 1719338
DBUG: 876683
--- a/setup.py
+++ b/setup.py
@@ -85,7 +85,7 @@

 # try to auto-setup packaging_impl
 if len(sys.argv) >= 2 and sys.argv[1] != 'sdist' and not
os.path.exists('apport/packaging_impl.py'):
- if os.path.exists('/etc/apt/sources.list'):
+ if os.path.exists('/usr/bin/apt-get'):
         print('Installing apt/dpkg packaging backend.')
         shutil.copy('backends/packaging-apt-dpkg.py',
'apport/packaging_impl.py')
     elif os.path.exists('/usr/bin/rpm'):

--
Ritesh Raj Sarraf
RESEARCHUT - http://www.researchut.com
"Necessity is the mother of invention."