[pacman-dev] Patch for makepkg bug #5021
This is a _preliminary_ patch for bug 5021. It should do everything the original code does plus some. A few comments: 1. I have very little familiarity with info or doc files, and the find operation could be tightened up by adding an extension if they are always packaged this way (e.g. .info). 2. Is there ever a time where a folder would exist with the doc or info name and it shouldn't be deleted? Obviously these find operations will do that, so I would want to make sure this is the case. Good naming of directories would lead me to believe it shouldn't happen, but who knows... If anyone knows a good package to test this behavior on, let me know. I haven't yet ran it on a lot of packages. I tried running it on the gnubiff package listed in the bug report but got a linking error (with both the version in the PKGBUILD and the updated 2.2.4 version). -Dan ============= --- /home/dmcgee/projects/pacman-lib.orig/scripts/makepkg 2006-12-19 11:40:51.000000000 -0500 +++ makepkg 2006-12-20 01:13:56.000000000 -0500 @@ -774,13 +774,17 @@ fi fi -if [ ! "`check_option KEEPDOCS`" -a "$KEEPDOCS" = "0" ]; then +if [ ! "$(check_option KEEPDOCS)" -a "$KEEPDOCS" = "0" ]; then # remove info/doc files msg "Removing info/doc files..." cd $startdir - rm -rf pkg/usr/info pkg/usr/share/info - rm -rf pkg/usr/doc pkg/usr/share/doc - rm -rf pkg/{usr,opt/gnome}/share/gtk-doc + # fix flyspray bug #5021 + find pkg -type f -wholename "pkg/*/info/*" -exec rm -f {} \; + find pkg -type d -wholename "pkg/*/info" -exec rmdir {} \; + find pkg -type f -wholename "pkg/*/doc/*" -exec rm -f {} \; + find pkg -type d -wholename "pkg/*/doc" -exec rmdir {} \; + find pkg -type f -wholename "pkg/*/gtk-doc/*" -exec rm -f {} \; + find pkg -type d -wholename "pkg/*/gtk-doc" -exec rmdir {} \; fi # move /usr/share/man files to /usr/man
This is getting complicated. I dislike hard-coded path-names. This makes scripts inflexible and unreadable. Personally i would prefer moving this to makepkg.conf, like: REMOVE_DIRS=(pkg/usr/{share/,}{info,doc} pkg/opt/gnome/{foo/,}info) and just do: rm -rf ${REMOVE_DIRS[@]} Jürgen On Wed, Dec 20, 2006 at 01:55:44AM -0500, Dan McGee wrote:
This is a _preliminary_ patch for bug 5021. It should do everything the original code does plus some. A few comments: 1. I have very little familiarity with info or doc files, and the find operation could be tightened up by adding an extension if they are always packaged this way (e.g. .info). 2. Is there ever a time where a folder would exist with the doc or info name and it shouldn't be deleted? Obviously these find operations will do that, so I would want to make sure this is the case. Good naming of directories would lead me to believe it shouldn't happen, but who knows...
If anyone knows a good package to test this behavior on, let me know. I haven't yet ran it on a lot of packages. I tried running it on the gnubiff package listed in the bug report but got a linking error (with both the version in the PKGBUILD and the updated 2.2.4 version).
-Dan
============= --- /home/dmcgee/projects/pacman-lib.orig/scripts/makepkg 2006-12-19 11:40:51.000000000 -0500 +++ makepkg 2006-12-20 01:13:56.000000000 -0500 @@ -774,13 +774,17 @@ fi fi
-if [ ! "`check_option KEEPDOCS`" -a "$KEEPDOCS" = "0" ]; then +if [ ! "$(check_option KEEPDOCS)" -a "$KEEPDOCS" = "0" ]; then # remove info/doc files msg "Removing info/doc files..." cd $startdir - rm -rf pkg/usr/info pkg/usr/share/info - rm -rf pkg/usr/doc pkg/usr/share/doc - rm -rf pkg/{usr,opt/gnome}/share/gtk-doc + # fix flyspray bug #5021 + find pkg -type f -wholename "pkg/*/info/*" -exec rm -f {} \; + find pkg -type d -wholename "pkg/*/info" -exec rmdir {} \; + find pkg -type f -wholename "pkg/*/doc/*" -exec rm -f {} \; + find pkg -type d -wholename "pkg/*/doc" -exec rmdir {} \; + find pkg -type f -wholename "pkg/*/gtk-doc/*" -exec rm -f {} \; + find pkg -type d -wholename "pkg/*/gtk-doc" -exec rmdir {} \; fi
# move /usr/share/man files to /usr/man
_______________________________________________ pacman-dev mailing list pacman-dev@archlinux.org http://www.archlinux.org/mailman/listinfo/pacman-dev
2006/12/20, Jürgen Hötzel <juergen@hoetzel.info>:
This is getting complicated. I dislike hard-coded path-names. This makes scripts inflexible and unreadable. Personally i would prefer moving this to makepkg.conf, like:
REMOVE_DIRS=(pkg/usr/{share/,}{info,doc} pkg/opt/gnome/{foo/,}info)
and just do:
rm -rf ${REMOVE_DIRS[@]}
Nice idea! This is especially useful for other distros where pacman will be used. -- Roman Kyrylych (Роман Кирилич)
On 12/20/06, Jürgen Hötzel <juergen@hoetzel.info> wrote:
This is getting complicated. I dislike hard-coded path-names. This makes scripts inflexible and unreadable. Personally i would prefer moving this to makepkg.conf, like:
REMOVE_DIRS=(pkg/usr/{share/,}{info,doc} pkg/opt/gnome/{foo/,}info)
I like this idea as well, though, it might be "better" to rename the variable to "DOC_DIRS" or something, seeing as this removal goes along with the documentation removal. Dan, would you want to update the patch for this, or should I (your choice)?
I can take a look at it later today and put another patch together. -Dan
On 12/20/06, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
On 12/20/06, Jürgen Hötzel <juergen@hoetzel.info> wrote:
This is getting complicated. I dislike hard-coded path-names. This makes scripts inflexible and unreadable. Personally i would prefer moving this to makepkg.conf, like:
REMOVE_DIRS=(pkg/usr/{share/,}{info,doc} pkg/opt/gnome/{foo/,}info)
I like this idea as well, though, it might be "better" to rename the variable to "DOC_DIRS" or something, seeing as this removal goes along with the documentation removal.
Incorporated other suggestions and named the variable DOC_DIRS. Since I had to change the conf file, I also moved the modeline to the bottom (take it or leave it), and added a blank line between the options that are actually set in the options array, and those that aren't. I think I covered most of the bases in the path, feel free to correct it if I didn't. ______________ diff -aur /home/dmcgee/projects/pacman-lib.orig/etc/makepkg.conf.in pacman-lib/etc/makepkg.conf.in --- /home/dmcgee/projects/pacman-lib.orig/etc/makepkg.conf.in 2006-12-14 08:11:52.000000000 -0500 +++ pacman-lib/etc/makepkg.conf.in 2006-12-20 11:31:02.000000000 -0500 @@ -1,4 +1,4 @@ -# vim: set ft=sh ts=2 sw=2 et: +# # /etc/makepkg.conf # @@ -55,9 +55,11 @@ NOLIBTOOL=0 #-- Don't remove empty directories from package? NOEMPTYDIRS=0 + #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 INTEGRITY_CHECK=(md5) - +#-- Info and doc directories to be removed +DOC_DIRS=(pkg/usr/{,share/}{info,doc} pkg/opt/gnome/{,share/}{info,doc,gtk-doc}) ######################################################################### # PACKAGE OUTPUT @@ -69,3 +71,5 @@ #SRCDEST=/home/source #-- Packager: name/email of the person or organization building packages #PACKAGER="John Doe <john@doe.com>" + +# vim: set ft=sh ts=2 sw=2 et: diff -aur /home/dmcgee/projects/pacman-lib.orig/scripts/makepkg pacman-lib/scripts/makepkg --- /home/dmcgee/projects/pacman-lib.orig/scripts/makepkg 2006-12-19 11:40:51.000000000 -0500 +++ pacman-lib/scripts/makepkg 2006-12-20 11:30:54.000000000 -0500 @@ -774,13 +774,11 @@ fi fi -if [ ! "`check_option KEEPDOCS`" -a "$KEEPDOCS" = "0" ]; then +if [ ! "$(check_option KEEPDOCS)" -a "$KEEPDOCS" = "0" ]; then # remove info/doc files msg "Removing info/doc files..." cd $startdir - rm -rf pkg/usr/info pkg/usr/share/info - rm -rf pkg/usr/doc pkg/usr/share/doc - rm -rf pkg/{usr,opt/gnome}/share/gtk-doc + rm -rf ${DOC_DIRS[@]} fi # move /usr/share/man files to /usr/man
2006/12/20, Dan McGee <dpmcgee@gmail.com>:
Incorporated other suggestions and named the variable DOC_DIRS. Since I had to change the conf file, I also moved the modeline to the bottom (take it or leave it), and added a blank line between the options that are actually set in the options array, and those that aren't. I think I covered most of the bases in the path, feel free to correct it if I didn't.
Good work!
+#-- Info and doc directories to be removed +DOC_DIRS=(pkg/usr/{,share/}{info,doc} pkg/opt/gnome/{,share/}{info,doc,gtk-doc})
What about KDE? -- Roman Kyrylych (Роман Кирилич)
What about KDE?
KDE among others. Anything that is installed in /opt becomes a bit of an issue because each program has its own directory. It would be easier if people that packaged and/or used these packages could submit an update to that DOC_DIRS, as I don't use KDE.
On 12/20/06, Dan McGee <dpmcgee@gmail.com> wrote:
What about KDE?
KDE among others. Anything that is installed in /opt becomes a bit of an issue because each program has its own directory. It would be easier if people that packaged and/or used these packages could submit an update to that DOC_DIRS, as I don't use KDE.
alternatively, adding: DOC_DIRS="${DOC_DIRS[@]},foo,bar,baz" inside the build() function might work too... untested, but it should work in theory.... The rationale here being that it makes it easy to set the "keepdocs" option without changing the PKGBUILD really, when compared to a "rm -rf $startdir/blah/blah". /me shrugs Just thinking out loud
On 12/20/06, Aaron Griffin <aaronmgriffin@gmail.com> wrote:
DOC_DIRS="${DOC_DIRS[@]},foo,bar,baz" inside the build() function
ignore my crappy syntax - I combined two things in my head (bash arrays and {} globbing) DOC_DIRS=(${DOC_DIRS[@]} foo bar baz)
alternatively, adding: DOC_DIRS="${DOC_DIRS[@]},foo,bar,baz" inside the build() function might work too... untested, but it should work in theory....
That would work as long as we assume the build function is always ran...not true with my next patch for #2978...package without build. The other option would be to make it a optional parameter (along the lines of license) in the PKGBUILD. We could have a default path of the normal /usr/share/info and its variants, and if the particular package needed to override it we could allow a line in the build file along the lines of: docdir=(/opt/gnome/share/info /opt/gnome/share/gtk-doc) We could then use this + the defaults when removing the info, and basically ignore it if the keepdoc option was added. -Dan
2006/12/20, Dan McGee <dpmcgee@gmail.com>:
alternatively, adding: DOC_DIRS="${DOC_DIRS[@]},foo,bar,baz" inside the build() function might work too... untested, but it should work in theory....
That would work as long as we assume the build function is always ran...not true with my next patch for #2978...package without build.
The other option would be to make it a optional parameter (along the lines of license) in the PKGBUILD. We could have a default path of the normal /usr/share/info and its variants, and if the particular package needed to override it we could allow a line in the build file along the lines of: docdir=(/opt/gnome/share/info /opt/gnome/share/gtk-doc)
We could then use this + the defaults when removing the info, and basically ignore it if the keepdoc option was added.
this seems like a good solution. -- Roman Kyrylych (Роман Кирилич)
2006/12/20, Dan McGee <dpmcgee@gmail.com>:
This is a _preliminary_ patch for bug 5021. It should do everything the original code does plus some. A few comments: 1. I have very little familiarity with info or doc files, and the find operation could be tightened up by adding an extension if they are always packaged this way (e.g. .info). 2. Is there ever a time where a folder would exist with the doc or info name and it shouldn't be deleted? Obviously these find operations will do that, so I would want to make sure this is the case. Good naming of directories would lead me to believe it shouldn't happen, but who knows...
If anyone knows a good package to test this behavior on, let me know. I haven't yet ran it on a lot of packages. I tried running it on the gnubiff package listed in the bug report but got a linking error (with both the version in the PKGBUILD and the updated 2.2.4 version).
# move /usr/share/man files to /usr/man
IMHO $startdir/pkg/opt treeshouldn't be touched. For example my abyssws package has /opt/abyssws/doc directory. Of course KEEPDOCS can be used, but IMHO most packages in /opt should keep untouched as much files as possible. Anyway that's not a big problem. If it will decided so - KEEPDOCS may be used for such packages. -- Roman Kyrylych (Роман Кирилич)
participants (4)
-
Aaron Griffin
-
Dan McGee
-
Jürgen Hötzel
-
Roman Kyrylych