Patchwork [4,of,5,remotefilelog-ext,debs] contrib: new rules for building a debian package of remotefilelog

login
register
mail settings
Submitter Augie Fackler
Date Sept. 10, 2015, 3:34 p.m.
Message ID <9fec75539a1e42cee876.1441899262@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/10469/
State Rejected
Headers show

Comments

Augie Fackler - Sept. 10, 2015, 3:34 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1441897296 14400
#      Thu Sep 10 11:01:36 2015 -0400
# Node ID 9fec75539a1e42cee876b481f1e748dafc1f347c
# Parent  dbe55fd6989b767892e8cc1350f8d0d7197a361c
contrib: new rules for building a debian package of remotefilelog

To build it, simply do `bash contrib/builddeb`, which will build a
debian package for the current host system.
Augie Fackler - Sept. 10, 2015, 6:04 p.m.
On Thu, Sep 10, 2015 at 11:34 AM, Augie Fackler <raf@durin42.com> wrote:
> + mercurial,

It occurs to me we probably shouldn't have a hard dep on mercurial,
and instead Mercurial should be in suggests or recommends. Strictly
speaking you /can/ install this deb without hg and it's "fine", and it
strikes me that that'll likely be the configuration I run with in the
long term (that is, hg self-installed, but remotefilelog coming from a
company-built package.) What do y'all think?
Augie Fackler - Sept. 10, 2015, 6:22 p.m.
On Thu, Sep 10, 2015 at 11:34 AM, Augie Fackler <raf@durin42.com> wrote:
> +Architecture: any

Urgh. I think this should say "all" and not "any" since remotefilelog
has no native code contents.

Once we make decisions about having a dep on mercurial, I'll gladly
mail a v2 if you like.
Matt Harbison - Sept. 10, 2015, 11:20 p.m.
On Thu, 10 Sep 2015 11:34:22 -0400, Augie Fackler <raf@durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1441897296 14400
> #      Thu Sep 10 11:01:36 2015 -0400
> # Node ID 9fec75539a1e42cee876b481f1e748dafc1f347c
> # Parent  dbe55fd6989b767892e8cc1350f8d0d7197a361c
> contrib: new rules for building a debian package of remotefilelog
>
> To build it, simply do `bash contrib/builddeb`, which will build a
> debian package for the current host system.
>
> diff --git a/contrib/builddeb b/contrib/builddeb
> new file mode 100755
> --- /dev/null
> +++ b/contrib/builddeb
> @@ -0,0 +1,31 @@
> +#!/bin/sh -eu
> +#
> +# Build a remotefilelog debian package from the current repo
> +
> +if [ ! -d .hg ]; then
> +    echo 'You are not at the repository root!' 1>&2
> +    exit 1
> +fi
> +
> +cp -r contrib/debian debian
> +trap "rm -r '$PWD/debian'" EXIT
> +
> +version=$(hg log -r . -T'{latesttag}-{latesttagdistance}-{node|short}')

Was this supposed to be {latesttag}+{..., or is the convention different  
for this?
Augie Fackler - Sept. 14, 2015, 4:40 p.m.
On Thu, Sep 10, 2015 at 7:20 PM, Matt Harbison <mharbison72@gmail.com> wrote:
> On Thu, 10 Sep 2015 11:34:22 -0400, Augie Fackler <raf@durin42.com> wrote:
>
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1441897296 14400
>> #      Thu Sep 10 11:01:36 2015 -0400
>> # Node ID 9fec75539a1e42cee876b481f1e748dafc1f347c
>> # Parent  dbe55fd6989b767892e8cc1350f8d0d7197a361c
>> contrib: new rules for building a debian package of remotefilelog
>>
>> To build it, simply do `bash contrib/builddeb`, which will build a
>> debian package for the current host system.
>>
>> diff --git a/contrib/builddeb b/contrib/builddeb
>> new file mode 100755
>> --- /dev/null
>> +++ b/contrib/builddeb
>> @@ -0,0 +1,31 @@
>> +#!/bin/sh -eu
>> +#
>> +# Build a remotefilelog debian package from the current repo
>> +
>> +if [ ! -d .hg ]; then
>> +    echo 'You are not at the repository root!' 1>&2
>> +    exit 1
>> +fi
>> +
>> +cp -r contrib/debian debian
>> +trap "rm -r '$PWD/debian'" EXIT
>> +
>> +version=$(hg log -r . -T'{latesttag}-{latesttagdistance}-{node|short}')
>
>
> Was this supposed to be {latesttag}+{..., or is the convention different for
> this?


Good catch. Emailed a fix for that and some other tweaks.

Patch

diff --git a/contrib/builddeb b/contrib/builddeb
new file mode 100755
--- /dev/null
+++ b/contrib/builddeb
@@ -0,0 +1,31 @@ 
+#!/bin/sh -eu
+#
+# Build a remotefilelog debian package from the current repo
+
+if [ ! -d .hg ]; then
+    echo 'You are not at the repository root!' 1>&2
+    exit 1
+fi
+
+cp -r contrib/debian debian
+trap "rm -r '$PWD/debian'" EXIT
+
+version=$(hg log -r . -T'{latesttag}-{latesttagdistance}-{node|short}')
+
+control=debian/control
+changelog=debian/changelog
+# This looks like sed -i, but sed -i behaves just differently enough
+# between BSD and GNU sed that I gave up and did the dumb thing.
+sed "s/__VERSION__/$version/" < $changelog > $changelog.tmp
+date=$(date --rfc-2822)
+sed "s/__DATE__/$date/" < $changelog.tmp > $changelog
+rm $changelog.tmp
+
+debuild -us -uc -b || exit 1
+OUTPUTDIR=${OUTPUTDIR:=packages/debian-unknown}
+mkdir -p $OUTPUTDIR
+find ../remotefilelog*.deb ../remotefilelog_*.build \
+      ../remotefilelog_*.changes -type f -newer $control -print0 | \
+  xargs -Inarf -0 mv narf "$OUTPUTDIR"
+echo "Built packages for $version:"
+find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
diff --git a/contrib/debian/changelog b/contrib/debian/changelog
new file mode 100644
--- /dev/null
+++ b/contrib/debian/changelog
@@ -0,0 +1,5 @@ 
+remotefilelog (__VERSION__) unstable; urgency=medium
+
+  * Automated build performed by upstream.
+
+ -- Mercurial Devel <mercurial-devel@selenic.com>  __DATE__
diff --git a/contrib/debian/compat b/contrib/debian/compat
new file mode 100644
--- /dev/null
+++ b/contrib/debian/compat
@@ -0,0 +1,1 @@ 
+9
diff --git a/contrib/debian/control b/contrib/debian/control
new file mode 100644
--- /dev/null
+++ b/contrib/debian/control
@@ -0,0 +1,28 @@ 
+Source: remotefilelog
+Section: vcs
+Priority: optional
+Maintainer: Durham Goode <durham@fb.com>
+Build-Depends:
+ debhelper (>= 7),
+ dh-python,
+ python-all
+Standards-Version: 3.9.4
+X-Python-Version: >= 2.6
+
+Package: remotefilelog
+Depends:
+ python,
+ ${shlibs:Depends},
+ ${misc:Depends},
+ ${python:Depends},
+ mercurial,
+ python-lz4
+Architecture: any
+Description: allows Mercurial to clone shallow copies of a repository and
+ load files on demand.
+ .
+ The remotefilelog extension allows Mercurial to clone shallow copies
+ of a repository such that all file contents are left on the server
+ and only downloaded on demand by the client. This greatly speeds up
+ clone and pull performance for repositories that have long histories
+ or that are growing quickly.
diff --git a/contrib/debian/copyright b/contrib/debian/copyright
new file mode 100644
--- /dev/null
+++ b/contrib/debian/copyright
@@ -0,0 +1,27 @@ 
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: remotefilelog
+Source: https://bitbucket.org/facebook/remotefilelog
+
+Files: *
+Copyright: 2013 Facebook, Inc.
+License: GPL-2+
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later
+ version.
+ .
+ This program is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.  See the GNU General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU General Public
+ License along with this package; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA  02110-1301 USA
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 2 can be found in the file
+ `/usr/share/common-licenses/GPL-2'.
diff --git a/contrib/debian/rules b/contrib/debian/rules
new file mode 100644
--- /dev/null
+++ b/contrib/debian/rules
@@ -0,0 +1,11 @@ 
+#!/usr/bin/make -f
+#
+# uncomment the next line for verbose mode
+#export DH_VERBOSE=1
+
+%:
+	dh $@ --with python2
+
+override_dh_auto_install:
+	python$(PYVERS) setup.py install --root $(CURDIR)/debian/remotefilelog --install-layout=deb
+	find $(CURDIR)/debian/remotefilelog -name '*.egg-info' -delete