You are not logged in.

#1 2017-05-29 12:35:49

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

How to download the source code of a package?

Hi, all!
I want to understand how to download source code from the arch repositories. Like `apt-get source <package>`.
I know about yaourt, pacman, etc. but I was required to manually change some code lines of a package and rebuild it.

So, the first thing I did is:

sudo pacman -S abs
error: target not found: abs

To my surprise, there is no such a package. As I understand abs was suppressed over using svn instead. Arch wiki suggest the following instructions:

svn checkout --depth=empty svn://svn.archlinux.org/packages
cd packages
svn update <package>

It seems like it works but on the requested openvpn package - I didn't find anything useful:

svn checkout --depth=empty svn://svn.archlinux.org/packages
cd packages
svn update openvpn
Updating 'openvpn':
A    openvpn
A    openvpn/repos
A    openvpn/repos/core-i686
A    openvpn/repos/core-i686/0004-openssl-1-1-0.patch
A    openvpn/repos/core-i686/PKGBUILD
A    openvpn/repos/core-i686/openvpn.install
A    openvpn/repos/core-x86_64
A    openvpn/repos/core-x86_64/0004-openssl-1-1-0.patch
A    openvpn/repos/core-x86_64/PKGBUILD
A    openvpn/repos/core-x86_64/openvpn.install
A    openvpn/trunk
A    openvpn/trunk/PKGBUILD
A    openvpn/trunk/0004-openssl-1-1-0.patch
A    openvpn/trunk/openvpn.install

So how to do things the right way in order to download_souce-build-install a package in the Arch environment?
I do not use svn on my day-to-day basis, so if there are any options to use git instead - please, give the instructions how to use it!

Last edited by timfayz (2017-05-29 12:36:44)

Offline

#2 2017-05-29 12:43:08

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: How to download the source code of a package?

You can use the web interface, e.g. https://git.archlinux.org/svntogit/pack … ges/pacman

There are also tools that you can use such as pbget. There should be others on the wiki.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2017-05-29 12:46:07

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: How to download the source code of a package?

You need to look in the source array in the PKGBUILD file.

https://wiki.archlinux.org/index.php/PKGBUILD#Sources


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2017-05-29 12:53:59

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

Re: How to download the source code of a package?

slithery, I think the OP is a step behind that.  Once one has the PKGBUILD it's as simple as `makepkg -o`.  But the reference to ABS an SVN show that the OP is still trying to get the PKGBUILD (and associated build files).

timfayz, abs was the right answer for this until quite recently.  I'm not familiar with the above-mentioned pbget, but asp is (also) a good substitute for abs.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2017-05-29 18:48:47

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: How to download the source code of a package?

asp is not just a substitute for abs, it is the official replacement. smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2017-05-30 05:58:36

HiImTye
Member
From: Halifax, NS, Canada
Registered: 2012-05-09
Posts: 1,072

Re: How to download the source code of a package?

Eschwartz wrote:

asp is not just a substitute for abs, it is the official replacement. smile

I'm glad I checked here, I haven't checked the news site for a while, and would be confused about the abs if I needed it haha

Offline

#7 2017-05-30 06:08:51

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

Re: How to download the source code of a package?

Eschwartz wrote:

asp is not just a substitute for abs, it is the official replacement. smile

Complete with appropriate commit message....


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2017-05-30 07:25:20

timfayz
Member
From: Kazan, Russia
Registered: 2016-01-14
Posts: 59
Website

Re: How to download the source code of a package?

Thank you for the explanation regarding abs and asp. It's much clearer now.
However, I didn't get the idea how to use this staff to build "pacman-compatible" package from the source. After a long searching, I've ended up with getting sources from github (https://github.com/OpenVPN/openvpn) and build it according to docs. But the question is how can I, later on, do somethings like this:

tar -zxf openvpn.tar.gz
cd openvpn
./configure
make
#skipping make install
cd ../ && tar -cf openvpn.tar
pacman -U openvpn.tar

So the point is I want to install it like an ordinary package to be able to remove it later using pacman.

Last edited by timfayz (2017-05-30 07:48:48)

Offline

#9 2017-05-30 07:33:38

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: How to download the source code of a package?

Not sure why you want this but... use makepkg once you get the PKGBUILD and related files.  Just add an exit command after the make setup and manually tar up the srcdir.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#10 2017-05-30 07:57:11

smirky
Member
From: Bulgaria
Registered: 2013-02-23
Posts: 277
Website

Re: How to download the source code of a package?

I might get killed for this, but usually I do:

$ yaourt -G <package>
$ cd <package>
$ makepkg -sr --nobuild

Last edited by smirky (2017-05-30 07:57:26)


Personal spot  ::  https://www.smirky.net/  ::  Try not to get lost!

Offline

#11 2017-05-30 08:07:11

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: How to download the source code of a package?

smirky wrote:

I might get killed for this [...]

Nah, we'll just throw you in a lake. With some weights.

$ yaourt -G <package>

How is this better than `git clone https://aur.archlinux.org/<package>`? It uses an unsupported tool, and last time I checked, it didn't bring the history with it.

--edit-- I just realised that the `git clone` approach was never posted in this thread. I apologise. I must've confused it with another, similar, active thread.

--edit2-- And I also just realised that this is about official packages, too, so:

git clone https://git.archlinux.org/svntogit/packages.git --single-branch -b packages/{pkgbase}    # for core/extra
git clone https://git.archlinux.org/svntogit/community.git --single-branch -b packages/{pkgbase}   # for community

Scripting this is recommened. And I note to myself: should always get some coffeine before posting here in the morning. I apologise.

Last edited by ayekat (2017-05-30 08:18:47)


pkgshackscfgblag

Offline

#12 2017-05-30 08:14:26

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: How to download the source code of a package?

timfayz wrote:

Thank you for the explanation regarding abs and asp. It's much clearer now.
However, I didn't get the idea how to use this staff to build "pacman-compatible" package from the source. After a long searching, I've ended up with getting sources from github (https://github.com/OpenVPN/openvpn) and build it according to docs. But the question is how can I, later on, do somethings like this:

tar -zxf openvpn.tar.gz
cd openvpn
./configure
make
#skipping make install
cd ../ && tar -cf openvpn.tar
pacman -U openvpn.tar

So the point is I want to install it like an ordinary package to be able to remove it later using pacman.

You need to use a PKGBUILD and makepkg. The PKGBUILD contains the build instructions and necessary metadata. It's really just a Bash script that runs the build commands (e.g. configure, make) and installs the files to a local directory along with some metadata. The resulting package is just an archive of that directory, but it's not the same as archiving the output of "make" yourself, as in your example above.

Basically, whatever commands you need to build the package on the command-line go in the PKGBUILD, which is just a Bash script with a fixed format. If you want to create a custom package, edit the PKGBUILD and add the commands that you would run on the command-line. Makepkg will then download the source files, modify them according to your commands, and build the package.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#13 2017-05-30 09:40:18

HiImTye
Member
From: Halifax, NS, Canada
Registered: 2012-05-09
Posts: 1,072

Re: How to download the source code of a package?

I just test built (test got?) a package (nvidia), and I found asp to be a lot more intuitive, and it also was a giant help to tell the user where the packages were located, rather than hunting them down after downloading them like with the abs

it was as simple as

asp checkout nvidia

where with the abs, you had to specify the target repo, i.e. core/pacman, so you'd have to pacman -Ss first to figure out the repo (or download the entire abs snapshot which is bandwidth/space/time consuming). by far my favourite feature of asp, however, is that it tells you the download location.

Last edited by HiImTye (2017-05-31 22:50:15)

Offline

#14 2017-05-30 15:50:33

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: How to download the source code of a package?

ayekat wrote:
smirky wrote:

I might get killed for this [...]

Nah, we'll just throw you in a lake. With some weights.

$ yaourt -G <package>

How is this better than `git clone https://aur.archlinux.org/<package>`? It uses an unsupported tool, and last time I checked, it didn't bring the history with it.

--edit-- I just realised that the `git clone` approach was never posted in this thread. I apologise. I must've confused it with another, similar, active thread.

--edit2-- And I also just realised that this is about official packages, too, so:

git clone https://git.archlinux.org/svntogit/packages.git --single-branch -b packages/{pkgbase}    # for core/extra
git clone https://git.archlinux.org/svntogit/community.git --single-branch -b packages/{pkgbase}   # for community

Scripting this is recommened. And I note to myself: should always get some coffeine before posting here in the morning. I apologise.

And the final step is to realize that someone else has already written a script to do that. And it's called asp and you can get it from [extra].

It even includes some extras like resolving pkgname ==> pkgbase via the Arch website, for split package support.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#15 2017-05-30 15:56:10

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: How to download the source code of a package?

smirky wrote:

I might get killed for this, but usually I do:

$ yaourt -G <package>
$ cd <package>
$ makepkg -sr --nobuild

Except... yaourt uses (used) abs, which means this no longer works and is removed in unreleased -git versions of yaourt.
There is, however, an undocumented yaourtrc config variable to make it download the snapshots from the svntogit repository, which said unreleased -git version of yaourt now unilaterally switches to.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#16 2017-05-30 15:59:20

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: How to download the source code of a package?

Eschwartz wrote:

And the final step is to realize that someone else has already written a script to do that.

Yes, there was quite a lack of brain my post.
OTOH, as a response to that suggestion to use an AUR helper, showing that there is no magic behind the process of obtaining a PKGBUILD seems still valid to me smile


pkgshackscfgblag

Offline

#17 2017-05-30 17:01:20

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: How to download the source code of a package?

Eschwartz wrote:

And the final step is to realize that someone else has already written a script to do that. And it's called asp and you can get it from [extra].

It even includes some extras like resolving pkgname ==> pkgbase via the Arch website, for split package support.

And if you want that plus support for AUR packages, there's pbget which was posted above wink


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#18 2017-10-29 11:09:34

CyrIng
Member
From: France
Registered: 2010-07-17
Posts: 106
Website

Re: How to download the source code of a package?

smirky wrote:

I might get killed for this, but usually I do:

$ yaourt -G <package>
$ cd <package>
$ makepkg -sr --nobuild

Thanks, best of all solutions

Offline

#19 2017-10-29 12:20:46

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,842
Website

Re: How to download the source code of a package?

Please don't empty post.

https://wiki.archlinux.org/index.php/Co … mpty_posts

As this is a five month old topic, and OP seems to have abandoned it, I'm going to go ahead and close it now.

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB