Re: generic debian/rules that creates directories

2014-01-02 Thread T o n g
On Wed, 01 Jan 2014 21:00:18 -0800, Russ Allbery wrote:

 There have been several replies to this, but none of them quite tell you
 exactly what to do, so let me take a stab at that.
 
 First, dh_installdirs is not actually useful for solving this particular
 problem . . . 

Thank you, thank you, thank you! At last someone has stepped forward and 
give specific help, instead of *merely* pointing to a manpage (and 
ironically a wrong one). 

Thanks again Sir, for your help!


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/la3uqm$btl$1...@ger.gmane.org



generic debian/rules that creates directories

2014-01-01 Thread T o n g
Hi,

Is it possible to have a generic debian/rules that creates directories? 

The upstream Makefiles was not designed to install into $DESTDIR but 
to /, so it assumes /usr/bin exists, while that creates problems for me:

  install -s -m 755 autogb /export/build/zh-autoconvert/bld/zh-
autoconvert-0.3.16/debian/tmp/usr/bin
  install: cannot create regular file '/export/build/zh-autoconvert/bld/
zh-autoconvert-0.3.16/debian/tmp/usr/bin': No such file or directory

Is it possible to alter the following `debian/rules` file so that it 
plays nicely with such upstream Makefiles? 

Thanks


$ cat debian/rules 
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-
make.
#
# Modified to make a template file for a multi-binary package with 
separated
# build-arch and build-indep targets  by Bill Allombert 2001

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS


%:
dh $@ 


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/la23r5$nk5$1...@ger.gmane.org



Re: generic debian/rules that creates directories

2014-01-01 Thread Gergely Nagy
T o n g mlist4sunt...@yahoo.com writes:

 Hi,

 Is it possible to have a generic debian/rules that creates directories? 

 The upstream Makefiles was not designed to install into $DESTDIR but 
 to /, so it assumes /usr/bin exists, while that creates problems for me:

   install -s -m 755 autogb /export/build/zh-autoconvert/bld/zh-
 autoconvert-0.3.16/debian/tmp/usr/bin
   install: cannot create regular file '/export/build/zh-autoconvert/bld/
 zh-autoconvert-0.3.16/debian/tmp/usr/bin': No such file or directory

 Is it possible to alter the following `debian/rules` file so that it 
 plays nicely with such upstream Makefiles? 

Yes. You want to use dh_installdirs(1). I suggest you read its manpage.
Mind you, you won't need to touch debian/rules for that.

-- 
|8]


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87eh4rjngh.fsf@algernon.balabit



Re: generic debian/rules that creates directories

2014-01-01 Thread T o n g
On Thu, 02 Jan 2014 00:23:42 +0100, Gergely Nagy wrote:

 Is it possible to alter the following `debian/rules` file so that it
 plays nicely with such upstream Makefiles?
 
 Yes. You want to use dh_installdirs(1). I suggest you read its manpage.
 Mind you, you won't need to touch debian/rules for that.

Ok, so I read the manpage of dh_installdirs(1), which I included below. 
But still how can I use it to create patch that I can send upstream to 
support creating $DESTDIR/usr/bin and so on, as suggested by Paul?

Things are getting far more complicated than I had anticipated. 

NAME

dh_installdirs − create subdirectories in package build directories

SYNOPSIS

dh_installdirs [debhelper options] [−A] [dir ...]

DESCRIPTION

dh_installdirs is a debhelper program that is responsible for creating 
subdirectories in package build directories.

FILES

debian/package.dirs

Lists directories to be created in package.

OPTIONS

−A, −−all

Create any directories specified by command line parameters in ALL 
packages acted on, not just the first.

dir ...

Create these directories in the package build directory of the first 
package acted on. (Or in all packages if −A is specified.)

SEE ALSO

debhelper(7)

This program is a part of debhelper.



-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/la2ond$ill$1...@ger.gmane.org



Re: generic debian/rules that creates directories

2014-01-01 Thread Paul Wise
On Thu, Jan 2, 2014 at 12:08 PM, T o n g wrote:

 Ok, so I read the manpage of dh_installdirs(1), which I included below.
 But still how can I use it to create patch that I can send upstream to
 support creating $DESTDIR/usr/bin and so on, as suggested by Paul?

The two topics are completely separate and unrelated.

dh_installdirs is a tool to create directories but it is usually only
needed to workaround deficiencies in upstream build systems.

To create a patch for upstream, learn about Makefile syntax, modify
the Makefile and diff your version of the Makefile against the old
one. How you do the diff depends on the upstream version control
system if any and your own preferences. Personally I choose git for
developing upstream stuff, even if they use no VCS or another VCS.

First add a workaround using dh_installdirs. Then send upstream a
patch. When upstream has accepted your patch and released a new
version, update the package to the new version and drop the
workaround.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAKTje6GGqRBjRMrd7ASbzs4WpW5=xreeuther_dq_r7tv7p...@mail.gmail.com



Re: generic debian/rules that creates directories

2014-01-01 Thread Russ Allbery
T o n g mlist4sunt...@yahoo.com writes:

 Is it possible to have a generic debian/rules that creates directories? 

 The upstream Makefiles was not designed to install into $DESTDIR but 
 to /, so it assumes /usr/bin exists, while that creates problems for me:

   install -s -m 755 autogb /export/build/zh-autoconvert/bld/zh-
 autoconvert-0.3.16/debian/tmp/usr/bin
   install: cannot create regular file '/export/build/zh-autoconvert/bld/
 zh-autoconvert-0.3.16/debian/tmp/usr/bin': No such file or directory

 Is it possible to alter the following `debian/rules` file so that it 
 plays nicely with such upstream Makefiles? 

There have been several replies to this, but none of them quite tell you
exactly what to do, so let me take a stab at that.

First, dh_installdirs is not actually useful for solving this particular
problem since dh_installdirs creates directories in the package staging
area.  Your problem is happening prior to that; make install of the
upstream source into debian/tmp is failing because it's expecting
$DESTDIR/usr/bin to already exist.  dh_installdirs doesn't create
directories in debian/tmp, so it doesn't help with that.

The quick solution that doesn't help other users of upstream is to edit
debian/rules and add the command:

install -d debian/tmp/usr/bin

prior to running make install (or, more likely, dh_auto_install).  If
you're using dh rule minimization and therefore aren't currently running
that directly, you do this with an override, which looks like:

override_dh_auto_install:
mkdir -p debian/tmp/usr/bin
dh_auto_install

The solution that helps other users of upstream as well is to look at the
upstream Makefile (or Makefile.in or Makefile.am, although probably not
the last since Automake gets this right) and find where it's running that
install command.  Add, before that install command, the command:

install -d $(DESTDIR)/$(bindir)

(or $(INSTALL) if upstream is generally using that).  This assumes an
Autoconf project that uses $(bindir); if upstream is using something else
to name the destination binary directory, use whatever variable upstream
is using; if they're just using usr/bin literally, then use:

install -d $(DESTDIR)/usr/bin

-- 
Russ Allbery (r...@debian.org)   http://www.eyrie.org/~eagle/


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87fvp7f065@windlord.stanford.edu



Re: generic debian/rules that creates directories

2014-01-01 Thread Russ Allbery
Russ Allbery r...@debian.org writes:

 First, dh_installdirs is not actually useful for solving this particular
 problem since dh_installdirs creates directories in the package staging
 area.  Your problem is happening prior to that; make install of the
 upstream source into debian/tmp is failing because it's expecting
 $DESTDIR/usr/bin to already exist.  dh_installdirs doesn't create
 directories in debian/tmp, so it doesn't help with that.

I guess I should say, for the sake of completeness, that you *can* make
dh_installdirs do this with the -P flag.  But I would find that confusing;
I think an explicit install -d is easier to understand.  And, regardless,
dh_installdirs isn't normally run before dh_auto_install, so you'd still
need an override if you're using dh.

-- 
Russ Allbery (r...@debian.org)   http://www.eyrie.org/~eagle/


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/87bnzvezzb@windlord.stanford.edu



Re: generic debian/rules that creates directories

2014-01-01 Thread Russ Allbery
Russ Allbery r...@debian.org writes:

 I guess I should say, for the sake of completeness, that you *can* make
 dh_installdirs do this with the -P flag.  But I would find that
 confusing; I think an explicit install -d is easier to understand.  And,
 regardless, dh_installdirs isn't normally run before dh_auto_install, so
 you'd still need an override if you're using dh.

Argh.  It is too run before dh_auto_install.  Sorry about the incorrect
information.  dh_installdirs would indeed work for this... except that I'm
still pretty sure it doesn't act on debian/tmp.

-- 
Russ Allbery (r...@debian.org)   http://www.eyrie.org/~eagle/


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/877gajezhj@windlord.stanford.edu