How to download source code with Pacman on Arch Linux? [closed] - archlinux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am using Arch Linux. I want to do the same thing like apt-get source coreutils; is it possible to download sources with Pacman? I didn't find a solution in the man pages.
How can I get the source code of a package?

pacman -S asp
say if you want the source code of the Linux command find
find out which package the command find belongs to:
pacman -Qo $(which find). The result is
"/usr/bin/find is owned by findutils 4.4.2-3".
asp export findutils
cd findutils
makepkg -o
Now you have your source code.

2018 Update:
The abs tool described below has been deprecated and it along with its rsync endpoint have been dropped since mid 2017.
The asp tool now provides similar functionality. More information here.
As already mentioned you can use the ABS (Arch Build System):
Install it using pacman:
sudo pacman -S base-devel abs
First, download the ABS tree:
sudo abs
Then, get a specific package:
sudo abs [package_name]
Then copy the package, whose source you want to have, from the local abs tree (e.g. /var/abs/core/findutils) to another directory, e.g. /home/blabla/abs
Then run makepkg:
if you only want to get the sources and don't want to build the package you can run makepkg -od
otherwise run makepkg -s, which will then handle all the package's dependencies automatically
watch out becaouse makepkg will overwrite your modifications, use makepkg -e to build your local sources instead
If you want to install the package you've built, run
pacman -U name-of-package.xz

Edit: This answer is outdated due to changes on ABS.
You get the package sources from the Arch Linux SVN repository, called ABS.
First find the package online:
http://www.archlinux.org/packages/?q=coreutils
Then, on the package details page, on the right side use the SVN links, e.g.:
http://repos.archlinux.org/wsvn/packages/coreutils/trunk/
And there, you have a sweet "Download" button, in this case it leads to:
http://repos.archlinux.org/wsvn/packages/coreutils/trunk/?op=dl&isdir=1
It is a little bit more complicated than apt-get source. But perhaps you find a tool on AUR that does the job for you, for example yaourt supports building from sources and exporting them.

Related

How to install apache 2.4.46 from Source on Ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
How can I install Apache 2.4.46 in Ubuntu from source, because I want to have the pure package, without tweaks.
The apache2 installed from apt might be more secure, but this is my intention.
Please note that you should always install the latest version of a software for more security. I suggest you to install Apache from Ubuntu's apt package manager 'if you are on a production server'. Installing it from source on a local environment doesn't matter. This tutorial is for Ubuntu/Debian based systems.
Please follow this for the instructions of installing it, by me, with a bit more explanation. Go to the terminal, and enter the following commands one by one and hit enter for no confusion:
Install some required libraries:
sudo apt install libnghttp2 libpcre3 libssl build-essential -y
Navigate to the directory from which we will be compiling apache.
cd /usr/local/src
In your browser, go to http://httpd.apache.org/download.cgi.
Right click and copy the link location of the link looking like Source: httpd-2.4.46.tar.gz
sudo wget -O- <download-link> | tar -zxf -
Also go to http://apr.apache.org/download.cgi and copy the link location for Unix Source: apr-1.7.0.tar.gz
sudo wget -O- <apr-download-link> | tar -zxf -
Go to http://apr.apache.org/download.cgi and copy the link location for Unix Source: apr-util-1.6.1.tar.gz
sudo wget -O- <apr-util-download-link> | tar -zxf -
Move the downloaded and extracted apr files to the right location:
sudo mv apr- httpd-/srclib/apr
Move the downloaded and extracted apr-util files to the right location:
sudo mv apr-util- httpd-/srclib/apr-util
Navigate into the httpd directory:
cd httpd-
According to me, this configuration is better than any other. The --prefix is where apache is installed.
sudo ./configure --prefix=/usr/local/apache2 --enable-mods-shared="reallyall" --enable-mpms-shared="all"
Compile the sources:
sudo make
Install the compiled application to your system:
sudo make install
These directories could be altered using different arguments in step 9. (the sudo ./configure command)
The apache directory is /usr/local/apache2.
The apache conf directory is /usr/local/apache2/conf.
The apache main conf file is /usr/local/apache2/conf/httpd.conf.
For more info go to http://httpd.apache.org/docs/current/install.html.

How do I get the man command?

I just installed Windows Subsystem for Linux for the first time and downloaded the Debian distribution from the Windows Store.
The first thing I tried to do was use the "mv" command. The second thing was to run "man mv" because I don't remember how to use it. But I received the error:
-bash: man: command not found
It looks like the package I want is called manpages. But I can't install that:
sudo apt-get install manpages
[sudo] password for pi:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package manpages is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package 'manpages' has no installation candidate
How do I get the man command up and running?
apt update to update the local package lists followed by apt install man-db to install the actual package.
I want to add to elken's answer that apparently, the 'man-db' packages doesn't cover all the manpages. For example, I needed documentation for the C stdio library (fopen, fgets, ...), and for that I had to install 'manpages-dev':
sudo apt install manpages-dev
Apparently there are also some other manpage collections (/different names for them on certain unix distros), see https://superuser.com/questions/40609/how-to-install-man-pages-for-c-standard-library-functions-in-ubuntu

Control yum update packages sequence

Couldn't find an answer anywhere so I will try here.
Is there a way to tell yum, while running yum update, to update a specific package as the last one?
I am not talking about requires / dependencies, It just needs to be updated after all other packages on the system.
In a nutshell, I manage local repositories in my environment and this particular rpm holds the version for each repository, so by updating it as last I can label the client with that particular version.
You can run two yum commands. First one excluding the .rpm that you don't want to be updated and second, running your usual update.
$ yum --exclude="foo*.rpm" update
If foo*.rpm comes from a particular repository, then during the update, you can disable it using its name. Name of a repository can be found by looking into /etc/yum.repos.d/*.repo file or using the command
$ yum repolist
Then disable the repo and update. Note, this will disable update of all packages coming from this repo.
$ yum --disablerepo="nameOfRepo" update
Finally, run your usual update
$ yum update

How to provide standard library sources for IntelliJ IDEA's Rust project?

I am using Mac for development. I installed Rust 1.13.0 using brew install rust and the Rust plugin 0.1.0.1385 for IntelliJ IDEA. I created my first test project with cargo and while opening it with IDEA I got the message
No standard library sources found, some code insight will not work
I haven't found any sources installed, nor the Rust sources package in Homebrew.
How do I provide sources for the project and what are the practical implication if I ignore this step?
As commented, the supported approach is to use rustup:
Navigate to https://rustup.rs/ and follow the installation instructions for your platform.
Add the rust-src component by running: rustup component add rust-src
Create a new Rust project in IntelliJ and choose your existing Rust project source. If the folder already contains previous IntelliJ project files, you may have to delete those first before it will let you proceed.
IntelliJ-Rust should automatically configure the standard library sources to point to the sources downloaded by rustup.
As a reference, since the question title is broad, for Fedora 28 I had to:
dnf install cargo rust-src
sudo ln -s /usr/lib/rustlib/src /usr/lib/rustlib/x86_64-unknown-linux-gnu/
then give /usr/lib/rustlib/x86_64-unknown-linux-gnu/src/rust/src as "Standard library"
Full setup:
Issue opened to simplify the process
When not using the rustup installer, one can install the source package and direct the rust plugin to use those:
(Tested with CLion 2020.2.1, rust-1.46.0-x86_64-pc-windows-gnu.msi, rustc-1.46.0-src.tar.gz. Offline Rust installers and source archive from there: https://forge.rust-lang.org/infra/other-installation-methods.html )
Although the preferred way of installing Rust is by using rustup, as pointed out by the other posts, it is not uncommon to use the packages that your distro makes available.
I use, for example, the packages provided by Gentoo and I share the same problem about the not prefilled field for standard libraries.
Nevertheless, you can easily find out where your standard libraries have been installed by typing the following find command:
find /usr/lib* -type d -name "rust" | grep src
or the following if you installed rust in your home
find -type d -name "rust" | grep src
The previous commands will help, unless, of course, in your distro there is a package for the binaries and one for the source and you only installed the binary one.
I know the question is for MacOS but this answer is shown up when searching for it on Linux. Below I will answer for Ubuntu.
The path is /usr/lib/rustlib/src/rust/src for Ubuntu 20.04
The way I did is:
Installed rustc from the repositories, which includes cargo
sudo apt install rustc
Then installed rust source package
sudo apt install rust-src
I used apt-file (can be installed with sudo apt install apt-file) to search for the install path of the sources
sudo apt-file update
apt-file list rust-src
This show the path as /usr/src/rustc-1.41.0/src .
But a ls -la in /usr/lib/rustlib/ will reveal symlinks and /usr/lib/rustlib/src/rust/src points to the previous found directory.
Using the symlink on IntelliJ will survive new rust versions.
For Fedora 32 install Rust using command:
dnf install cargo rust-src
and the path to standard libary source is:
/usr/lib/rustlib/src/rust
I used Ubuntu. I follow these steps:
sudo apt install rust-src
wait for the install, then
dpkg -L rust-src
copy the last line. For me it is the standard library path:
/usr/lib/rustlib/src/rust
For MacOS, you need to put /opt/homebrew/bin/.

yum install, select and link a specific version of a software

Suppose I want to install python2.7 with yum, and do
sudo yum install python27
This will install a python2.7 in the /usr/bin directory. However, the symbolic link /usr/bin/python still points to python2.6.
Is there a yum command that can manage this symbolic link rather than doing it manually? I know the port select in MacPorts does so, and am looking for a counterpart in yum. Thanks a lot!
Unless the distribution has been set up to handle this sort of thing (the way debian and some others are) you do not want to be changing the default value of something like /usr/bin/python because you will break anything the distribution packages which depends on the default python being the version of python in the default python package.
Things built against the python27 package almost certainly use /usr/bin/python2.7 when they need to run python scripts and/or on their shebang lines. Things packaged by the default system almost certainly just use /usr/bin/python assuming that is the default system python version.