Building a package straight from a git repo -- walk though based on luke's getting starrted guide.

David Farning dfarning at gmail.com
Tue Jul 6 01:34:11 BST 2010


Packaging read via git.

After a bit more help and some goggling I packaged read without a
tarball this afternoon.  So couple notes

mkdir sugar-read-activity-87
cd sugar-read-activity-87

note:  The directory name must match the package name.

git init

note: we just need to initialize the local repo

tar xf ../initial_debianization.tar.gz

note: I keep a copy of initial_debianization.tar.gz in my home dir.

--edit the contents of debian as needed. see
http://wiki.debian.org/Sugar/GettingStartedGuide
--append the follow snippet to the end of debian/rules

----
# Rules for fetching the upstream tarball
# Define the git repo and package name.
UPSTREAM_GIT=git://example.com/your-git-repo-here
# TODO: Automatically figure this out from the package name
PACKAGE_NAME=sugar-SOMETHING-activity

# NB: Don't touch this unless it's broken.
CURRENT_TREEISH =$(shell dpkg-parsechangelog | sed -rne 's,^Version:
.*git.{9}([^-]+).*,\1,p')
CURVER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')

SOURCE_DIR=$(PACKAGE_NAME)-$(CURVER)
TARBALL=$(PACKAGE_NAME)_$(CURVER).orig.tar.gz


$(SOURCE_DIR):
        git clone $(UPSTREAM_GIT) $(SOURCE_DIR)
        if [ x$(CURRENT_TREEISH) = x ]; then \
        cd $(SOURCE_DIR) && git checkout v$(CURVER); \
        else \
        cd $(SOURCE_DIR) && git checkout $(CURRENT_TREEISH); \
        fi


$(TARBALL): $(SOURCE_DIR)
        tar czvf $(TARBALL) $(SOURCE_DIR)

get-orig-source: $(TARBALL)
        rm -rf $(SOURCE_DIR) $(SOURCE_DIR).temp

clean::
       find -name *.mo -delete
       find -name *.linfo -delete
----

--edit the package_name and upstream_git variables

note: this will allow us to grab a tarball of the upstream git repo
with a single command.

fakeroot debian/rules get-orig-source

note: this will create the necessary tarball.

git-import-orig --pristine-tar -u ''87'' sugar-read-activity_87.orig.tar.gz

note: this will import the tarball in the git repo.

DEB_MAINTAINER_MODE=1 fakeroot debian/rules clean

note: this will regenerate control from control.in

git add debian/
debcommit -m'initial commit'

note: make initial git commit

git-buildpackage --git-ignore-new

note: build the package.



More information about the Ubuntu-sugarteam mailing list