Commit Graph

412 Commits

Author SHA1 Message Date
Allan McRae c27904661e makepkg: make in-place sed portable
Do a sed replacement in-place is not very portable.  On Mac OSX and
BSDs, the syntax is "sed -i ''" where as with GNU sed the command is
"sed -i''" or just "sed -i".  This patch detects which command should
be used during configure.

Credit to Kevin Barry who researched this issue and provided a patch
to work around this using temporary backup files.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-26 09:22:23 -05:00
Dan McGee 93ca155b48 Merge branch 'xav/repo-add' 2009-04-11 13:50:56 -05:00
Dan McGee 101c16b3eb makepkg: fix double check on same path
Commit 142225fd typo-ed this one, as it should look like the rest of the
checks similar to it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:30:38 -05:00
Loui Chang 52d184dae8 makepkg: Fix integrity check when files are missing.
The index in the for loop wasn't being incremented, so
if the first file wasn't found, the second file would be compared to the
first checksum, rather than the second.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 12:52:11 -05:00
Allan McRae 442b91a5dd makepkg: run tidy_install with no package() function
After the splitpkg implementation, the tidy_install function
was not being called in PKGBUILDs with only the build() function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-30 17:41:34 +10:00
Allan McRae deff57ce8b makepkg: do not bail on failure to install built package
Fixes FS#13417.  Do no exit makepkg on a failure to install the
built package(s).  This allows clean-up to still occur.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-29 16:49:57 +10:00
Allan McRae 7370fd595b makepkg: adjust log clean-up for new filenames
The log files now have -build or -package at the end and there
are separate log files for each *_package() function. Alter
clean_up() to deal with this. Also, move glob outside quotes so
this actually works.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-26 01:39:13 +10:00
Allan McRae 4c27a776bd makepkg: adjust install_package for split packages
Install all created packages when using the install option with
package splitting.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-25 23:52:27 +10:00
Allan McRae 7a8ba5a978 Refactor testing for color message output
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-16 09:18:41 +10:00
Allan McRae 7df0d048d1 makepkg: add pkgbase variable
The pkgbase variable is added to improve informational output and
source package naming when using split packages.  Defaults to
${pkgname[0]} if not set.

Also:
 - move splitpkg detection to after pkgname presence is verified
 - add "cd" line to package_foo() functions in splitpkg proto

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-03-16 09:17:10 +10:00
Xavier Chantry 0c614c181e repo-add : rename gstmpdir to tmpdir
What does gstmpdir mean?

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:24 +01:00
Xavier Chantry 91d43ba4b4 repo-add : don't change the modification time on depends and desc
The modification time on depends and desc file were changed to match the
modification time of the package file. I don't see why and we are actualling
losing information here. If we want to know the date of the package file, we
can just look inside the depends file. If we want to know when the entry was
created, we should not alter the modification time of depends and desc.

Besides, this had the non-obvious and undocumented side effect that the
depends file was always created, even if it was empty. And pacman actually
does require that. So I added a "touch depends" to always create the file.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:24 +01:00
Xavier Chantry 59b4725bbb repo-add : new locking system
Weird things could happen if several repo-add were run concurrently on the
same database. The introduced locking system will prevent this to happen.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:24 +01:00
Xavier Chantry a556bc57fc repo-add : fix package variables declaration
- arch was missing

- backup is not used by repo-add. However makepkg still needs to put it in
  PKGINFO because pacman uses it

- startdir is no longer used after the new delta implementation

- the declaration of group, depend, backup, etc is not needed because these
  variables are always declared before being used :
	declare $var="$val"
	case "$var" in
		group)    _groups="$_groups$group\n" ;;

- reorder the variables declaration to follow the same order than they are
  written to the depends and desc file, for making future checks easier

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:24 +01:00
Xavier Chantry bbcf96230a repo-add : rewrite delta support
Use the correct database format

Use xdelta3 to get the source and destination files from the delta itself

Allow delta files to be added with repo-add just like package files. delta
files can also be removed with repo-remove. This is simply done by looking
for a .delta extension in the arguments, and calling the appropriate
db_write_delta or db_remove_delta functions.

Example usage:
repo-add repo/test.db.tar.gz repo/libx11-1.1.99.2-2-x86_64.pkg.tar.gz
repo-add repo/test.db.tar.gz repo/libx11-1.1.5-2_to_1.1.99.2-2-x86_64.delta
repo-remove repo/test.db.tar.gz libx11-1.1.5-2_to_1.1.99.2-2-x86_64.delta

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:23 +01:00
Xavier Chantry 89685bdb29 repo-add : drop delta support to rewrite it from scratch
The current implementation has several problems :

Wrong database format

All the info is taken from the filename, which is a bit ugly

It looks for .delta files in the current directory when adding a package,
which is not very flexible

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:23 +01:00
Xavier Chantry 994804f20e repo-add.sh.in : repo-remove improvements
* report when a package entry to be removed is not found

* backup and restore eventual "deltas" files

* slight optimization when looking for an entry : only look at the entries
starting with $pkgname

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:23 +01:00
Xavier Chantry f8bb69c1d2 repo-add cleanup
Refactor the main loop, which was difficult to read.

Use case instead of if when appropriate.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:23 +01:00
Xavier Chantry 9fa18d9a4b Add pkgdelta script to create deltas.
This should obsolete the delta support in makepkg. Having a separate script
should be more flexible.

Example usage:
$ pkgdelta repo/tzdata-2009a-1-x86_64.pkg.tar.gz repo/tzdata-2009b-1-x86_64.pkg.tar.gz
==> Generating delta from version 2009a-1 to version 2009b-1
==> Generated delta : 'repo/tzdata-2009a-1_to_2009b-1-x86_64.delta'

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:10:15 +01:00
Xavier Chantry c8beffa790 Fix several issues with xdelta
1) The changes to sync.c look big but there are mostly caused by
the indentation. Fix a bug where download_size == 0 because the packages and
deltas are already in the cache, but we still need to build the deltas list
and apply the deltas to create the final package.

2) Fix the gzip / md5sum issue by switching to xdelta3, disabling external
recompression and using gzip -n in pacman, and disable bsdtar compression
and using gzip -n in makepkg.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:08:36 +01:00
Allan McRae 687f04ab46 Only check checksums if there is a source file
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:38:54 -05:00
Xavier Chantry b4e1365657 makepkg : remove xdelta support
The pkgdelta script can be used instead.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-28 15:42:07 -06:00
Xavier Chantry f09f82ee59 repo-add: print warning if same version already exists
Simple fix for FS#13414.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-28 15:33:39 -06:00
Dan McGee 2268981ebf Merge branch 'maint' 2009-02-23 20:40:27 -06:00
Allan McRae a309a016bf makepkg: fix updating pkgrel with pkgver in SCM packages
Commit 1e656c0a introduced the changing of pkgrel to 1 when the
pkgver was updated in SCM PKGBUILDs. However, the output in the
"Making package:" was wrong. Attempting to fix that created
another bug (FS#13416). Interestingly, pkgver was only ever
being updated in the fakeroot stage which caused this problem.
Now both pkgver and pkgrel are updated after the first
devel_check and devel_update. Enjoy the really long explaination
for a two line fix...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-23 20:18:08 -06:00
Xavier Chantry c8a41b7d6d repo-add : remove realpath usage
Rework slightly db_write_entry so that $pkgfile is no longer referenced
from the temporary dir. This means $pkgfile can be a relative path and does
not need to be converted with realpath anymore.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-19 19:20:27 -06:00
Xavier Chantry c590ac0997 repo-add : remove the need of realpath for REPO_DB_FILE
REPO_DB_FILE does not need to be an absolute path anymore so no need to
call realpath.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-19 19:20:19 -06:00
Dan McGee 1c4633ea2c Merge branch 'maint' 2009-02-18 21:20:17 -06:00
Xavier Chantry e515d89969 repo-add : remove useless test_repo_db_file function
This function was used only once, was basically just one line, and was also
called with an unused argument.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-18 19:21:34 -06:00
Dan McGee eb1775e485 repo-add: fix eval and quote issues
eval was ugly and dirty, and bit us here. Instead, use a safer form of
variable declaration to ensure quotes don't foil us in pkgdesc or any other
fields.

This fixes FS#10837.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-15 21:16:21 -06:00
Dan McGee 04c2b9d4ed Merge branch 'maint' 2009-02-08 11:43:08 -06:00
Sebastian Nowicki ea84819bbb makepkg: Make stripping debug symbols cross-platform
The Linux and BSD versions of strip have the --strip-debug option (as
well as the -S option), however Mac OS X only has -S.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-08 11:33:33 -06:00
Dan McGee 8929769902 makepkg: test fixes, part 2
The goal of this fix was empty string comparisons:
-  if [ "$pkgname" != "" ]; then
+  if [ -n "$pkgname" ]; then

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-18 13:48:31 -06:00
Dan McGee 350c3eb6ec makepkg: clean up test usage
In a lot of places, we had the following construct:
  [ "$foobar" = "0" ]
which is better represented by using the integer tests:
  [ $foobar -eq 0 ]

Attempt to unify makepkg to use the latter rather than the former in all
places. From here on out we should ensure anything that is set to 0, 1, etc.
uses the -eq format rather than =.

In addition, fix a few other test anomalies including usage of double
equals.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-18 13:46:23 -06:00
Allan McRae fba5771fa4 makepkg: repackage rework with package functions
When using the optional package() function or split packages, the
entire packaging step is rerun instead of just final package
creation step.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-17 09:19:35 -06:00
Dan McGee 3d49d88009 Merge branch 'am/splitpkg'
* am/splitpkg:
  makepkg: implement creation of split packages
  makepkg: Optional argument for run_package and create_package
  makepkg: hack around tee in run_package function
  makepkg: add functions for backup and restore of package fields
  makepkg: add optional package function
  makepkg: Add PKGBUILD-split.proto
2009-01-16 19:45:02 -06:00
Allan McRae e946ee7745 makepkg: implement creation of split packages
Adds the ability to create multiple packages from one PKGBUILD

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:32:05 +10:00
Allan McRae 21b8a5418d makepkg: Optional argument for run_package and create_package
Generalize run_package to allow the passing of a package name
directing the use of an alternative package function. A similar
adjustment to create_package to prepare split packages.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:26:52 +10:00
Allan McRae 708ce1480f makepkg: hack around tee in run_package function
Piping the package function through tee to log the outut also
clears any variables set in the package function.  This is a
problem in split packages as package variable overrides are done
in the package function.  This is fixed by creating a node which
the output is piped through and duplicated using the tee function.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:24:21 +10:00
Allan McRae 9804911c5f makepkg: add functions for backup and restore of package fields
Adds functions for the backup and restoration of package variables
that can be over-ridden during package splitting.  Variables which
can be overridden are given in the splitpkg_overrides variable.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:22:04 +10:00
Allan McRae 08034ceb17 makepkg: add optional package function
This patch allows us to split the building and packaging stages of
a PKGBUILD and minimize fakeroot usage. This can be done with less
code duplication (run_build and run_package look quite similiar) but
the run_package function will be where the package splitting logic
is implemented in the future.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-01-16 22:20:05 +10:00
Aaron Griffin a9f030e84c Make the repo-add quiet flag less quiet
Considering one can easily run:
   repo-add .... >/dev/null
to get only warnings and errors, the -q flag is mostly useless.

Make the -q flag silence only level 2 messages.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-14 19:18:08 -06:00
Dan McGee 7a3a718c7a makepkg: fix my own stupid mistake
We don't want to bail if a certain integrity check wasn't even provided.
Whoops.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13 20:13:31 -06:00
Aaron Schaefer e3a06961f6 makepkg: use INTEGRITY_CHECK only for generation of checksums
Signed-off-by: Aaron Schaefer <aaron@elasticdog.com>
[Dan: fail if checksum array is incorrectly sized]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13 19:50:38 -06:00
Xavier Chantry 4ec846f5ac makepkg : fix a lot of breakages caused by Allan
This patch started as a simple typo fix (pugre instead of purge in two
places), as well as a fix of a test which was using PURGE_TARGETS instead of
$PURGE_TARGETS.

It evolved in a slight handling change of the OPTIONS which have a variable
affecting their behavior (strip STRIP_DIRS, docs DOC_DIRS, zipman MAN_DIRS
and purge PURGE_TARGETS), as well as a clarification in makepkg.conf. Now
when a variable is undefined or empty, the corresponding option will have no
effect. It looked weird to have a fallback when a option is defined but
empty, it seems more natural to not have any fallbacks.

Also re-enable docs by default. It seems arbitrary to delete files from
packages by default, and it would be more vanilla and distro agnostic to
keep them. docs was also the only negated option.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:28:10 -06:00
Allan McRae 1cc8ad6112 makepkg: Add support for specifying LDFLAGS
Provide support for specifying LDFLAGS within makepkg.conf but leaves
this undefined by default. Fixes FS#12542.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:17:15 -06:00
Allan McRae 8f26bb9052 makepkg: move BUILDSCRIPT from makepkg.conf
Commit 4b183bf9 moved makepkg.conf sourcing to after the parsing
of options, breaking the -p option and --help output.  The solution
is to move BUILDSCRIPT out of makepkg.conf.  This patch moves the
definition BUILDSCRIPT back to makepkg itself and adds configure
option to allow easy changing of this value during build time.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:13:54 -06:00
Allan McRae 9a7f68317a makepkg: Introduce purge option
The purge option, combined with the PURGE_TARGETS variable,
allows makepkg to automatically remove commonly confliting or
removed files (e.g. /usr/share/info/dir, *.pod).

Original work: Tim Yang
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:11:51 -06:00
Allan McRae 774c252753 makepkg: Add used options to PKGINFO file
Adds defined options to the PKGINFO file in the form of "makepkgopt =".
It may be useful to be able to add these to the pacman DB at some point
as that would allow (e.g.) checking which packages have had their docs
striped (FS#7092).

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:11:48 -06:00
Allan McRae 1b7ff7a636 makepkg: add fallback for when MAN_DIRS is unset
This prevents makepkg compressing every file when MAN_DIRS is not
supplied in makepkg.conf

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:08:42 -06:00