Obtaining Source Code

63 views
Skip to first unread message

Abhishek Joshi

unread,
Nov 4, 2012, 11:40:38 AM11/4/12
to cof...@googlegroups.com
Hello All

I am interested in obtaining source code of certain applications in ubuntu. When I use the command "sudo apt-get source application-name", where I write the appropriate application name in the place of 'application-name',  I get a message saying, "You must put some 'source' URIs in your sources.list".
I have searched extensively on the web but could not get even one relevant solution.
Could someone give me a solution to this? Any help in this regard would be highly appreciated!
Thanks in advance.

Abhishek Joshi
SY Comp

Jobin Raju George

unread,
Nov 4, 2012, 12:30:56 PM11/4/12
to CoFSUG
Dear Abhishek,

You are trying to fetch source codes of the application, so do not "sudo" them, just type apt-get source <application_name> where <application_name> is the name of the application whose source code you are trying to obtain. Hope this helps. Reply if you have trouble.



Abhishek Joshi
SY Comp

--
You received this message because you are subscribed to the Google Groups "CoFSUG" group.
To post to this group, send an email to cof...@googlegroups.com.
To unsubscribe from this group, send email to cofsug+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cofsug?hl=en-GB.



--

Thanks and regards,

Jobin Raju George

Third Year, Information Technology

College of Engineering Pune

Alternate e-mail: george...@coep.ac.in


Jobin Raju George

unread,
Nov 4, 2012, 12:45:22 PM11/4/12
to CoFSUG
And yes, sorry to have not mentioned this, just go to Software Center, go to Edit-> Software Sources and tick the label that says "Source code". I am not familiar with Synaptic Packet Manager, so won't be able to tell you how to do this, if that is what you use.

malt...@googlemail.com

unread,
Nov 4, 2012, 1:18:51 PM11/4/12
to CoFSUG
On Sun, 4 Nov 2012, Jobin Raju George wrote:

> And yes, sorry to have not mentioned this, just go to Software Center, go to Edit-> Software Sources and tick the label
> that says "Source code". I am not familiar with Synaptic Packet Manager, so won't be able to tell you how to do this, if
> that is what you use.

The most universal approach would be to edit the file
/etc/apt/sources.list and copy the lines starting with "deb " and then
alter the copies so they start with "deb-src ".

so

"deb http://ftp.de.debian.org/debian/ sid main non-free contrib"

would become

"deb http://ftp.de.debian.org/debian/ sid main non-free contrib
deb-src http://ftp.de.debian.org/debian/ sid main non-free contrib".


Much success to you.


Malte

shirish शिरीष

unread,
Nov 4, 2012, 1:44:13 PM11/4/12
to cof...@googlegroups.com
at bottom :-

On Sun, Nov 4, 2012 at 11:48 PM, <malt...@googlemail.com> wrote:
> On Sun, 4 Nov 2012, Jobin Raju George wrote:
>
>> And yes, sorry to have not mentioned this, just go to Software Center, go
>> to Edit-> Software Sources and tick the label
>> that says "Source code". I am not familiar with Synaptic Packet Manager,
>> so won't be able to tell you how to do this, if
>> that is what you use.
>
>
> The most universal approach would be to edit the file /etc/apt/sources.list
> and copy the lines starting with "deb " and then alter the copies so they
> start with "deb-src ".
>
> so
>
> "deb http://ftp.de.debian.org/debian/ sid main non-free contrib"
>
> would become
>
> "deb http://ftp.de.debian.org/debian/ sid main non-free contrib
> deb-src http://ftp.de.debian.org/debian/ sid main non-free contrib".
>
>
> Much success to you.

While malte is right, I guess it would be ubuntu, what s/he has
written is relevant only if it's debian. Sometimes ubuntu may have
some patched app. or vice-versa so it's important to use the sources
from the distribution you are using. The Debian sources that s/he has
given may not be right for you, although if you just want to see the
sources and not actually build them locally then it may be fine.

Just my 2 paise.

> Malte

<snipped>
--
Regards,
Shirish Agarwal शिरीष अग्रवाल
My quotes in this email licensed under CC 3.0
http://creativecommons.org/licenses/by-nc/3.0/
http://flossexperiences.wordpress.com
065C 6D79 A68C E7EA 52B3 8D70 950D 53FB 729A 8B17

shirish शिरीष

unread,
Nov 4, 2012, 2:05:23 PM11/4/12
to cof...@googlegroups.com
Hi all,
This page does give some info. about the ubuntu repo's as well as how
to do it (similar to Malte's approach)
https://help.ubuntu.com/community/Repositories/Ubuntu

but is silent mostly about the source code part. I am sorry I dunno
how they do things today (as I'm more now into Debian.)

I do remember vaguely doing something like

$ sudo apt-get build-dep application-name

The first one will download and build all the dependencies which are
needed for the app. to build. (Build dependencies are/maybe different
from apps. needed while running. Usually they used to include the run
dependencies + some which are needed only while building.)

$ sudo apt-get source application-name

It would get the source-code

and then finally do ./configure, make and make install or whatever the
compilation way it was.

This was few years ago, so dunno if the same process or has changed or
not. Not a ubuntu user anymore.

malt...@googlemail.com

unread,
Nov 4, 2012, 2:29:40 PM11/4/12
to cof...@googlegroups.com

>> The most universal approach would be to edit the file /etc/apt/sources.list
>> and copy the lines starting with "deb " and then alter the copies so they
>> start with "deb-src ".
>>
>> so
>>
>> "deb http://ftp.de.debian.org/debian/ sid main non-free contrib"
>>
>> would become
>>
>> "deb http://ftp.de.debian.org/debian/ sid main non-free contrib
>> deb-src http://ftp.de.debian.org/debian/ sid main non-free contrib".
>>
>>
>> Much success to you.
>
> While malte is right, I guess it would be ubuntu, what s/he has
> written is relevant only if it's debian. Sometimes ubuntu may have
> some patched app. or vice-versa so it's important to use the sources
> from the distribution you are using. The Debian sources that s/he has
> given may not be right for you, although if you just want to see the
> sources and not actually build them locally then it may be fine.

My explanation works for all Debian and derivatives, that is, Ubuntu,
too. Of course, the text after "deb "/"dev-src " varies from
distribution to distribution (that was not the point of the example).

Abhishek Joshi

unread,
Nov 5, 2012, 12:02:33 AM11/5/12
to cof...@googlegroups.com
Hello all

Thanks a lot for the advice. I selected the 'source code' option in the settings of software center, as Jobin said. Then I checked the sources.list file and it already had the lines starting with "deb-src"! So all I did was reload the synaptic package manager and then typed the command "sudo apt-get source mc". It worked!

Thanks once again!

Abhishek Joshi

--
You received this message because you are subscribed to the Google Groups "CoFSUG" group.
To post to this group, send an email to cof...@googlegroups.com.
To unsubscribe from this group, send email to cofsug+unsubscribe@googlegroups.com.

Jobin Raju George

unread,
Nov 5, 2012, 12:10:24 AM11/5/12
to CoFSUG
Dear Abhishek,

Its good that it worked for you, but I fear whether "sudo" is needed, you would probably like to have it in you "/home" folder, right? See whether you really need to add "sudo" for just getting the source code.


To unsubscribe from this group, send email to cofsug+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/cofsug?hl=en-GB.

Abhishek Joshi

unread,
Nov 6, 2012, 10:16:07 AM11/6/12
to cof...@googlegroups.com
Dear Jobin, 

You were right. When I used sudo, the tar files get downloaded in /etc/apt, and I somehow cannot delete these files. I have copied them to another location and then extracted the code, but I still cannot delete the original tar files (must be some problem with the permissions). Without sudo the files appear in home folder and I can delete them!

Thanks a lot! :)
 
Do you have any idea as to how I could delete the original files? It would be nice to have a clean /etc/apt folder :)

shirish शिरीष

unread,
Nov 6, 2012, 10:38:37 AM11/6/12
to cof...@googlegroups.com
at bottom :-

On Tue, Nov 6, 2012 at 8:46 PM, Abhishek Joshi
<abhishe...@gmail.com> wrote:
> Dear Jobin,
>
> You were right. When I used sudo, the tar files get downloaded in /etc/apt,
> and I somehow cannot delete these files. I have copied them to another
> location and then extracted the code, but I still cannot delete the original
> tar files (must be some problem with the permissions). Without sudo the
> files appear in home folder and I can delete them!
>
> Thanks a lot! :)
>
> Do you have any idea as to how I could delete the original files? It would
> be nice to have a clean /etc/apt folder :)

$ sudo su
# cd /etc/apt
# rm -rf folder-name or list of files.

Does that do it or no ?

Abhishek Joshi

unread,
Nov 6, 2012, 12:28:02 PM11/6/12
to cof...@googlegroups.com
Dear Shrish

It worked! I was able to delete the folders! Thanks a lot! But, how do I revert back to being the user 'abhishek' instead of root?


Abhishek Joshi

unread,
Nov 6, 2012, 12:35:39 PM11/6/12
to cof...@googlegroups.com
Dear Shirish

I got it...exit did the trick! Thanks once again!

Praveen A

unread,
Nov 6, 2012, 12:43:25 PM11/6/12
to cof...@googlegroups.com

When prefix sudo to any command that is run as root user. So use sudo only when you know you need it. You were not able to delete those files without sudo because those files were created as root and hence owned by root. sudo su will give you a root shell, ie, every command you after sudo su will be run as root user.

On Nov 6, 2012 8:46 PM, "Abhishek Joshi" <abhishe...@gmail.com> wrote:

Dear Jobin, 

You were right. When I used sudo, the tar files get downloaded in /etc/apt, and I somehow cannot delete these files. I have copied them to another location and then extracted the code, but I still cannot delete the original tar files (must be some problem with the permissions). Without sudo the files appear in home folder and I can delete them!

Thanks a lot! :)
 
Do you have any idea as to how I could delete the original files? It would be nice to have a clean /etc/apt folder :)

On Mon, Nov 5, 2012 at 10:40 AM, Jobin Raju George <jobi...@gmail.com> wrote: > > Dear Abhishek, ...

Abhishek Joshi

unread,
Nov 6, 2012, 12:54:46 PM11/6/12
to cof...@googlegroups.com
Dear Praveen

Thanks for the information!

Regards
Abhishek

--
Reply all
Reply to author
Forward
0 new messages