You are not logged in.

#1 2018-01-02 20:15:40

loqs
Member
Registered: 2014-03-06
Posts: 17,373

makepkg -C behavior

A blank PKGBUILD that places nothing in $srcdir

pkgname=testclean
pkgver=1
pkgrel=1
pkgdesc="fake package to test pacman -C"
arch=(any)
url=""
license=('GPL')

source=()
noextract=()
md5sums=()
validpgpkeys=()

prepare() {
    true
}

build() {
    true
}

package() {
    true
}
$ makepkg
==> Making package: testclean 1-1 (Tue  2 Jan 19:54:25 GMT 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
==> Extracting sources...
==> Starting prepare()...
==> Starting build()...
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issue...
==> Creating package "testclean"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: testclean 1-1 (Tue  2 Jan 19:54:25 GMT 2018)

Which builds fine as expected

$ touch src/.1 src/.2 src/.3 src/.4
$ makepkg -fC
==> Making package: testclean 1-1 (Tue  2 Jan 19:55:08 GMT 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
==> Removing existing $srcdir/ directory...
==> Extracting sources...
==> Starting prepare()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
==> Entering fakeroot environment...
==> Starting package()...
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issue...
==> Creating package "testclean"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: testclean 1-1 (Tue  2 Jan 19:55:09 GMT 2018)
$ ls -la src/
total 8
drwxr-xr-x 2 testuser testuser 4096 Jan  2 19:55 .
drwxr-xr-x 4 testuser testuser 4096 Jan  2 19:55 ..
-rw-r--r-- 1 testuser testuser    0 Jan  2 19:55 .1
-rw-r--r-- 1 testuser testuser    0 Jan  2 19:55 .2
-rw-r--r-- 1 testuser testuser    0 Jan  2 19:55 .3
-rw-r--r-- 1 testuser testuser    0 Jan  2 19:55 .4

This appears to show makepkg stating

==> Removing existing $srcdir/ directory...

but the . files remaining in the directory which would indicate the directory was not actually removed but cleaned of none . entries.
Is this intended behavior?  I stumbled across this with a modified broadcom-wl,  the package that was caching data in .files causing it to fail to build in an apparently clean $srcdir
because it had cached an old version of the include paths which with a gcc upgrade had changed from /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include to /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/include

Looking at pacman's source https://git.archlinux.org/pacman.git/tr … .0.2#n2224 should

			rm -rf "$srcdir"/*

not be

			rm -rf "$srcdir"

Offline

#2 2018-01-02 20:18:22

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

Re: makepkg -C behavior

An interesting thought, though I would ask, in what sane world are people using dotfiles as package sources. tongue

The issue is that prior to this we had created "$srcdir" and made it our current working directory.

Last edited by eschwartz (2018-01-02 20:21:03)


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

Offline

#3 2018-01-02 20:47:17

loqs
Member
Registered: 2014-03-06
Posts: 17,373

Re: makepkg -C behavior

If it is not possible to actually rm -rf $srcdir to change the message from "Removing existing $srcdir/ directory..." to "Cleaning existing $srcdir/ directory..." and put a note in the manpage about what cleaning actually does.
In the broadcom-wl case the files seem to be being used as caches created by the kernel build system now if it was not actually building in $srcdir but $srcdir/$packagedir-$version this would not be an issue.
Per directory where a module is built seems to generate (.cache.mk is new for 4.15)

drwxr-xr-x 2 testuser testuser    4096 Jan  2 20:40 .tmp_versions
-rw-r--r-- 1 tsetuser testuser   46019 Jan  2 20:28 .cache.mk

For every .ko or .o it generates a .$filename.cmd

-rw-r--r-- 1 testuser testuser 7547928 Jan  2 20:40 wl.ko
-rw-r--r-- 1 testuser testuser     291 Jan  2 20:40 .wl.ko.cmd

Edit:
How about

			rm -rf "$srcdir"/{.[!.]*,*}

edit:
add back "$srcdir"/ incase the PWD is somehow not $srcdir

Last edited by loqs (2018-01-02 21:33:26)

Offline

#4 2018-01-02 22:23:33

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

Re: makepkg -C behavior

I'd prefer to temporarily `shopt -s dotglob` TBH.


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

Offline

Board footer

Powered by FluxBB