Commit Graph

582 Commits

Author SHA1 Message Date
Allan McRae 6092dda177 makepkg: check for package functions when package splitting
Makes sure the required package functions are present when using package
splitting.  Also moves setting of pkgbase variable outside the
check_sanity function to somewhere more appropriate.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae e72cce352a makepkg: fix pkgdesc restoration with split packaging
A pkgdesc with spaces in it would get restored to an array and thus only
the first word would be restored (FS#15210). Convert that array back to a
string.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae 621aa26e26 makepkg: Exit on failure within build() or package() functions
Errors in build() functions were only fatal, if "--log" was enabled. Errors in
package() functions were never fatal. Piping these functions through "cat -"
triggers error trapping. This prevents the need for "|| return 1" usage in
PKGBUILDs.

Original-patch-by: Juergen Hoetzel <juergen@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae b312c820c8 makepkg: fix check for previously built packages with package splitting
Checks if some or all packages are built before overwriting/installing.
Adds some new strings for translation.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:58 +10:00
Allan McRae 617e7d512f makepkg: clean up moving PKGINFO creation to a function
Someone forgot to commit this when pulling in the original patch
to his working branch...

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-07-10 16:29:57 +10:00
Dan McGee c72b4543b6 Update copyright headers and messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 02:08:33 -05:00
Dan McGee 68813ca986 Merge commit 'allan/working' 2009-06-23 21:52:35 -05:00
Dan McGee 8bbaf045b9 repo-add: use bsdtar optimization for better performance
When unzipping packages and the database archives, we don't need to look
through the entire archive to do what we need to do. For packages, .PKGINFO
should only be found once and should be the first file in the package. For
the database check, we only really need to look for one desc file.

The bsdtar -q option is very similar to the GNU tar --occurrence=1 option.

Example of speedup:

$ time repo-add junkdb.db.tar.gz *.pkg.tar.gz >/dev/null
real	0m16.159s
user	0m14.836s
sys	0m2.277s

$ time ./scripts/repo-add junkdb.db.tar.gz *.pkg.tar.gz >/dev/null
real	0m4.949s
user	0m3.730s
sys	0m2.093s

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-23 21:51:42 -05:00
Loui Chang 01f9ae63e7 makepkg: Move .PKGINFO creation into a function.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-22 17:09:16 +10:00
Loui Chang 02acf65ef3 makepkg: Download sources and check checksums for any source package.
It wouldn't be very nice to ship a PKGBUILD with the wrong checksums.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-21 20:32:17 +10:00
Allan McRae ef500b44ce makepkg: fix variable backup/restore for splitpkg
The backup and restore of variables that can be overridden while
making split packages only dealt with the first element, not the
whole array (FS#15010).  Adjust the bash voodoo to fix it...

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:51:18 -05:00
Allan McRae 04d5c4294a makepkg: fix PKGBUILD sanity check
If PKGBUILD was good, the "insane" variable was not defined and so
the if statement failed.  Simplify and fix this check.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:50:53 -05:00
Dan McGee e61ab1536f makepkg: refactor sanity checking into a function
No new checks, just move it into a function and return 1 rather than exit
directly. This also allows the use of local variables.

Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-06-07 15:07:37 -05:00
Xavier Chantry 30e2496775 repo-add: fail early if repo can not be created
Before this commit, the repo creation could fail after all packages have
been added to the database. Now this will be detected before adding
anything.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-23 12:27:32 -05:00
Pierre Schmitz c301d6aa25 Add support for the xz archive format
This simple patch adds support for the xz archive format to makepkg and repo-
add.
Xz can be used as source, package and package db file type.

Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
[Dan: fixed a few alignment issues]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:16:59 -05:00
Cedric Staniewski 212ea8a9ed repo-add: fix -n tests which are applicable only to strings
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:04:28 -05:00
Allan McRae 250e66e57b makepkg: fix sourcing BUILDSCRIPT and PATH issues
The bash source command looks in the users PATH for the file to source
before the local directory. This causes issues when someone has a
PKGBUILD somewhere in their path (for unknown some reason...).
Fixes FS#14727.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-16 13:48:10 +10:00
Allan McRae 5e32928a42 makepkg: Document package splitting
Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:02 +10:00
Allan McRae de44a0f474 makepkg: do not update pkgver when building source package
When making a source package for a SCM PKGBUILD, makepkg should not
update the pkgver/pkgrel.  Noted in FS#14456.

Signed-off-by: Allan McRae <allan@archlinux.org>
2009-05-14 16:30:01 +10:00
Allan McRae f569c4a042 makepkg: several small fixes
1) Do not attempt to strip compressed binaries
Original-work-by: Marc - A. Dahlhaus <mad@wol.de>

2) Add "\" in "GPL\'ed" so quote mark does not break source code highlighting

3) Add local to docdir paths in makepkg.conf for consistency

4) Use full path to sed in MacOSX in case users have GNU sed earlier in
path

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 21:23:46 -05:00
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
Allan McRae bb9b19a6c4 makepkg: provide MAN_DIRS configuration variable
Provides a MAN_DIRS variable in makepkg.conf which can be used
to specify folders to look for manual (man and info) pages to be
compressed.  Useful for packages that install to /opt.  Also
clarifies that "zipman" means "zip manuals" and covers both man
and info pages.

Original work by: Tiago Pierezan Camargo <tcamargo at gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:06:51 -06:00
Dan McGee f8b689d48e Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
	po/it.po
	scripts/makepkg.sh.in
2009-01-02 22:48:52 -06:00
Dan McGee cb03817ee8 Small makefile update
Use the proper call for symlink creation

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:46:48 -06:00
Allan McRae 2f59996c54 makepkg: detect incorrect usage of provides array
Using > or < in the provides array is wrong so make it cause an error.
Fixes FS#12540.

Also, use bash substitution rather than spawning new processes where
possible in the error checking.  Move split package detection to a
better position.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: backport to maint]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:46:47 -06:00
Allan McRae f4651c49af makepkg: tidy version package tests
The use if "! -z" to check if a string is not null is not good practice
so replace with the "-n" option. Also use the AND comparison within one
test rather than on two separate tests.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:46:47 -06:00
Allan McRae 751d37e749 makepkg: quote all uses of BUILDSCRIPT
Allows specifying alternative build script with spaces in name

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: backport some of the fixes to maint]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:46:37 -06:00
Allan McRae 08980fb4bc makepkg: Replace getopt with internal function
This will allow makepkg to work on systems like Mac OS X where the
default getopt is too old to properly handle long options.

The new parse_options function should replicate getopt's behaviour
completely.

Original work: Yun Zheng Hu <yunzheng.hu@gmail.com>
[Allan: Rewrite and bug fixes]
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 22:17:24 -06:00
Dan McGee bd628274cc Merge branch 'maint' 2008-12-07 22:12:17 -06:00
Dan McGee 818fae320f makepkg: ensure PKGBUILD does not contain CRLF characters
Do a simple check before sourcing the file to ensure we are a valid bash
script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-07 22:11:37 -06:00
Allan McRae 69be73f68c makepkg: several small bits of tidying
1. Do not warn people about missing arch if they are using --ignorearch.

2. Remove unneed reference to bug report about using fakeroot as little
   as possible.  We want to do that, bug report of not.

3. Removes superfluous warning given when building as root. The user
   has already used the "--asroot" flag.

4. Move comment about skipping warning message to above where it occurs

5. Do not warn about skipping source retreval, integrety checks and
   extraction when using --repackage

6. Do not warn about skipping build when using --repackage

7. Move comment about fakeroot usage to above test condition

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-07 22:11:29 -06:00
Dan McGee 59776ef306 makepkg: save and restore shell options before and after build()
Fix the issue uncovered by FS#12344. In this instance, the dotglob shopt was
being set in the build() function but never cleared, causing issues in the
remaining parts of the makepkg script.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-07 22:09:24 -06:00
Dan McGee 61c6552862 Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2008-12-02 22:15:02 -06:00
Dan McGee 346139298b Simplify mercurial revision command
Not only does this require less sed-magic, it also fixes FS#12286 where
fetching the revision number fails if mercurial is in compact mode.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-30 16:07:06 -06:00
Dan McGee 9394f229a0 Merge branch 'maint' 2008-10-31 19:55:50 -05:00
Allan McRae c4b9991258 makepkg: actually fix passing PKGBUILD from pipe
If PKGBUILD (BUILDSCRIPT) is not found, test for information from a
pipe and use that.  Fixes FS#9187.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Dan McGee 2890114600 makepkg: fix bash substitution to work under older versions
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 18:59:19 -05:00
Allan McRae 8d33dcb81c makepkg: enable passing PKGBUILD from pipe
Do not attemp to update pkgver/pkgrel when reading a SCM based PKGBUILD
from a pipe.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-28 22:33:58 -05:00
Dan McGee cd51abf0c8 Merge branch 'maint' 2008-10-28 22:20:09 -05:00
Dan McGee a63aeed562 Give pacman-optimize a refresher
This patch addresses quite a few lingering issues in the pacman-optimize
script. FS#11767 provoked this look-over and the following issues were
noticed and fixed:

* If an alternate dbroot was specified, then the lockfile location was never
  updated to reflect it. The lockfile location is now set after all dbpath
  initialization.
* The inclusion of a trailing slash on dbroot was problematic and led to the
  following command being executed:
    bsdtar -xpf /tmp/pacman-optimize.p12Q4vAUWY/pacman-db.tar.gz \
	  -C /var/lib/pacman/.new/
  It is doubtful we meant to create a hidden directory like this below our
  database root, only to go and delete it a second later and then
  re-extract. Fix the whole thing by ensuring our dbpath has its trailing
  slash stripped and then appending it when necessary.
* The DB extraction was performed twice for no real apparent reason. This
  opens the door for extraction problems the second time around, leaving you
  with no original database to fall back to. Change the behavior so we only
  extract once, and then perform a directory shuffle once we verify the
  checksums are correct.
* Perform an explicit sync after we drop the new database on the disk. It
  should work better this way.
* Tighten up our check for a pacman lockfile and the time we create one.
  There is still a possible race condition but the window is shorter.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-28 22:18:22 -05:00
Allan McRae 1e656c0a6a makepkg: fix updating PKGBUILD when building SCM packages
Fixes a bug and resets pkgrel to 1 when bumping pkgver

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-28 21:46:40 -05:00
Dan McGee 50e3dc02bf repo-add: Use openssl instead of md5sum
This is similar to the change we made in makepkg so it is cross-platform
compatible and doesn't require coreutils.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-18 23:59:37 -05:00
Dan McGee 91a013a879 makepkg: allow compression type to be autodetected
Inspired by commit 7e8f1469c4, use our given
PKGEXT or SRCEXT to determine what method of compression to use on the
package we create. If the extension is invalid, this should fall back to
creating a non-compressed tar file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 21:36:40 -05:00
Dan McGee f1f8f0e1c2 Quiet up the make process a bit
When we do our sed edits, we really don't need every command printed out to
the terminal. Now with "make -s", the output is quite palatable.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 21:36:30 -05:00
Dan McGee 1c47500ea6 Merge branch 'maint' 2008-08-26 20:11:25 -05:00
Xavier Chantry d6f62ba22d makepkg : allow to specify a download filename
A source entry can now have the following form, to specify a different
filename :
"filename::http://path/to/file"

Of course, the old syntax is still supported :
"http://path/to/file"

And as before, in the second case, the filename used is simply "file".

This fixes FS#11292, because handling multiple source files with the same
name is now possible (just choose a different filename).

But it will also allow to deal much more nicely with funny url like this by
using a sane filename (and unfortunately, there are quite a few) :
http://www.vim.org/scripts/download_script.php?src_id=6992

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-25 18:23:05 -05:00
Xavier Chantry 4b183bf9a9 makepkg : add --config option for an alternate config file.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 17:46:56 -05:00
Xavier Chantry 7e8f1469c4 Remove DB_COMPRESSION and DB_CHECKSUMS from makepkg.conf
DB_COMPRESSION was only used in repo-add and DB_CHECKSUMS was not used
anywhere.
This also removes the dependency on makepkg.conf in repo-add, so repo-add no
longer needs to source makepkg.conf

And instead of DB_COMPRESSION, it seems better to just check the extension
of the repository file. It does not make sense to have a tar.gz file with a
tar.bz2 extension or whatever.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 17:39:58 -05:00
Dan McGee 496b687c3d makepkg: check all integrity sums found in the PKGBUILD
Currently we use the INTEGRITY_CHECK array from makepkg.conf to limit both
the integrity sums generated and checked. It doesn't make a whole lot of
sense to ignore integrity sums that are present in a PKGBUILD, so this patch
will enable checking any that are available, but will only print a warning
about missing sums for those types found in INTEGRITY_CHECK.

It also adds a slight optimization of checking for openssl- we only need to
check once now because we use the same program for all checks.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 10:19:17 -05:00
Allan McRae 7865fb9af4 Treat info pages like man pages
As far a package building is concerned, info pages need to be treated
in the same fashion as man pages in that they both can be compressed.
This separates them from other forms of documentation and so it makes
sense to make that distinction within makepkg.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 09:20:51 -05:00
Xavier Chantry 56f0cf9d15 makepkg : localize the Y/n part of the question.
pacman already localizes the yesno stuff, so doing the same in makepkg is
more consistent.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:38:31 -05:00
Xavier Chantry 901e4aa5c2 makepkg: do insensitive comparisons of checksums.
This fixes FS#11283 , which was originally reported on the forums :
http://bbs.archlinux.org/viewtopic.php?id=53794

Insensitive comparisons were implicitly made before since md5sum --status was
used for checking. Now that we use openssl and compare checksums manually in
bash, we lost that feature.
This can be easily reintroduced using tr '[A-F]' '[a-f]'

What convinced me to fix it is that the md5 command line tool generates md5sums
in upper case by default :
http://www.fourmilab.ch/md5/

And finally, A-F and a-f are the same in hex and both are used.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:37:19 -05:00
Dan McGee 282eeadc68 Factor shell script size command into configure script
Commit 149839c539 introduced a small behavior regression as a drawback
for a better portability. repo-add now includes the approximate size (to the
nearest KB) rather than an exact size due to the switching of the du command
to a more portable form. Instead of sacrificing the exact size, use
configure to help us determine a valid command to acquire our filesize and
place it in the sync database.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-19 23:29:56 -05:00
Xavier Chantry 9609c0f135 repo-add: add optdepends to the sync database.
See FS#10630.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-19 19:24:56 -05:00
Nagy Gabor 6417ac129d repo-add: Fix whitespaces handling in variables.
repo-add didn't handle whitespaces nicely in fields value, and this has hurt
us several times, first with provision version (FS#9171) and then with
optdepends (FS#10630), so it is time to fix it.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-19 19:24:48 -05:00
Allan McRae a23fc08758 Fix error when sourcing profile script
With the "set -e" property set, a failure when sourcing /etc/profile
can cause makepkg to exit without error message.  The bash-completion
package activates this bug.  Fixes FS#11179.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-13 21:09:38 -05:00
Allan McRae 57bd8974c7 Fix creation of source package with local source files
Fixes FS#11149.

Signed-off-by: Allan McRae <allan@archlinux.org>
2008-08-09 07:23:37 -05:00
Xavier Chantry 9bc799ec7b makepkg: fix download functions with weird urls.
This fixes FS#11076.

1) quote the url in get_downloadclient
2) only enable nullglob where it is needed
You can see in 7fc306cd41 that nullglob was only enabled for one part, and
that it already caused other problems, which were fixed in 7ff5a917fd.
Thanks to Henning Garus for pointing out that nullglob was problematic with
urls containing expansion char like '?'.
3) change get_downloadcmd which displayed the download command line to
download_file which actually executes the download. It seems nicer that way.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-04 13:11:18 -05:00
Dan McGee 692ea72822 makepkg: Clarify usage instructions for --allsource/--source
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-04 13:02:58 -05:00
Xavier Chantry 6ede1a5af0 makepkg: Fix STRIP_DIRS test.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-29 21:57:17 -05:00
Xavier Chantry 0e0a846135 makepkg : use /etc/profile
This fixes FS#9486.
source /etc/profile instead of all individual files in /etc/profile.d/*
(which is done by /etc/profile anyway).

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-29 21:48:20 -05:00
Allan McRae 67f388c3fc makepkg: add packages to pkgdeps list only after successful install
This fixed FS#9403.  With this you can use "makepkg -sr", install the
dependencies, Ctrl+c during the makedepends installation and have
makepkg remove the installed packages on the exit.  Previously makepkg
tried to also remove the makedepends which were not installed.

The deplist="" line in remove_deps is due to an obscure bug where local
varaibles from the handle_deps function seem stay in scope because we
never formally exited it.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24 22:16:28 -05:00
Allan McRae ae9e33ed88 Make strip paths configurable
This patch introduces a new STRIP_DIRS makepkg.conf option
to change makepkg's search path when stripping binaries.

Original work by: Thomas Bächler <thomas@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-20 19:06:14 -05:00
Allan McRae a8405847e6 Strip *.a libraries in makepkg
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-19 11:03:10 -05:00
Allan McRae 99be5ab8d1 Use LC_ALL=C everywhere
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-19 11:03:03 -05:00
Nagy Gabor ffa3056010 Use "pacman -S $dep" in makepkg's dependency resolving
This method is equivalent with pacman's resolvedeps.
$dep can be any (versioned) dependency.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15 19:14:23 -05:00
Dan McGee 0bf66b097f makepkg: speed up svn revision check for large repositories
Using the suggestion from FS#10905, use 'svn info' rather than 'svn log' to
get the current revision number, which is much quicker for large Subversion
repositories. Eventually git will rule the world. :)

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15 19:09:15 -05:00
Dan McGee b196cc43a5 Merge branch 'maint' 2008-07-07 21:39:42 -05:00
Xavier Chantry 11695bd0d7 repo-add cleanup.
* change ln -s to ln -sf in the Makefile to prevent a failure when the link
already exists.
* make test_repo_db_file simpler and more natural, move the complexity out
of it.
* remove one $cmd = repo-remove check that wasn't needed

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-29 17:37:45 -05:00
Allan McRae d534488f2d Remove symlinks to libtool files
This prevents dangling symlinks to removed libtool files when
the !libtool option is used.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-27 09:07:39 -05:00
Allan McRae 74eb2f5c61 Additional path quoting and srcdir/pkgdir usage
Removes the remaining $startdir/{src,pkg} usage and adds quoting
around (hopefully) all remaining path variables

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-22 21:12:39 -05:00
Xavier Chantry 7ff5a917fd makepkg: add several quotes needed after nullglob.
After the "shopt -s nullglob" change, all regular expressions should be
properly quoted.
This commit only fixes the ones I found, there are probably others left, so
this should be kept in mind for easier future fixing.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-15 13:53:15 -05:00
Xavier Chantry b9445c12cf makepkg: Add missing quotes for the source array.
Now makepkg can handle filenames with whitespaces in the source array.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-15 13:52:54 -05:00
Sebastian Nowicki b8a66d6859 Use openssl for checksum verification instead of *sum utilities
md5sum, sha1sum, etc, do not exist on BSD systems by default. Openssl is a
good portable alternative. This also brings in a dependency for openssl.

Closes FS#10530.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-15 13:52:03 -05:00
Dan McGee a1dfa8e61f Combine repo-add and repo-remove into one script
They shared about 75% of their code, so there is no real reason we should
maintain them separately. Merge the differences accordingly and add a check
based on the basename of the command used to decide what behavior to follow.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-14 11:31:18 -05:00
Dan McGee 89819b3f92 repo-*: allow use of readlink or realpath
Linux coreutils provides readlink, and BSD systems tend to have realpath
available. Both commands provide similar functionality but of course have
different names. Add a check for either and use what is available.

While doing this, also unify some of the differences that have cropped up
between repo-add and repo-remove.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-14 10:48:28 -05:00
Allan McRae c11bdf19b1 Move geninteg block in makepkg before error checking
This patch moves the generating of integrity checks to before any
error checking takes place in the PKGBUILD file.  This allows integrity
generation to complete when unrelated errors exist in a PKGBUILD file
and allows the removal of multiple checks of the GENINTEG variable that
would otherwise be needed.

In addition a minor fix is made to a comment.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-14 08:35:40 -05:00
Dan McGee 7313c8546a Merge branch 'maint' 2008-06-12 19:21:06 -05:00
Dan McGee 7fc306cd41 Use shell builtin to list files for package inclusion
On BSD systems, as super user, the 'ls' command displays all dot files by
default, causing these to get included when not intended. If we use the bash
glob operator, we can avoid issues with ls on different platforms; however,
we need to turn the nullglob shell option on first to ensure we don't have
problems in empty directories.

Originally-noticed-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-12 19:06:14 -05:00
Dan McGee f827c9572e makepkg: remove deprecated --usesudo code
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-08 17:25:28 -05:00
Allan McRae 4979157cba makepkg: add --allsource option
This supplements the --source option and does nearly the same thing, except
downloaded source files are included in the archive as well. The sources are
now packages with a pkgname/ prefix.

Original-work-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-08 17:16:40 -05:00
Anton Fiuman 4a802838cb Don't require --force when using the --nobuild option
makepkg should not abort with error when a user uses the --nobuild option to
extract sources if a package has already been built.

Signed-off-by: Anton Fiuman <llexiw@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-01 23:49:38 -05:00
Dan McGee 5f0692def8 makepkg: remove some dead TODO code
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-31 12:06:45 -05:00
Dan McGee 636610432a Allow GIT version to be used in pacman builds
Add a new configure flag, --enable-git-version, that allows the output of
'git describe' to be used in the version string associated with this
package. This could aid in debugging for users that are using a development
version of pacman and we should be able to figure out which cut of code they
are using.

Sample output:
$ pacman --version
Pacman v3.1.4-190-g4cfa-dirty - libalpm v2.3.1

$ makepkg --version
makepkg (pacman) 3.1.4-190-g5861-dirty

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-31 12:06:34 -05:00
Allan McRae c1a5616c26 makepkg - add check for valid options in PKGBUILD
This patch removes the code block in makepkg that checked for depreciated
options in a PKGBUILD and provided a workaround.  Unknown and depreciated
options are upgraded to error conditions.

Also, removed TODO regarding including install script if exists and $install
is unset.  That should never happen.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:20 -05:00
Allan McRae 9577c07d86 No error in makepkg when removing deps fails
Catches error from when pacman is unable to remove dependencies after
successfully building package and prints warning.  Fixes FS#10039.

Signed-off-by: Allan McRae <mcrae_allan at hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:19 -05:00
Sebastian Nowicki c33cabd675 Use chown 0:0 instead of root.root
On BSD systems using a dot as a separator is not allowed. On Mac OSX it
is deprecated. A colon should be used instead. BSD systems also use the
"wheel" group instead of "root" to indicate the "super user" group. Both
groups use the id of 0.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Acked-by: Aaron Griffin <aaronmgriffin@gmail.com>
Acked-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Sebastian Nowicki 20ae871940 Use "legacy mode" on Mac OSX (for file command)
For some reason `file` on Mac OSX has different arguments than BSD and
Linux; -i no longer prints out the mime strings. With the environment
variable COMMAND_MODE set to "legacy", `file` behaves more like it does
on Linux and BSD, i.e., `file -i` prints the mime type.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Acked-by: Dan McGee <dan@archlinux.org>
Acked-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Sebastian Nowicki b9369a747d Allow an unprivileged user to create packages without fakeroot
When fakeroot was not in BUILDENV and the user was not root, makepkg still
tried to use fakeroot for building packages.
BUILDENV is now checked to see if fakeroot is enabled. If it is not enabled the
package can still be built, but root will not have ownership of files. This is
useful when users want to make packages for personal use and don't care about
ownership.

Closes FS#10450.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Xavier Chantry 149839c539 du -b is not available on BSD, use du -k instead.
This fixes FS#10459.

There is apparently no portable ways to get the apparent size of a file,
like du -b does. So the best compromise seems to get the block size in kB,
and then convert that to byte so that we keep compatibility.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:14 -05:00
Sebastian Nowicki 1d71079c5b Replace usage of "cp -s" with the more portable "ln -s"
The "-s" argument does not exist on BSD, and neither does
"--remove-destination". This patch replaces the calls to "cp -s
--remove-destination" with the equivalent "rm -f" and "ln -s" calls, in
order to increase portability.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-29 06:37:13 -05:00
Dan McGee ae5ef3b90f Remove --builddeps from makepkg
This really should be in an external script, as it is not makepkg's job to
rebuild your system.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 16:01:34 -05:00
Dan McGee 2edd01a973 scripts: add -q/--quiet option to repo-add and repo-remove
They are pretty noisy scripts in their normal course of operations, so allow
all messages to be squashed except for warning and error messages with this
new flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:48:55 -05:00
Dan McGee 502645c0e3 makepkg: Unify start and end messages
I've always found it odd why the package version is shown at the start but
not the end of the package build. Fix it, and while we are at it, add the
$CARCH variable to the display too.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:48:47 -05:00
Dan McGee 5389cdf654 Merge branch 'maint' 2008-04-29 19:52:06 -05:00
Daenyth Blank 27943a04d6 makepkg: fix strip section to allow spaces in paths
Inside tidy_install, change the section which strips libraries to use find |
while read rather than for foo in `find`. This should allow whitespaces in
filenames to still be processed correctly.

This fixes FS#10294.

Signed-off-by: Daenyth Blank <Daenyth+git@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-27 14:18:43 -05:00
Chantry Xavier dae3f9deef Add zipman makepkg option.
All other steps in tidy_install function were already controlled by an
option in makepkg.conf, so this patch adds an option for the man page
compression step too.
This will allow to keep man pages uncompressed, which is required for some
special meta man page, like the zshall one (see FS#4580).

Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011472.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-16 23:22:17 +01:00
Roman Kyrylych f56f7ff391 makepkg: Support for resuming source downloads
Download to *.part and remove the suffix if successful, thus md5sums will be
checked only for complete files, and next time makepkg will resume
downloading of partial file instead of complaining about invalid md5sums.

Old DLAGENTS format is still supported.

Late fix: Do not try to download %u first

The output of grep was not suppressed, thus the output of get_downloadcmd
was wrong because of extra line at the beginning that contained an
unsubstituted (with %o and %u) entry from DLAGENTS.

Signed-off-by: Roman Kyrylych <roman@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-10 18:45:58 -05:00
Dan McGee 73ac9f7b27 Merge branch 'maint' 2008-03-01 16:24:42 -06:00
Dan McGee d49f42ba75 Remove small remnant of old force=y option
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-27 13:14:05 -06:00
Dan McGee 4bd52f3fe4 Merge branch 'maint'
Remove gettext() function addition from gensync and updatesync in master as
gettext is no longer used in them anyway.
2008-02-20 18:58:04 -06:00
Mark Constable 420c8846b9 Fix two missing BUILDSCRIPT variables in makepkg.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-20 18:50:56 -06:00
Dan McGee 3559306546 scripts: allow usage when gettext is not installed
Address the issue of our scripts not working so great when gettext is not
available. This has come up in multiple bug reports, and is relatively easy
to address by adding a simple check and a stub function if gettext was not
found that simply echos the original message.

Addresses concerns from FS#9214 and FS#9607.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-17 21:25:41 -06:00
Dan McGee 6b07b5d345 Merge branch 'maint'
Conflicts:

	lib/libalpm/be_files.c
	lib/libalpm/package.c
2008-02-15 19:40:22 -06:00
Chantry Xavier 17180890a5 makepkg : set sane umask before source extraction.
This fixes FS#9242 and FS#9362.

Set umask before the sources are extracted, and after the /etc/profile.d/*
files are sourced in handledeps.
This sourcing of profile.d files is why umask was moved to the build
function in the first place, as can be seen in commit ac965ed401.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-11 20:40:43 -06:00
Dan McGee bfc024eab3 Merge branch 'maint' 2008-02-07 20:16:16 -06:00
Dan McGee 14ee1be1ef makepkg: do a quick check for the VCS binaries
Fixes FS#9230. Ensure we have the VCS binaries available when doing the
development version number checking.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-07 20:09:59 -06:00
Chantry Xavier e81dec9b8c remove --force option from repo-add.
The force option should only be specified in the PKGBUILD with
options=(force).  This information should be handled like any other meta
info, and there is no need to have a special repo-add option for it.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: fix up a few more references in contrib/ scripts, etc]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-05 19:35:41 -06:00
Dan McGee eca30ed66a Merge branch 'maint'
Conflicts:

	contrib/gensync
	contrib/updatesync
2008-02-05 19:31:23 -06:00
Chantry Xavier 69bc5ea5e2 add 'force' to PKGINFO, have repo-add respect it.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-January/011023.html
Also see FS#9347 and FS#9349.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-02 18:55:40 -06:00
Chantry Xavier 37bb99abfa repo-remove: print an error in case of an empty db
When removing the last packages from a database, repo-remove silently
failed. Now an error is printed.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-02 18:52:37 -06:00
Dan McGee 4fad7855fa Remove gensync and updatesync from normal distribution
Move these two scripts into contrib/, and start the process of de-automaking
them by removing the @sysconfdir@ references and the gettext initialization.
The removal of all gettext will soon follow.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-02 14:12:34 -06:00
Dan McGee 7786bf6024 Add deprecation warnings to gensync and updatesync
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-02 13:57:15 -06:00
Alex Merry b1103a3eaf updatesync: incorrect package deletion logic
Fixes FS#9279.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-02 10:09:06 -06:00
Dan McGee c028014f96 makepkg: ensure binaries in /opt/* are stripped
The path selection for stripping binaries was slightly off, so any binaries
in subdirectories of opt/ were missed. Fixes FS#9342.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27 21:07:44 -06:00
Chantry Xavier f950c26307 makepkg : improve determination of svn revision.
The previous sed command matched every line starting with r.
For example, with mpd-svn package in aur, the svn log output was rather big,
and there were several lines starting with r (the actual revision : r7155,
but also other lines starting with reverting and run), so this broke makepkg:

> makepkg
==> Determining latest svn revision...
  -> Version found: 7155
everting
un
sed: -e expression #1, char 27: unterminated `s' command

To make the sed command more bullet proof, I added the -q option of svn log,
which produces a quieter output, without the log.
And I changed the sed command to only match numbers for the revision.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-27 11:49:24 -06:00
Chantry Xavier 73ee64d49f workaround for a gettext string starting with --.
Workaround found in Advanced Bash-Scripting Guide, localization section.
"added a \0 (NULL) at the beginning of the sentence."

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-01-20 14:30:26 -06:00
Dan McGee 003adb7646 makepkg: add check to ensure we have non-URL files in build dir
Pacman 3.0 printed the following message if a file could not be found:
  ERROR: xxx was not found in the build directory and is not a proper URL.

We lost this logic in 3.1 when moving to the DLAGENT type stuff, so a
not-found file got passed all the way to the download logic where it failed
with a odd error message. Bring back some logic to ensure only files with
URLs get past a certain point, and fail if the file is not available.

Fixes FS#9208.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-20 12:32:37 -06:00
Dan McGee fd86c62db8 Fix typos in code comments
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 23:26:31 -06:00
Dan McGee ffff094126 makepkg: Oops! Lost the colon after forcever in opts parsing
I screwed this up here:
916e226b78

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 19:16:58 -06:00
Scott Horowitz 916e226b78 makepkg: Introduce --holdver option to prevent bumped pkgrel
This allows us to keep the --forcever option internal to makepkg.

Fixes FS#9194.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 18:42:26 -06:00
Chantry Xavier 8186dc11a9 Ensure correct dir permissions in the database.
Fix for FS#9176.
A previous commit (6e8daa553b) already forced all database files to 644.
Now the directories are also forced to 755.

Additionally, repo-add now sets the umask to 022, just like makepkg does, to
fix the problem at its root.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 12:51:37 -06:00
Travis Willard bbe02ec57f Update Gensync and Updatesync to use new PKGEXT variable
Previously, this caused both scripts to look for
pkgname-pkgver-pkgrel-arch..pkg.tar.gz - extra period has been removed.

Fixes FS#9190.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-13 12:21:36 -06:00
Dan McGee b1a231427b makepkg: Ensure we include all manpage directories in compression line
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-09 18:33:12 -06:00
Karolina Lindqvist 33f6fda8b6 makepkg: add package name to output when installing package
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-09 18:33:11 -06:00
Dan McGee dd5bc808ea makepkg: Fix issues with --asroot and building dependencies
The --asroot option was not passed to recursive calls of makepkg.

In addition, a 'cd' call was done only on the fakeroot branch instead of
both fakeroot and root branches. Move it outside the conditional.

Noticed-by: Karolina Lindqvist <karolina.lindqvist@kramnet.se>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-08 09:15:30 -06:00
Dan McGee 6f86f46c96 Remove makeworld from pacman package
This is an Arch-specific tool (although others could find use in it), so
off to the standalone ABS package it goes.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-06 10:42:35 -06:00
Dan McGee e0e33c329f Remove hardcoded DBEXT value from script
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-06 09:44:28 -06:00
Dan McGee 14e4366c78 makepkg: add application/zip to the recognized types
The recent upgrade of magic.mime in the file program changed the mime type
output to application/zip instead of application/x-zip as it is a registered
type. Unfortunately we then just skipped zip file extraction becuase of this
change.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 16:44:43 -06:00
Gustavo Chain 728b601f7b scripts: extra exit() calls in usage() function
Remove the exit() calls from usage as they should be handled by the caller.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 16:44:43 -06:00
Dan McGee c26039240d Remove mentions of ABS from makepkg
Kill off some of the $ABSROOT stuff that was still hanging around in there.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-05 14:35:40 -06:00
Dan McGee fbd88a8212 Remove .FILELIST generation from makepkg (and elsewhere)
This is something pacman can do on its own straight from the archive, and we
will reduce the chance of problems occurring becuase of inproper FILELIST
generation as we have had in the past with special characters in filenames.

Once we remove it from makepkg. we can remove any usage of it from all of
our other tools, including pacman, pactest, and contrib/ utilities.

Note that removing it from pacman uncovered a few other bugs anyway, so this
was probably a good move.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-29 11:58:23 -06:00
K. Piche c84feb92db Makepkg missing check for empty pkgname
I thought it was wierd that makepkg didn't do a sanity check for the
$pkgname.  This makes for a simple first try at a GIT patch.

Signed-off-by: K. Piche <kevin@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-28 19:54:45 -06:00
Dan McGee 9addd88a7d Do not move man pages to a non-FHS location
Fixes Arch Linux bug FS#8839.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 15:47:30 -06:00
Dan McGee 741fa31603 Remove abs from the pacman repository
abs has always been an Arch Linux specific tool, and although it is used
primarily by pacman and makepkg, it should not be included with a distro-
agnostic tarball. In addition, maintenance of the script would be better
outside of pacman and would allow for more frequent updates.

This also facilitates our move away from a cvsup/csup dependent tool for
syncing PKGBUILDs.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-21 11:05:38 -06:00
Chantry Xavier ebae8bd009 update of translation-help and fix a typo in gensync.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-12-19 18:21:27 -06:00
Dan McGee 20bad3b839 Set the default packager to "Unknown Packager"
There is no real reason to make it look like someone that can't bother to
set the packager variable is official in any way, so remove the Arch Linux
reference from makepkg.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-16 22:00:12 -06:00
Dan McGee 9781d0d637 Update GNU GPL boilerplate and copyright dates
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 22:55:39 -06:00
Allan McRae 9615d82343 Compress hard linked man pages
This fixes FS#5392.  If hard links are present for a man page, all
other hard linked files are removed, the man page is zipped and the
hard links are updated to the newly compress man page.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: use find -samefile option, don't fail if one of mandirs is
nonexistent]
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-04 18:55:44 -06:00
Dan McGee dbc2f902db pacman-optimize: add note saying sync would be helpful
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 20:56:15 -06:00
Nathan Jones c29209e7b6 repo-add: Ensure only adding package's deltas.
repo-add was adding the delta files of any package that started with the
same package name plus a hyphen.

In this example, deltatest-libs delta files were added to the deltatest
package:

$ repo-add deltatest.db.tar.gz deltatest-1.0.2-1-i686.pkg.tar.gz
==> Extracting database to a temporary location...
==> Adding package 'deltatest-1.0.2-1-i686.pkg.tar.gz'
  -> Removing existing package 'deltatest-1.0.2-1'...
  -> Creating 'desc' db entry...
  -> Computing md5 checksums...
  -> Creating 'depends' db entry...
  -> Creating 'deltas' db entry...
  -> Added delta 'deltatest-1.0.2rc3-1_to_1.0.2-1-i686.delta'
  -> Added delta 'deltatest-libs-1.0.0-1_to_1.0.1-1-i686.delta'
==> Creating updated database file /tmp/deltatest.db.tar.gz

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13 00:13:21 -06:00
Giovanni Scafora 5cd6ffda72 makeworld: gettext support
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:42:19 -06:00
Roman Kyrylych 6f5ee2432c makepkg: remove .pacsave files when uninstalling dependencies
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 09:39:39 -06:00
Scott Horowitz dd2d6f980b Correctly handle version comparisons for SVN/CVS/etc PKGBUILDS.
Retrieve SVN/CVS/etc revision number before checking if the
package has already been built. This allows building a newer
version of a developmental package without having to use -f.
Now -f will only be needed if the latest SVN/CVS/etc revision
is the same as the built package.

Signed-off-by: Scott Horowitz <stonecrest@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 07:15:37 -06:00
Sebastian Nowicki cb04b3a5f3 Fix mercurial complaining about directory already existing
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-05 21:10:35 -06:00
Roman Kyrylych 4a5e7b6bd1 Add support for arch='any'
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 09:50:04 -06:00
Dan McGee ccdf29ffa8 abs: prefer csup to cvsup
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-30 08:12:09 -05:00
Dan McGee 3e3e7a97a6 makepkg: add explicit dir to find calls
Some of the find calls did not have a path, which isn't valid in some
versions of the find utility. Add a . for compatibility.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-28 21:18:39 -05:00
Scott Horowitz 8a9c83dd4b Integrate versionpkg into makepkg
If PKGBUILDs use the correct svn/cvs/etc variables, determine the latest
revision number and force this as the pkgver for building.

Signed-off-by: Scott Horowitz <stonecrest@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 22:35:23 -05:00
Dan McGee b609cb0a5d makepkg: readd -p option that was lost in getopt conversion
The -p option was accidentally dropped in commit
54b71f0427. Readd it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 18:36:58 -05:00
Nathan Jones 1118e00fe9 Add delta information to the repository database.
(Dan: cleaned up one if statement)

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:20:16 -05:00