You are not logged in.

#1 2014-07-19 07:05:12

parchedas
Member
From: Cambridge, UK
Registered: 2013-06-01
Posts: 74

[SOLVED] How do you do development with a git package?

Forgive me if I get any of this wrong as I am a bit of a git newbie, but how do you do development with git package? I've done some searching but haven't really been able to find any info.
Reading through makepkg it basically does this for git:

download

if name empty
    git clone --mirror url name
else
    cd name && git fetch --all

extract

cd src
rm name
git clone ../name

set ref for branch/commit/tag

git checkout -b makepkg ref

So it appears to me,
because it mirrors you cant use it for making changes because there is no working tree (is that what it's called?) and you can't use the clone in src because it just gets overwritten,
that the makepkg git is not designed for doing your own development but just for keeping a package up to date with git. Or have I missed something?

At the moment I edit the PKGBUILD to remove the source and then manually git clone in $srcdir but I feel there must be a more elegant way, is there?


I would've thought that just using ordinary git clone /git pull would be fine. No?
If the goal of the git packages is just to keep up to date wouldn't it be better to just to git clone --depth=1 or git archive directly from the remote? I found some stuff about this bug tracker and mailing lists but there didn't seem to be any solid conclusion.

Last edited by parchedas (2014-07-20 01:38:01)

Offline

#2 2014-07-19 07:07:27

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] How do you do development with a git package?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-07-19 07:14:21

parchedas
Member
From: Cambridge, UK
Registered: 2013-06-01
Posts: 74

Re: [SOLVED] How do you do development with a git package?

What in particular? I know how to write a PKGBUILD using git just for installation, I'm asking how to do it so that I can work on the repo too, push upstream etc.

Offline

#4 2014-07-19 07:18:08

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] How do you do development with a git package?

Well, makepkg is for installation... What exactly are you trying to achieve?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2014-07-19 07:24:55

parchedas
Member
From: Cambridge, UK
Registered: 2013-06-01
Posts: 74

Re: [SOLVED] How do you do development with a git package?

jasonwryan wrote:

Well, makepkg is for installation... What exactly are you trying to achieve?

I was under the impression that it wasn't and that's why it fetches the whole repo. I have a git project that I am starting to contribute to and I want to be able to make a package and install it from a repo that I can work on too.

Offline

#6 2014-07-19 11:48:54

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: [SOLVED] How do you do development with a git package?

You need to clone the repo you wanna work on, and make your changes/branches/etc there outside of any makepkg considerations. If you want to be able to make a package from that repo, you can use your PKGBUILD and simply use a file:// URL as source, something like:

source=("git+file:///path/to/repo/.git")

makepkg will create its own clone of the repo to be able to build, but you shouldn't do any work on that repo and have your own somewhere else.

Offline

#7 2014-07-19 11:58:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] How do you do development with a git package?

parchedas wrote:

... the makepkg git is not designed for doing your own development but just for keeping a package up to date with git. Or have I missed something?

Correct.  You have missed nothing.

Makepkg is for making packages.  PKGBUILDs are instructions for building packages.

I'm not sure what gave you other ideas.  One *could* do some odd contortions to make modifications and push them from a repo checked out via makepkg.  But I certainly never would.  That is not the intent, and it will never make a productive work flow.

If you want to work on a project, simply `git clone <url>` it somewhere else.  In my case I have a build directory with PKGBUILDs and assorted stuff, then I also have a ~/code directory with a subdirectory for each project I work on.  New project: `cd ~/code && git clone <project-url>`.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2014-07-19 13:11:35

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,655

Re: [SOLVED] How do you do development with a git package?

Do the clone manually in $SRCDIR. makepkg will use a normal clone just fine.

Offline

#9 2014-07-20 01:36:48

parchedas
Member
From: Cambridge, UK
Registered: 2013-06-01
Posts: 74

Re: [SOLVED] How do you do development with a git package?

Thanks guys, all useful answers. I think Scimmia's answer is the one I'm looking for (although I assume you mean $SRCDEST not $SRCDIR)

Side note: I was wondering why makepkg does a full clone rather than just a shallow clone and as far as I can tell it is so that you can git describe in pkgver(). I wonder though, if the fragment is a tag, and presumably you don't need git describe, if it would be better if makepkg did a shallow clone. This would be useful for projects that don't distribute source but only tag stable releases with git, although maybe these are few and far between, I only know of one.

Offline

#10 2014-07-20 08:18:40

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,655

Re: [SOLVED] How do you do development with a git package?

Yep, I meant $SRCDEST, was just typing from memory and got it wrong.

Offline

Board footer

Powered by FluxBB