OPINIONS: The Mishnah states that one may break a barrel on Shabbos in order to eat the figs that are inside of it. RASHI (DH Shover) explains that this is permissible because one performs a destructive act (Mekalkel) when he breaks the barrel, "and it is not forbidden whatsoever to be Mekalkel on Shabbos."
We know that Stirah (demolishing) for the sake of building is a Melachah d'Oraisa, and Stirah not for the sake of building is prohibited mid'Rabanan. Why should one be permitted l'Chatchilah to break open a barrel on Shabbos? The act should be prohibited mid'Rabanan.
(a) The RASHBA explains that Rashi follows his opinion elsewhere (47a, DH Chayav Chatas), where he says that the Melachos of Binyan and Stirah (building and demolishing) do not apply to utensils. They apply only to structures that are attached to the ground. Therefore, if a person makes a utensil on Shabbos, he is not Chayav for Binyan. Rather, he is Chayav for Makeh b'Patish ("the final hammer-blow"). Breaking a utensil, therefore, is not forbidden, because Makeh b'Patish has no destructive counterpart.
(b) TOSFOS (DH Shover) argues and maintains that the Melachos of Binyan and Stirah apply to utensils. The only time that one is permitted to make or break a utensil, according to Tosfos (102b, DH Hai), is when that utensil is made to be assembled and disassembled. Why, then, is one permitted to break the barrel in the case of the Mishnah here?
Tosfos explains, based on the Gemara in Beitzah (33b), that the Gemara here refers to a barrel that was once broken, and one fixed it by gluing together the broken parts. The repaired barrel is no longer considered a complete utensil, and therefore one is permitted to break it open to obtain its contents. Any other barrel, though, may not be broken on Shabbos.
(c) The RITVA explains that breaking a barrel indeed should be prohibited mid'Rabanan, because it is an act of Stirah without intent to build. The only reason the Mishnah here says one is permitted to break the barrel is because the Rabanan permitted it for the sake of Oneg Shabbos (since one wants to use the food inside the barrel to enhance his Shabbos pleasure). However, they only permitted this in the case of breaking a barrel, but not other types of vessels. A barrel is usually not put back together again and therefore it is uncommon for such a Stirah to be "Al Menas Livnos," in order to eventually use the materials to rebuild something.
(d) The YERUSHALMI here, cited by the SHITAH L'RAN, explains that opening a barrel to get the food inside is comparable to opening the shell of a nut to remove the nut inside. Since the barrel is the normal container for the food inside, opening it is not considered Stirah. Rather, it is considered as though one is merely taking food out of its container.
HALACHAH: The Halachah (SHULCHAN ARUCH OC 314:1) follows the opinion of Tosfos (b), that Binyan and Stirah do apply to utensils and the only type of barrel that one may break open on Shabbos is one that was broken and glued together. A complete, unbroken barrel may not be broken in order to get the food inside of it.
However, one is permitted to open plastic bags and containers that contain food, because those containers are made for temporary use and thus they are comparable to a broken barrel that was repaired with glue, which is not considered a real utensil. (See Insights to Beitzah 32:1 for a comprehensive discussion of the topic of opening food containers on Shabbos.)