pbuilder-dist and flexible configuration files

Bug #628933 reported by Gunnar Thielebein
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-dev-tools (Ubuntu)
Fix Released
Wishlist
Siegfried Gevatter

Bug Description

Binary package hint: ubuntu-dev-tools

In the past, with the shell version of pbuilder-dist, it was possible to use flexible configuration files like this:

pbuilderrc:

    case "$DIST" in
        intrepid) #ubuntu
            MIRRORSITE="http://de.archive.ubuntu.com/ubuntu"
            COMPONENTS="main restricted universe multiverse"
            ;;
            jaunty) #ubuntu
            MIRRORSITE="http://de.archive.ubuntu.com/ubuntu"
            COMPONENTS="main restricted universe multiverse"
            ;;
        hardy) # ubuntu
            MIRRORSITE="http://de.archive.ubuntu.com/ubuntu"
            COMPONENTS="main restricted universe multiverse"
            OTHERMIRROR="http://de.archive.ubuntu.com/hardy-backports main restricted universe multiverse"

$DIST / $ARCH where simply defined somewhere appropriate in the script.
This seems to be not possible anymore with the python version.
Environment variables seems to be not usable outside the python process.
I tried to add this but it never works:

--- /usr/bin/pbuilder-dist 2010-04-22 21:48:49.000000000 +0200
+++ ../chroot/pbuilder-dist 2010-09-02 17:30:05.012478148 +0200
@@ -133,6 +133,10 @@
                                sys.exit(1)

                self.target_distro = distro
+ os.environ['DIST'] = distro
+
+ if self.build_architecture:
+ os.environ['ARCH'] = self.build_architecture

        def set_operation(self, operation):
                """ pbuilder_dist.set_operation -> None

Revision history for this message
Siegfried Gevatter (rainct) wrote :

Thank you for your bug report. I don't understand your request, though, could you please elaborate on which functionality you are missing?

(By the way, the old pbuilder-dist is still available in ubuntu-dev-tools as pbuilder-dist-simple.)

Changed in ubuntu-dev-tools (Ubuntu):
importance: Undecided → Wishlist
status: New → Incomplete
Revision history for this message
Gunnar Thielebein (lorem-ipsum) wrote :

Hi Sigfried,

thanks to your fast reply. To hopefully clarify it more shortly: The old shell pbuilder-dist script had the possibility to add some variable exports somewhere like

export DIST = $DISTRIBUTION
export ARCH = $ARCHITECTURE

This is not possible for me within the python script at least not with using s.t. like os.environ['DIST'] = distribution .
So what I need is a solution to make use of the flexibility of the above pbuildrc config for setting specific MIRROR/OTHERMIRROR/COMPONENTS options for different distributions. I want to integrate packages from my ppa and other sources into the build-chroot on build process. And yes, I want to stay with the python script whenever possible :-)

Revision history for this message
Siegfried Gevatter (rainct) wrote :

Are you aware that if you create symlinks with names like "pbuilder-maverick" or "pbuilder-experimental-i386" pointing to /usr/bin/pbuilder-dist it will take the distribution and architecture from the executable name?

Revision history for this message
Gunnar Thielebein (lorem-ipsum) wrote :

Hi Sigfried,

Of course I use symlinks all the time, what do you want to tell me in your last comment?

The goal is too use other urls of package archives in the chroots, but only for specific distriubutions. In the config snippet, posted initially, you see that there is the XXXX-backports included explicitly for hardy.

The main problem is that the environment variables set via os.environ['XXX'] are not available in the configuration file. So question is why and how to workaround possible limitations with python in that case (If it is a python problem).

Here's the task, of setting environment variables, described and perhaps a workaround in the comments: http://code.activestate.com/recipes/159462-how-to-set-environment-variables/

Revision history for this message
Siegfried Gevatter (rainct) wrote :

Oh, I see. Sorry, I got confused about what you were asking for.

I'll look into this somewhen soon.

Changed in ubuntu-dev-tools (Ubuntu):
assignee: nobody → Siegfried Gevatter (rainct)
status: Incomplete → Confirmed
Revision history for this message
Siegfried Gevatter (rainct) wrote :

I have just pushed a possible solution, can you please test whether this works for you?

If I understood the problem correctly, your attempt to change os.environ didn't work because by default `sudo' strips out all unknown variables (see "sudo -s 'sudo -V'"). This can be worked around by defining them inside the sudo call as I did.

Changed in ubuntu-dev-tools (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Benjamin Drung (bdrung) wrote :

Can you change the get_command function to return a list and use subprocess.call instead of os.system like we do in sponsor-patch?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-dev-tools - 0.105

---------------
ubuntu-dev-tools (0.105) experimental; urgency=low

  [ Siegfried-Angel Gevatter Pujals ]
  * pbuilder-dist, doc/pbuilder-dist.1:
     - Export the distribution and architecture information to the environment
       so that it is available in pbuilderrc, etc. (LP: #628933).

  [ Naty Bidart ]
  * lp-project-upload: Add support handling multiple project series.

  [ Kees Cook ]
  * mk-sbuild: use --no-install-recommends on Debian too (Closes: #599699).

  [ Marco Rodrigues ]
  * pull-debian-source:
     - Show message when a package isn't in Debian testing (LP: #529041).

  [ Stefano Rivera ]
  * doc/syncpackage.1:
     - Add a warning that the use of syncpackage is discouraged.
     - Correct and neaten options.
  * syncpackage:
     - Add --dont-sign parameter, for test builds.

  [ Christopher James Halse Rogers ]
  * mk-sbuild: Add support for btrfs-snapshot based chroots

  [ Iain Lane ]
  * pbuilder-dist: Explicitly use debian keyring when working with a
    Debian chroot, working around #599695

  [ Benjamin Drung ]
  * syncpackage:
    - Don't crash if environment variables aren't set (LP: #665202).
    - Don't add quotation marks to changelog entries (LP: #668805).
    - Show a error message instead of raising an error if Ubuntu contains a
      newer version.
    - Print an error message if the source-only build fails (LP: #668749).
 -- Benjamin Drung <email address hidden> Sat, 30 Oct 2010 20:58:30 +0200

Changed in ubuntu-dev-tools (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.